Package org.loboevolution.pdfview.font
Class OutlineFont
java.lang.Object
org.loboevolution.pdfview.font.PDFFont
org.loboevolution.pdfview.font.OutlineFont
- Direct Known Subclasses:
NativeFont,TTFFont,Type1CFont,Type1Font
Supports width operations for Type1, Type1C, TrueType and Type3 fonts
-
Constructor Summary
ConstructorsConstructorDescriptionOutlineFont(String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor) Creates a new instance of OutlineFont -
Method Summary
Modifier and TypeMethodDescriptionintGet the number of charactersintGet the default width in text spaceprotected PDFGlyphGet the glyph for a given character code and nameprotected abstract GeneralPathgetOutline(char src, float width) Get a glyph outline by character codeprotected abstract GeneralPathgetOutline(String name, float width) Get a glyph outline by namefloatGet the width of a given character
-
Constructor Details
-
OutlineFont
public OutlineFont(String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor) throws IOException Creates a new instance of OutlineFont- Parameters:
baseFont- aStringobject.fontObj- aPDFObjectobject.descriptor- aPDFFontDescriptorobject.- Throws:
IOException- if any.
-
-
Method Details
-
getDefaultWidth
public int getDefaultWidth()Get the default width in text space- Returns:
- a
Integerobject.
-
getCharCount
public int getCharCount()Get the number of characters- Returns:
- a
Integerobject.
-
getWidth
Get the width of a given character- Parameters:
code- a char.name- aStringobject.- Returns:
- a float.
-
getGlyph
Get the glyph for a given character code and nameThe preferred method of getting the glyph should be by name. If the name is null or not valid, then the character code should be used. If the both the code and the name are invalid, the undefined glyph should be returned.
Note this method must *always* return a glyph.
Get the glyph for a given character code and name
The preferred method of getting the glyph should be by name. If the name is null or not valid, then the character code should be used. If the both the code and the name are invalid, the undefined glyph should be returned.
Note this method must *always* return a glyph.
-
getOutline
Get a glyph outline by name- 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
- Parameters:
src- the character code of the desired glyphwidth- a float.- Returns:
- the glyph outline
-