|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.eclipse.swt.custom.StyledTextBidi
| Field Summary | |
private int[] |
bidiSegments
|
private byte[] |
classBuffer
|
private int[] |
dx
|
private GC |
gc
|
private char[] |
glyphBuffer
|
private int[] |
order
|
private int[] |
renderPositions
|
| Constructor Summary | |
StyledTextBidi(GC gc,
int tabWidth,
String text,
StyleRange[] ranges,
Font boldFont,
int[] offsets)
Constructs an instance of this class for a line of text. |
|
StyledTextBidi(GC gc,
String text,
int[] offsets)
Constructs an instance of this class for a line of text. |
|
| Method Summary | |
(package private) static void |
addLanguageListener(Control control,
Runnable runnable)
Adds a listener that should be called when the user changes the keyboard layout for the specified window. |
private void |
calculateRenderPositions()
Calculates render positions using the glyph distance values in the dx array. |
private void |
calculateTabStops(String text,
int tabWidth)
Calculate the line's tab stops and adjust the dx array to reflect the width of tab characters. |
(package private) void |
drawBidiText(int logicalStart,
int length,
int xOffset,
int yOffset)
Renders the specified text segment. |
private void |
drawGlyphs(int visualStart,
int length,
int x,
int y)
Renders a segment of glyphs. |
(package private) void |
fillBackground(int logicalStart,
int length,
int xOffset,
int yOffset,
int height)
Fills a rectangle spanning the given logical range. |
(package private) int[] |
getCaretOffsetAndDirectionAtX(int x)
Returns the offset and direction that will be used to position the caret for the given x location. |
private Vector |
getDirectionRuns(int logicalStart,
int length)
Returns the direction segments that are in the specified text range. |
(package private) static int |
getKeyboardLanguageDirection()
Answers the direction of the active keyboard language - either L2R or R2L. |
(package private) int |
getLigatureEndOffset(int offset)
Returns the offset of the last character comprising a ligature. |
(package private) int |
getLigatureStartOffset(int offset)
Returns the offset of the first character comprising a ligature. |
private int |
getLogicalOffset(int visualOffset)
Returns the logical offset of the character at the specified visual offset. |
(package private) int |
getOffsetAtX(int x)
Returns the offset of the character at the specified x location. |
private int[] |
getRenderIndexesFor(int start,
int length)
Returns the reordering indices that map between logical and visual index of characters in the specified range. |
private StyleRange[] |
getSegmentedRangesFor(StyleRange[] ranges)
Break up the given ranges such that each range is fully contained within a bidi segment. |
private int |
getTextLength()
Returns the number of characters in the line. |
(package private) int |
getTextPosition(int logicalOffset)
Returns the x position at the specified offset in the line. |
(package private) int |
getTextPosition(int logicalOffset,
int direction)
Returns the x position at the specified offset in the line. |
(package private) int |
getTextWidth()
Returns the width in pixels of the line. |
private int |
getVisualOffsetAtX(int x)
Returns the visual offset of the character at the specified x location. |
(package private) static boolean |
isBidiPlatform()
Returns whether the current platform supports a bidi language. |
(package private) static boolean |
isCharacterShaped(GC gc)
Returns whether the font set in the specified gc supports character shaping. |
(package private) static boolean |
isLigated(GC gc)
Returns whether the font set in the specified gc contains ligatured glyphs. |
(package private) boolean |
isLocalNumber(int logicalIndex)
Returns if the character at the given offset is a local number. |
(package private) boolean |
isRightToLeft(int logicalIndex)
Returns the direction of the character at the specified index. |
(package private) boolean |
isRightToLeftInput(int logicalIndex)
Returns the direction of the character at the specified index. |
private boolean |
isStartOfBidiSegment(int logicalIndex)
Returns whether the specified index is the start of a user specified direction segment. |
private void |
prepareFontStyledText(String textline,
int logicalStart,
int length)
Reorders and calculates render positions for the specified sub-line of text. |
(package private) void |
redrawRange(Control parent,
int logicalStart,
int length,
int xOffset,
int yOffset,
int height)
Redraws a rectangle spanning the given logical range. |
(package private) static void |
removeLanguageListener(Control control)
Removes the keyboard language listener for the specified window. |
(package private) void |
setKeyboardLanguage(int logicalIndex)
Sets the keyboard language to match the codepage of the character at the specified offset. |
String |
toString()
Returns a string representation of the receiver. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private GC gc
private int[] bidiSegments
private int[] renderPositions
private int[] order
private int[] dx
private byte[] classBuffer
private char[] glyphBuffer
| Constructor Detail |
public StyledTextBidi(GC gc,
int tabWidth,
String text,
StyleRange[] ranges,
Font boldFont,
int[] offsets)
gc - the GC to use for rendering and measuring of this line.tabWidth - tab width in number of spaces, used to calculate
tab stopstext - line that bidi data should be calculated forboldFont - font that bold text will be rendered in, needed for
proper measuring of bold text segments.
public StyledTextBidi(GC gc,
String text,
int[] offsets)
gc - the GC to use for rendering and measuring of this line.text - line that bidi data should be calculated for| Method Detail |
static void addLanguageListener(Control control,
Runnable runnable)
control - Control to add the keyboard language listener for.
Each window has its own keyboard language setting.runnable - the listener that should be called when the user
changes the keyboard layout.static int getKeyboardLanguageDirection()
static boolean isBidiPlatform()
static boolean isCharacterShaped(GC gc)
gc - the GC that should be tested for character shaping.
static boolean isLigated(GC gc)
gc - the GC that should be tested for ligatures.
static void removeLanguageListener(Control control)
control - window to remove the keyboard language listener from.private void calculateRenderPositions()
private void calculateTabStops(String text,
int tabWidth)
text - the original line text (not reordered) containing
tab characters.tabWidth - number of pixels that one tab character represents
void drawBidiText(int logicalStart,
int length,
int xOffset,
int yOffset)
logicalStart - start offset in the logical textlength - number of logical characters to renderxOffset - x location of the line startyOffset - y location of the line start
private void drawGlyphs(int visualStart,
int length,
int x,
int y)
visualStart - start offset of the glyphs to render relative to the
line start.length - number of glyphs to renderx - x location to render aty - y location to render at
void fillBackground(int logicalStart,
int length,
int xOffset,
int yOffset,
int height)
logicalStart - logcial start offset of the rectanglelength - number of logical characters the rectangle should spanxOffset - x location of the line startyOffset - y location of the line startheight - height of the rectangleint[] getCaretOffsetAndDirectionAtX(int x)
x - the x location of the character in the line.
private Vector getDirectionRuns(int logicalStart,
int length)
logicalStart - offset of the logcial start of the first
direction segmentlength - length of the text included in the direction
segments
int getLigatureEndOffset(int offset)
offset - the logical offset of a character that may be a
ligature.
int getLigatureStartOffset(int offset)
offset - the logical offset of a character that may be a
ligature.
private int getLogicalOffset(int visualOffset)
visualOffset - the visual offset
visualOffset.int getOffsetAtX(int x)
x - the location of the character
private int[] getRenderIndexesFor(int start,
int length)
start - start offset of the reordering indiceslength - number of reordering indices to return
private StyleRange[] getSegmentedRangesFor(StyleRange[] ranges)
private int getTextLength()
int getTextPosition(int logicalOffset)
logicalOffset - offset of the character in the line.
int getTextPosition(int logicalOffset,
int direction)
logicalOffset - offset of the character in the linedirection - direction the caret moved to the specified location.
either ST.COLUMN_NEXT (right cursor key) or ST.COLUMN_PREVIOUS (left cursor key) .
int getTextWidth()
private int getVisualOffsetAtX(int x)
x - the location of the character
boolean isLocalNumber(int logicalIndex)
logicalIndex - the index of the character
boolean isRightToLeft(int logicalIndex)
logicalIndex - the index of the character
boolean isRightToLeftInput(int logicalIndex)
logicalIndex - the index of the character
private boolean isStartOfBidiSegment(int logicalIndex)
logicalIndex - the index to test
private void prepareFontStyledText(String textline,
int logicalStart,
int length)
textline - the entire line of text that this object represents.logicalStart - the start offset of the first character to
reorder.length - the number of characters to reorder
void redrawRange(Control parent,
int logicalStart,
int length,
int xOffset,
int yOffset,
int height)
parent - window that should be invalidatedlogicalStart - logcial start offset of the rectanglelength - number of logical characters the rectangle should spanxOffset - x location of the line startyOffset - y location of the line startheight - height of the invalidated rectanglevoid setKeyboardLanguage(int logicalIndex)
logicalIndex - logical offset of the character to use for
determining the new keyboard language.public String toString()
toString in class Object
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||