Package org.apache.fop.fonts.truetype
Class GlyfTable
java.lang.Object
org.apache.fop.fonts.truetype.GlyfTable
This "glyf" table in a TrueType font file contains information that describes the glyphs. This
class is responsible for creating a subset of the "glyf" table given a set of glyph indices.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionAll the glyphs that are composed, but do not appear in the subset.All the composite glyphs that appear in the subset.private final FontFileReader
private final OFMtxEntry[]
private final long
-
Constructor Summary
ConstructorsConstructorDescriptionGlyfTable
(FontFileReader in, OFMtxEntry[] metrics, OFDirTabEntry dirTableEntry, Map<Integer, Integer> glyphs) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Adds to the subset, all the glyphs that are composed by a glyph, but do not appear themselves in the subset.boolean
isComposite
(int indexInOriginal) protected void
Populates the map of subset glyphs with all the glyphs that compose the glyphs in the subset.private void
remapComposite
(long glyphOffset) Re-maps the index of composed glyphs in the original font to the index of the same glyph in the subset font.retrieveComposedGlyphs
(int indexInOriginal) Reads a composite glyph at a given index and retrieves all the glyph indices of contingent composed glyphs.private void
scanGlyphsRecursively
(int indexInOriginal) Scans each glyph for any composed glyphs.
-
Field Details
-
mtxTab
-
tableOffset
private final long tableOffset -
remappedComposites
-
subset
-
in
-
compositeGlyphs
All the composite glyphs that appear in the subset. -
composedGlyphs
All the glyphs that are composed, but do not appear in the subset.
-
-
Constructor Details
-
GlyfTable
public GlyfTable(FontFileReader in, OFMtxEntry[] metrics, OFDirTabEntry dirTableEntry, Map<Integer, Integer> glyphs) throws IOException- Throws:
IOException
-
-
Method Details
-
populateGlyphsWithComposites
Populates the map of subset glyphs with all the glyphs that compose the glyphs in the subset. This also re-maps the indices of composed glyphs to their new index in the subset font.- Throws:
IOException
- an I/O error
-
scanGlyphsRecursively
Scans each glyph for any composed glyphs. This populatescompositeGlyphs
with all the composite glyphs being used in the subset. This also populatesnewGlyphs
with any new glyphs that are composed and do not appear in the subset of glyphs. For example the double quote mark (") is often composed of two apostrophes ('), if an apostrophe doesn't appear in the glyphs in the subset, it will be included and will be added to newGlyphs.- Parameters:
indexInOriginal
- the index of the glyph to test from the original font- Throws:
IOException
- an I/O error
-
addAllComposedGlyphsToSubset
protected void addAllComposedGlyphsToSubset()Adds to the subset, all the glyphs that are composed by a glyph, but do not appear themselves in the subset. -
remapComposite
Re-maps the index of composed glyphs in the original font to the index of the same glyph in the subset font.- Parameters:
glyphOffset
- the offset of the composite glyph- Throws:
IOException
- an I/O error
-
isComposite
- Throws:
IOException
-
retrieveComposedGlyphs
Reads a composite glyph at a given index and retrieves all the glyph indices of contingent composed glyphs.- Parameters:
indexInOriginal
- the glyph index of the composite glyph- Returns:
- the set of glyph indices this glyph composes
- Throws:
IOException
- an I/O error
-