Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.awt.font.GlyphSet
GlyphSets are immutable; once created, their state never changes. In particular, changes to the text from which they were created do not affect existing GlyphSets.
The glyphs in a GlyphSet are stored in logical order; that is, they
are stored in the same order as the characters from which they were generated.
GlyphSets also maintain a visual order for their glyphs. The visual
order is the order, from left to right, in which the glyphs will be displayed.
For text with right-to-left or bidirectional ordering, the logical order will
not be the same as the visual order. Glyphs are available in logical order
directly from the GlyphSet. Additionally, visualToLogicalIndex
will convert a visual position to a logical position.
A GlyphSet may contain more glyphs than the number of characters in the sequence it represents (but never less). Methods on GlyphSet which return information on glyphs require a glyph index. Other methods on GlyphSet are commonly associated with text editing (such as inserting or deleting a character, or taking a subset). These operations used character indices.
Example:
Examine glyphs in visual order
GlyphSet glyphSet = ...; for (int i=0; i < getNumGlyphs(); i++) { int logIndex = glyphSet.visualToLogicalIndex(i); int glyphCode = glyphSet.getGlyphCode(logIndex); // do something with glyphCode... }
Field Summary | |
static boolean | LEFT_TO_RIGHT
|
static boolean | RIGHT_TO_LEFT
|
Constructor Summary | |
GlyphSet()
|
Method Summary | |
GlyphSet | applyJustification(float[] deltas,
int index,
boolean[] flags)
|
GlyphSet | deleteChar(AttributedCharacterIterator newText,
int start,
int limit,
int deletePos,
int[] order,
byte[] levels)
|
void | draw(Graphics2D graphics,
float x,
float y)
|
boolean | equals(GlyphSet set)
|
float | getAdvance()
|
float | getAdvanceBetween(int start,
int limit)
|
float | getAscent()
|
byte | getBaseline()
|
Rectangle2D | getBounds()
|
static int[] | getContiguousOrder(int[] values)
|
float | getDescent()
|
Font | getFont()
|
float | getGlyphAdvance(int index)
|
int | getGlyphCode(int index)
|
int[] | getGlyphCodes()
|
float | getGlyphXAdvance(int index)
|
float | getGlyphYAdvance(int index)
|
static int[] | getInverseOrder(int[] values)
|
byte | getLevel(int index)
|
int | getLineBreakIndex(int start,
float hitAdvance)
|
static int[] | getNormalizedOrder(int[] values,
byte[] levels,
int start,
int limit)
|
int | getNumCharacters()
|
int | getNumGlyphs()
|
float | getXAdjust()
|
float | getYAdjust()
|
int | hashCode()
|
GlyphSet | insertChar(AttributedCharacterIterator newText,
int start,
int limit,
int insertPos,
int[] order,
byte[] levels)
|
boolean | isCompletelyLTR()
|
GlyphSet | reshape(AttributedCharacterIterator newText,
int start,
int limit,
int changePos,
int[] order,
byte[] levels)
|
GlyphSet | setDirection(boolean leftToRight)
|
GlyphSet | subset(int start,
int limit)
|
int | visualToLogicalIndex(int index)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean LEFT_TO_RIGHT
public static final boolean RIGHT_TO_LEFT
Constructor Detail |
public GlyphSet()
Method Detail |
public abstract float getAdvance()
public abstract float getAscent()
public abstract float getDescent()
public abstract Font getFont()
public abstract int getNumGlyphs()
public abstract int getNumCharacters()
public abstract int getGlyphCode(int index)
public abstract byte getBaseline()
public abstract float getXAdjust()
public abstract float getGlyphXAdvance(int index)
public abstract float getYAdjust()
public abstract float getGlyphYAdvance(int index)
public abstract float getGlyphAdvance(int index)
public abstract int visualToLogicalIndex(int index)
public abstract byte getLevel(int index)
public abstract boolean isCompletelyLTR()
public abstract GlyphSet applyJustification(float[] deltas, int index, boolean[] flags)
deltas
- an array of amounts by which to change the left
and right sides of each glyph, in visual order. The array has
at least twice as many entries as there are glyphs in the glyphset.
For example, deltas[index] is the delta for the left side of
the visually leftmost glyph, deltas[index+1] is for the right side
of the visually leftmost glyph, deltas[index+2] is for the left side
of the visually second leftmost glyph, and so on.
index
- the starting position in the deltas array. It
corresponds to the left side of the leftmost glyph.
shouldRejustify
- an array containing a single input/output
boolean value. On entry, it indicates whether the returned glyphset
is allowed to cause rejustification, for example, if a ligature can
be formed or broken. On exit, it indicates whether the returned
glyphset will require rejustification (for example, due to the
formation or removal of a ligature).
public abstract float getAdvanceBetween(int start, int limit)
start
- the character index at which to start measuring
limit
- the character index at which to stop measuring
public abstract int getLineBreakIndex(int start, float hitAdvance)
public abstract GlyphSet subset(int start, int limit)
start
- the character index where the subset will begin
limit
- the character index immediately after the end of
the subset
public abstract GlyphSet insertChar(AttributedCharacterIterator newText, int start, int limit, int insertPos, int[] order, byte[] levels)
newText
- the text for the new glyphset. This represents
the text after the insertion occurred. The new glyphset will
represent the text beginning at start, up to (but not including)
limit.
start
- the start of the subrange in newText for the glyphset
limit
- the limit of the subrange in newText for the glyphset,
including the inserted character.
insertPos
- the character position in the glyphset at which
the single character was inserted.
order
- the logical-to-visual mapping array for newText.
If null, left-to-right is assumed.
levels
- the bidirection level of each character in newText.
If null, all levels are assumed to be 0.
public abstract GlyphSet deleteChar(AttributedCharacterIterator newText, int start, int limit, int deletePos, int[] order, byte[] levels)
newText
- the text for the new glyphset. This represents the
text after the deletion occurred. The new glyphset will represent
the text beginning at start, up to (but not including) limit.
start
- the start of the subrange in newText for the glyphset.
limit
- the limit of the subrange in newText for the glyphset,
not including the deleted character.
deletePos
- the character position in the glyphset at which the
single character was deleted.
order
- the logical-to-visual mapping array for newText.
If null, left-to-right is assumed.
levels
- the bidirection level of each character in newText.
If null, all levels are assumed to be 0.
public abstract GlyphSet reshape(AttributedCharacterIterator newText, int start, int limit, int changePos, int[] order, byte[] levels)
newText
- styled text represented by this GlyphSet over the
range start, limit.
start
- the start of the range in newText represented by this
GlyphSet.
limit
- the limit of the range in newText represented by this
GlyphSet.
changePos
- the position in newText that has changed since this
GlyphSet was created. This parameter must be either start-1 or limit.
order
- the logical-to-visual mapping array for newText.
If null, left-to-right is assumed.
levels
- the bidirection level of each character in newText.
If null, all levels are assumed to be 0.
public abstract void draw(Graphics2D graphics, float x, float y)
public abstract Rectangle2D getBounds()
public abstract GlyphSet setDirection(boolean leftToRight)
public abstract int hashCode()
public abstract boolean equals(GlyphSet set)
public static int[] getInverseOrder(int[] values)
public static int[] getContiguousOrder(int[] values)
public static int[] getNormalizedOrder(int[] values, byte[] levels, int start, int limit)
public abstract int[] getGlyphCodes()
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |