public class TextGlyphRun extends Object
A run is sequence of glyphs that share common attributes and don't require any special inter-glyph positioning. A run can be either horizontal or vertical. Horizontal runs are used for Latin, Middle-Eastern and certain Asian scripts. The implicit rendering order of a horizontal run is always left-to-right (LTR), even it contains glyphs based on right-to-left (RTL) characters. Vertical runs are used for CJK text in vertical format.
| Constructor and Description |
|---|
TextGlyphRun()
Default constructor.
|
TextGlyphRun(TextGlyphRun oSource)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCharGlyphs(String sCharGlyphs) |
void |
addGlyph(int nAdd)
Add a single glyph to the run.
|
void |
copyFrom(TextGlyphRun oSource)
Assignment operator.
|
TextAttr |
getAttr()
Return the text attributes that apply to this run.
|
int |
getGlyph(int nIndex)
Extract one glyph from the run, by index.
|
int |
getGlyphCount()
Return the number of glyphs currently in the run.
|
int |
getGlyphOrientation()
Query the glyph orientation for this run.
|
CoordPair |
getPosition()
Obtain the runs position.
|
CoordPair |
getShift()
Obtain the run's shift.
|
boolean |
isCharRun()
Query whether this run represents Unicode characters or glyph IDs.
|
boolean |
isRTL()
Query whether this run represents RTL glyphs.
|
boolean |
isShifted()
Convenience method to query whether the run has any shift.
|
void |
setAttr(TextAttr oAttr)
/**
Set the attributes to be used for this run.
|
void |
setAttrRef(TextAttr poAttr)
Set the attributes to be used for this run, via a reference-counted
attribute object.
|
void |
setCharRun(boolean bCharRun)
Tells the glyph run whether its 32-bit values represent Unicode
characters or glyph IDs.
|
void |
setGlyphOrientation(int eGlyphOrientation)
Set the glyph orientation for this run.
|
void |
setRTL(boolean bRTL)
Tells the glyph run whether it represents right-to-left (RTL) glyphs.
|
void |
setShift(CoordPair oShift)
Specify a shift for the run.
|
public TextGlyphRun()
The run is initially empty of glyphs and has a null attribute pointer. Its position and shift are both set to (0,0).
public TextGlyphRun(TextGlyphRun oSource)
Create a new glyph run, copying the contents of the given source run. Note that copying the run's attributes means adding a reference to the shared attribute object.
oSource - - Source run object to copy.public void setAttr(TextAttr oAttr)
All text attributes can be specified through a single TextAttr object. This object represents a possibly sparse collection of attributes. Please see the description of the TextAttr class for more information.
oAttr - - Attribute set to use for this run. Any omitted
attributes will be inherited from the previous run. If attributes
are missing on the first run, TextAttr defaults will be used. The
run will cache a copy of the attribute object; the caller can delete
or modify the original after the method returns.public void setAttrRef(TextAttr poAttr)
Please see method SetAttr() for more information on attributes.
poAttr - - Attribute set to use for this run. Unlike method
SetAttr(), this method does not make a copy. Instead, the given
attribute object is assumed to be reference counted. After the call,
the run will have added its own reference to the object. This allows
the caller to create a common attribute instance to be shared by
several runs.public TextAttr getAttr()
public void setShift(CoordPair oShift)
A shift occurs if the run doesnt start at the end point of the previous run. This could be the result of either a baseline shift, a horizontal shift such as kerning adjustment, or both. There is no need to set the shift for the first run of a line if that run starts at the left endpoint of the line's baseline.
A horizontal shift implicitly cascades through subsequent runs. In other words, if a run is shifted left due to kerning, the next run would normally start at the end point of the shifted run. There would be no need to explicitly declare a shift on subsequent runs. Indeed, if the next run did declare a shift, the shift would compound.
On the other hand, vertical shifts must be re-asserted on each run. If a run is shifted away from its baseline, the next run will revert to the baseline if it doesn't declare its own vertical shift.
oShift - - Shift to apply to this run.public CoordPair getShift()
public boolean isShifted()
public CoordPair getPosition()
This call makes sense only after formatting. It returns the position--relative to the left endpoint of the lines baseline--of the run.
public void addGlyph(int nAdd)
nAdd - - Glyph ID to add to the run.public void addCharGlyphs(String sCharGlyphs)
public int getGlyphCount()
public int getGlyph(int nIndex)
nIndex - - Index of the desired glyph. Index numbers start at
zero. Unpredictable results will occur if the index is out of range.public void setCharRun(boolean bCharRun)
bCharRun - - True if this run represents Unicode characters;
false if it represents glyph IDs. If the client never sets this
flag, it defaults to false.public boolean isCharRun()
public void setRTL(boolean bRTL)
AXTE needs to know glyph direction when resolving ambiguous caret positions in bidirectional text. Unfortunately it cannot glean such direction from the mappings alone; the application must provide glyph direction independently of the mappings.
bRTL - - True if this run represents RTL glyphs; false if it
represents left-to-right (LTR) glyphs. If the client never sets this
flag, it defaults to false.public boolean isRTL()
public void setGlyphOrientation(int eGlyphOrientation)
eGlyphOrientation - - New glyph orientation to use.public int getGlyphOrientation()
public void copyFrom(TextGlyphRun oSource)
Copies all contents of the given source run. Note that copying the run's attributes means adding a reference to the shared attribute object.
oSource - - Source run object to copy.Copyright © 2010 - 2020 Adobe. All Rights Reserved