Top Description Inners Fields Constructors Methods
org.apache.fontbox.ttf

public Class KerningSubtable

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.Arrays, .Comparator, org.apache.commons.logging.Log, .LogFactory

A 'kern' table in a true type font.
Author
Glenn Adams

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
private static class

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private boolean
private boolean
private static final Log
private boolean
private KerningSubtable.PairData

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static int
getBits(int bits, int mask, int shift)

public int[]

Returns:

a (possibly empty) array of kerning adjustments
getKerning
(int[]
a (possibly empty) array of glyph identifiers
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.

public int

Returns:

a (possibly zero) kerning adjustment
getKerning
(int
left member of glyph pair
l
,
int
right member of glyph pair
r
)

Obtain kerning adjustment for glyph pair {L,R}.

private static boolean
isBitsSet(int bits, int mask, int shift)

public boolean

Returns:

true if subtable is for horizontal kerning
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.

public boolean

Returns:

true if subtable is for horizontal kerning in horizontal modes
isHorizontalKerning
(boolean
if true, then return cross stream designator in horizontal modes
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.

pack-priv void
read(TTFDataStream
The stream to read the data from.
data
,
int
The version of the table to be read
version
)

This will read the required data from the stream.

private void
private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COVERAGE_CROSS_STREAMback to summary
private static final int COVERAGE_CROSS_STREAM
COVERAGE_CROSS_STREAM_SHIFTback to summary
private static final int COVERAGE_CROSS_STREAM_SHIFT
COVERAGE_FORMATback to summary
private static final int COVERAGE_FORMAT
COVERAGE_FORMAT_SHIFTback to summary
private static final int COVERAGE_FORMAT_SHIFT
COVERAGE_HORIZONTALback to summary
private static final int COVERAGE_HORIZONTAL
COVERAGE_HORIZONTAL_SHIFTback to summary
private static final int COVERAGE_HORIZONTAL_SHIFT
COVERAGE_MINIMUMSback to summary
private static final int COVERAGE_MINIMUMS
COVERAGE_MINIMUMS_SHIFTback to summary
private static final int COVERAGE_MINIMUMS_SHIFT
crossStreamback to summary
private boolean crossStream
horizontalback to summary
private boolean horizontal
LOGback to summary
private static final Log LOG
minimumsback to summary
private boolean minimums
pairsback to summary
private KerningSubtable.PairData pairs

Constructor Detail

KerningSubtableback to summary
pack-priv KerningSubtable()

Method Detail

getBitsback to summary
private static int getBits(int bits, int mask, int shift)
getKerningback to summary
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:int[]

a (possibly empty) array of glyph identifiers

Returns:int[]

a (possibly empty) array of kerning adjustments

getKerningback to summary
public int getKerning(int l, int r)

Obtain kerning adjustment for glyph pair {L,R}.

Parameters
l:int

left member of glyph pair

r:int

right member of glyph pair

Returns:int

a (possibly zero) kerning adjustment

isBitsSetback to summary
private static boolean isBitsSet(int bits, int mask, int shift)
isHorizontalKerningback to summary
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:boolean

true if subtable is for horizontal kerning

isHorizontalKerningback to summary
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:boolean

if true, then return cross stream designator in horizontal modes

Returns:boolean

true if subtable is for horizontal kerning in horizontal modes

readback to summary
pack-priv void read(TTFDataStream data, int version) throws IOException

This will read the required data from the stream.

Parameters
data:TTFDataStream

The stream to read the data from.

version:int

The version of the table to be read

Exceptions
IOException:
If there is an error reading the data.
readSubtable0back to summary
private void readSubtable0(TTFDataStream data) throws IOException
readSubtable0Format0back to summary
private void readSubtable0Format0(TTFDataStream data) throws IOException
readSubtable0Format2back to summary
private void readSubtable0Format2(TTFDataStream data)
readSubtable1back to summary
private void readSubtable1(TTFDataStream data)
org.apache.fontbox.ttf back to summary

private Interface KerningSubtable.PairData

Known Direct Implementers
org.apache.fontbox.ttf.KerningSubtable.PairData0Format0

Method Summary

Modifier and TypeMethod and Description
public int
getKerning(int l, int r)

public void

Method Detail

getKerningback to summary
public int getKerning(int l, int r)
readback to summary
public void read(TTFDataStream data) throws IOException
org.apache.fontbox.ttf back to summary

private Class KerningSubtable.PairData0Format0

extends Object
implements Comparator<int[]>, PairData
Class Inheritance
All Implemented Interfaces
org.apache.fontbox.ttf.KerningSubtable.PairData, java.util.Comparator

Field Summary

Modifier and TypeField and Description
private int[][]
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
compare(int[]
the first object to be compared.
p1
,
int[]
the second object to be compared.
p2
)

Implements java.util.Comparator.compare.

Compares its two arguments for order.

public int
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pairsback to summary
private int[][] pairs
searchRangeback to summary
private int searchRange

Constructor Detail

PairData0Format0back to summary
private PairData0Format0()

Method Detail

compareback to summary
public int compare(int[] p1, int[] p2)

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Parameters
p1:int[]

the first object to be compared.

p2:int[]

the second object to be compared.

Returns:int

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Annotations
@Override
getKerningback to summary
public int getKerning(int l, int r)

Implements org.apache.fontbox.ttf.KerningSubtable.PairData.getKerning.

Annotations
@Override
readback to summary
public void read(TTFDataStream data) throws IOException

Implements org.apache.fontbox.ttf.KerningSubtable.PairData.read.

Annotations
@Override