Class NativeFont
java.lang.Object
com.sun.pdfview.font.PDFFont
com.sun.pdfview.font.OutlineFont
com.sun.pdfview.font.NativeFont
a font object derived from a true type font.
- Author:
- Mike Wessler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final char[]Control characters to filter out of the underlying fontprotected static final short[]the ids of our favorite CMaps -
Constructor Summary
ConstructorsConstructorDescriptionNativeFont(String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor) create a new NativeFont object based on a description of the font from the PDF file. -
Method Summary
Modifier and TypeMethodDescriptionprotected GeneralPathgetOutline(char src, float width) Get a glyph outline by character code Note this method must always return an outlineprotected GeneralPathgetOutline(String name, float width) Get a glyph outline by nameprotected voidsetFont(byte[] fontdata) Set the fontprotected voidSet the fontMethods 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
-
controlChars
protected static final char[] controlCharsControl characters to filter out of the underlying font -
mapIDs
protected static final short[] mapIDsthe ids of our favorite CMaps
-
-
Constructor Details
-
NativeFont
public NativeFont(String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor) throws IOException create a new NativeFont 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
-
getOutline
Get a glyph outline by name- Specified by:
getOutlinein classOutlineFont- Parameters:
name- the name of the desired glyph- Returns:
- the glyph outline, or null if unavailable
-
getOutline
Get a glyph outline by character code Note this method must always return an outline- Specified by:
getOutlinein classOutlineFont- Parameters:
src- the character code of the desired glyph- Returns:
- the glyph outline
-
setFont
-
setFont
Set the font- Parameters:
fontdata- the font data as a byte array- Throws:
FontFormatExceptionIOException
-