Package org.apache.fontbox.ttf
Class KerningSubtable
- java.lang.Object
-
- org.apache.fontbox.ttf.KerningSubtable
-
public class KerningSubtable extends java.lang.ObjectA 'kern' table in a true type font.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interfaceKerningSubtable.PairDataprivate static classKerningSubtable.PairData0Format0
-
Field Summary
Fields Modifier and Type Field Description private static intCOVERAGE_CROSS_STREAMprivate static intCOVERAGE_CROSS_STREAM_SHIFTprivate static intCOVERAGE_FORMATprivate static intCOVERAGE_FORMAT_SHIFTprivate static intCOVERAGE_HORIZONTALprivate static intCOVERAGE_HORIZONTAL_SHIFTprivate static intCOVERAGE_MINIMUMSprivate static intCOVERAGE_MINIMUMS_SHIFTprivate booleancrossStreamprivate booleanhorizontalprivate static org.apache.commons.logging.LogLOGprivate booleanminimumsprivate KerningSubtable.PairDatapairs
-
Constructor Summary
Constructors Constructor Description KerningSubtable()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static intgetBits(int bits, int mask, int shift)int[]getKerning(int[] glyphs)Obtain kerning adjustments for GLYPHS sequence, where the Nth returned adjustment is associated with the Nth glyph and the succeeding non-zero glyph in the GLYPHS sequence.intgetKerning(int l, int r)Obtain kerning adjustment for glyph pair {L,R}.private static booleanisBitsSet(int bits, int mask, int shift)booleanisHorizontalKerning()Determine if subtable is designated for use in horizontal writing modes and contains inline progression kerning pairs (not block progression "cross stream") kerning pairs.booleanisHorizontalKerning(boolean cross)Determine if subtable is designated for use in horizontal writing modes, contains kerning pairs (as opposed to minimum pairs), and, if CROSS is true, then return cross stream designator; otherwise, if CROSS is false, return true if cross stream designator is false.(package private) voidread(TTFDataStream data, int version)This will read the required data from the stream.private voidreadSubtable0(TTFDataStream data)private voidreadSubtable0Format0(TTFDataStream data)private voidreadSubtable0Format2(TTFDataStream data)private voidreadSubtable1(TTFDataStream data)
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
COVERAGE_HORIZONTAL
private static final int COVERAGE_HORIZONTAL
- See Also:
- Constant Field Values
-
COVERAGE_MINIMUMS
private static final int COVERAGE_MINIMUMS
- See Also:
- Constant Field Values
-
COVERAGE_CROSS_STREAM
private static final int COVERAGE_CROSS_STREAM
- See Also:
- Constant Field Values
-
COVERAGE_FORMAT
private static final int COVERAGE_FORMAT
- See Also:
- Constant Field Values
-
COVERAGE_HORIZONTAL_SHIFT
private static final int COVERAGE_HORIZONTAL_SHIFT
- See Also:
- Constant Field Values
-
COVERAGE_MINIMUMS_SHIFT
private static final int COVERAGE_MINIMUMS_SHIFT
- See Also:
- Constant Field Values
-
COVERAGE_CROSS_STREAM_SHIFT
private static final int COVERAGE_CROSS_STREAM_SHIFT
- See Also:
- Constant Field Values
-
COVERAGE_FORMAT_SHIFT
private static final int COVERAGE_FORMAT_SHIFT
- See Also:
- Constant Field Values
-
horizontal
private boolean horizontal
-
minimums
private boolean minimums
-
crossStream
private boolean crossStream
-
pairs
private KerningSubtable.PairData pairs
-
-
Method Detail
-
read
void read(TTFDataStream data, int version) throws java.io.IOException
This will read the required data from the stream.- Parameters:
data- The stream to read the data from.version- The version of the table to be read- Throws:
java.io.IOException- If there is an error reading the data.
-
isHorizontalKerning
public boolean isHorizontalKerning()
Determine if subtable is designated for use in horizontal writing modes and contains inline progression kerning pairs (not block progression "cross stream") kerning pairs.- Returns:
- true if subtable is for horizontal kerning
-
isHorizontalKerning
public boolean isHorizontalKerning(boolean cross)
Determine if subtable is designated for use in horizontal writing modes, contains kerning pairs (as opposed to minimum pairs), and, if CROSS is true, then return cross stream designator; otherwise, if CROSS is false, return true if cross stream designator is false.- Parameters:
cross- if true, then return cross stream designator in horizontal modes- Returns:
- true if subtable is for horizontal kerning in horizontal modes
-
getKerning
public int[] getKerning(int[] glyphs)
Obtain kerning adjustments for GLYPHS sequence, where the Nth returned adjustment is associated with the Nth glyph and the succeeding non-zero glyph in the GLYPHS sequence. Kerning adjustments are returned in font design coordinates.- Parameters:
glyphs- a (possibly empty) array of glyph identifiers- Returns:
- a (possibly empty) array of kerning adjustments
-
getKerning
public int getKerning(int l, int r)Obtain kerning adjustment for glyph pair {L,R}.- Parameters:
l- left member of glyph pairr- right member of glyph pair- Returns:
- a (possibly zero) kerning adjustment
-
readSubtable0
private void readSubtable0(TTFDataStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
readSubtable0Format0
private void readSubtable0Format0(TTFDataStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
readSubtable0Format2
private void readSubtable0Format2(TTFDataStream data)
-
readSubtable1
private void readSubtable1(TTFDataStream data)
-
isBitsSet
private static boolean isBitsSet(int bits, int mask, int shift)
-
getBits
private static int getBits(int bits, int mask, int shift)
-
-