|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.font.format.Kerning
public class Kerning
Manages the storage and retrieval of kerning information for a font.
Use addKerningEntry(int, int, short)
to add kerning pairs.
When all pairs have been added, use lock()
to lock the instance.
Kerning information cannot be retrieved until the instance is locked. Once
it is locked, no more kerning entries can be added to it.
Field Summary | |
---|---|
static long |
serialVersionUID
Constant needed for serialization. |
Constructor Summary | |
---|---|
Kerning(int expectedPairs)
Constructor. |
Method Summary | |
---|---|
void |
addCapacity(int pairsToAdd)
Increases the size of the arrays by pairsToAdd . |
void |
addKerningEntry(int glyphIndex1,
int glyphIndex2,
short kernAmount)
Adds a kerning pair. |
int |
getCapacity()
Returns the current capacity. |
char |
getGlyphIndex1(int index)
The first glyph index of a given kerning pair. |
char |
getGlyphIndex2(int index)
The second glyph index of a given kerning pair. |
short |
getKernAmount(int index)
The kerning amount of a given kerning pair. |
int |
getLength()
Returns the number of kerning pairs. |
boolean |
isEmpty()
Indicates whether there is any kerning information. |
int |
kern(int glyphIndex1,
int glyphIndex2)
Computes the kerning needed between two glyphs in this font. |
void |
lock()
Run this method when all kerning entries have been added (using addKerningEntry(int, int, short) ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long serialVersionUID
Constructor Detail |
---|
public Kerning(int expectedPairs)
expectedPairs
- The number of kerning pairs that are expected to be created.
Setting this value to the proper amount will improve performance.Method Detail |
---|
public void addCapacity(int pairsToAdd)
pairsToAdd
.
pairsToAdd
- The amount by which to increase the number of kerning
pairs that can be stored.public void addKerningEntry(int glyphIndex1, int glyphIndex2, short kernAmount)
lock()
.
glyphIndex1
- The glyph index of the first (left in left-to-right) glyph in the kerning pair.glyphIndex2
- The glyph index of the second (right in left-to-right) glyph in the kerning pair.kernAmount
- The amount, in raw font units (millipoints for Type 1), that the glyphs should be kerned.
A positive amount indicates that the glyphs should be moved apart, a negative amount indicates that they should
be moved together.public void lock()
addKerningEntry(int, int, short)
). The Kerning instance is
not usable until it has been locked.
public int kern(int glyphIndex1, int glyphIndex2)
lock()
.
glyphIndex1
- The glyph index of the first (left in a left-to-right system) glyph.glyphIndex2
- The glyph index of the second (right in left-to-right system) glyph.
public boolean isEmpty()
public int getLength()
public int getCapacity()
public char getGlyphIndex1(int index)
index
- The index of the kerning pair.
index
.public char getGlyphIndex2(int index)
index
- The index of the kerning pair.
index
.public short getKernAmount(int index)
index
- The index of the kerning pair.
index
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |