Class TTFFont
java.lang.Object
org.openpdf.renderer.font.PDFFont
org.openpdf.renderer.font.OutlineFont
org.openpdf.renderer.font.TTFFont
- Direct Known Subclasses:
CIDFontType2
A true-type font
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classa point on the stack of points(package private) class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TrueTypeFontthe truetype font itselfprivate floatthe number of units per em in the font -
Constructor Summary
ConstructorsConstructorDescriptionTTFFont(String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor) TTFFont(String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor, File fontFile) create a new TrueTypeFont object based on a description of the font from the PDF file. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidadd a point off the curveprivate voidadd a point on the curvegetNames()protected GeneralPathgetOutline(char src, float width) Get the outline of a character given the character codeprotected GeneralPathgetOutline(int glyphId, float width) Get the outline of a character given the glyph idprotected GeneralPathgetOutline(String name, float width) Get the outline of a character given the character nameprotected GeneralPathgetOutlineFrom31CMap(char val, float width) lookup the outline using the (3, 1) cmap, as specified in 32000-1:2008, 9.6.6.4, when an Encoding is specified.protected GeneralPathrenderCompoundGlyph(GlyfTable glyf, GlyfCompound g) Render a compound glyfprotected GeneralPathRender a simple glyfMethods inherited from class OutlineFont
getCharCount, getDefaultWidth, getFirstChar, getGlyph, getLastChar, getWidthMethods inherited from class PDFFont
equals, getBaseFont, getCachedGlyph, getDescriptor, getEncoding, getFont, getGlyphs, getSubtype, getUnicodeMap, hashCode, setBaseFont, setDescriptor, setEncoding, setSubtype, setUnicodeMap, toString
-
Field Details
-
font
the truetype font itself -
unitsPerEm
private float unitsPerEmthe number of units per em in the font
-
-
Constructor Details
-
TTFFont
- Throws:
IOException
-
TTFFont
public TTFFont(String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor, File fontFile) throws IOException create a new TrueTypeFont object based on a description of the font from the PDF file. If the description happens to contain an in-line true-type font file (under key "FontFile2"), use the true type font. Otherwise, parse the description for key information and use that to generate an appropriate font.- Throws:
IOException
-
-
Method Details
-
getNames
-
getOutline
Get the outline of a character given the character code- Specified by:
getOutlinein classOutlineFont- Parameters:
src- the character code of the desired glyph- Returns:
- the glyph outline
-
getOutlineFrom31CMap
lookup the outline using the (3, 1) cmap, as specified in 32000-1:2008, 9.6.6.4, when an Encoding is specified.- Parameters:
val-width-- Returns:
- GeneralPath
-
getOutline
Get the outline of a character given the character name- Specified by:
getOutlinein classOutlineFont- Parameters:
name- the name of the desired glyph- Returns:
- the glyph outline, or null if unavailable
-
getOutline
Get the outline of a character given the glyph id -
renderSimpleGlyph
Render a simple glyf -
renderCompoundGlyph
Render a compound glyf -
addOnCurvePoint
add a point on the curve -
addOffCurvePoint
add a point off the curve
-