Package org.loboevolution.pdfview.font
Class NativeFont
java.lang.Object
org.loboevolution.pdfview.font.PDFFont
org.loboevolution.pdfview.font.OutlineFont
org.loboevolution.pdfview.font.NativeFont
a font object derived from a true type font.
Author Mike Wessler
-
Field Summary
Modifier 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
ConstructorDescriptionNativeFont
(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 GeneralPath
getOutline
(char src, float width) Get a glyph outline by character codeprotected GeneralPath
getOutline
(String name, float width) Get a glyph outline by nameprotected void
setFont
(byte[] fontdata) Set the fontprotected void
Set the fontMethods inherited from class org.loboevolution.pdfview.font.OutlineFont
getCharCount, getDefaultWidth, getGlyph, getWidth
-
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.- Parameters:
baseFont
- aString
object.fontObj
- aPDFObject
object.descriptor
- aPDFFontDescriptor
object.- Throws:
IOException
- if any.
-
-
Method Details
-
getOutline
Get a glyph outline by nameGet a glyph outline by name
- Specified by:
getOutline
in classOutlineFont
- Parameters:
name
- the name of the desired glyphwidth
- a float.- Returns:
- the glyph outline, or null if unavailable
-
getOutline
Get a glyph outline by character codeNote this method must always return an outline
Get a glyph outline by character code
Note this method must always return an outline
- Specified by:
getOutline
in classOutlineFont
- Parameters:
src
- the character code of the desired glyphwidth
- a float.- Returns:
- the glyph outline
-
setFont
Set the font- Parameters:
f
- the font to use
-
setFont
Set the font- Parameters:
fontdata
- the font data as a byte array- Throws:
FontFormatException
- if any.IOException
- if any.
-