Package com.sun.pdfview.font
Class TTFFont
- java.lang.Object
-
- com.sun.pdfview.font.PDFFont
-
- com.sun.pdfview.font.OutlineFont
-
- com.sun.pdfview.font.TTFFont
-
- Direct Known Subclasses:
CIDFontType2
public class TTFFont extends OutlineFont
A true-type font
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classTTFFont.PointReca point on the stack of points(package private) classTTFFont.RenderState
-
Field Summary
Fields Modifier and Type Field Description private TrueTypeFontfontthe truetype font itselfprivate floatunitsPerEmthe number of units per em in the font
-
Constructor Summary
Constructors Constructor Description TTFFont(java.lang.String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor)create a new TrueTypeFont object based on a description of the font from the PDF file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddOffCurvePoint(TTFFont.PointRec rec, TTFFont.RenderState rs)add a point off the curveprivate voidaddOnCurvePoint(TTFFont.PointRec rec, TTFFont.RenderState rs)add a point on the curveprotected java.awt.geom.GeneralPathgetOutline(char src, float width)Get the outline of a character given the character codeprotected java.awt.geom.GeneralPathgetOutline(int glyphId, float width)Get the outline of a character given the glyph idprotected java.awt.geom.GeneralPathgetOutline(java.lang.String name, float width)Get the outline of a character given the character nameprotected java.awt.geom.GeneralPathgetOutlineFromCMaps(char val, float width)lookup the outline using the CMAPs, as specified in 32000-1:2008, 9.6.6.4, when an Encoding is specified.protected java.awt.geom.GeneralPathrenderCompoundGlyph(GlyfTable glyf, GlyfCompound g)Render a compound glyfprotected java.awt.geom.GeneralPathrenderSimpleGlyph(GlyfSimple g)Render a simple glyf-
Methods inherited from class com.sun.pdfview.font.OutlineFont
getCharCount, getDefaultWidth, getFirstChar, getGlyph, getLastChar, getWidth
-
Methods inherited from class com.sun.pdfview.font.PDFFont
equals, getBaseFont, getCachedGlyph, getDescriptor, getEncoding, getFont, getGlyphs, getSubtype, getUnicodeMap, hashCode, setBaseFont, setDescriptor, setEncoding, setSubtype, setUnicodeMap, toString
-
-
-
-
Field Detail
-
font
private TrueTypeFont font
the truetype font itself
-
unitsPerEm
private float unitsPerEm
the number of units per em in the font
-
-
Constructor Detail
-
TTFFont
public TTFFont(java.lang.String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor) throws java.io.IOExceptioncreate 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:
java.io.IOException
-
-
Method Detail
-
getOutline
protected java.awt.geom.GeneralPath getOutline(char src, float width)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
-
getOutlineFromCMaps
protected java.awt.geom.GeneralPath getOutlineFromCMaps(char val, float width)lookup the outline using the CMAPs, as specified in 32000-1:2008, 9.6.6.4, when an Encoding is specified.- Parameters:
val-width-- Returns:
- GeneralPath
-
getOutline
protected java.awt.geom.GeneralPath getOutline(java.lang.String name, float width)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
protected java.awt.geom.GeneralPath getOutline(int glyphId, float width)Get the outline of a character given the glyph id
-
renderSimpleGlyph
protected java.awt.geom.GeneralPath renderSimpleGlyph(GlyfSimple g)
Render a simple glyf
-
renderCompoundGlyph
protected java.awt.geom.GeneralPath renderCompoundGlyph(GlyfTable glyf, GlyfCompound g)
Render a compound glyf
-
addOnCurvePoint
private void addOnCurvePoint(TTFFont.PointRec rec, TTFFont.RenderState rs)
add a point on the curve
-
addOffCurvePoint
private void addOffCurvePoint(TTFFont.PointRec rec, TTFFont.RenderState rs)
add a point off the curve
-
-