Class PDSimpleFont
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.font.PDFont
-
- com.tom_roush.pdfbox.pdmodel.font.PDSimpleFont
-
- All Implemented Interfaces:
COSObjectable,PDFontLike
- Direct Known Subclasses:
PDTrueTypeFont,PDType1CFont,PDType1Font,PDType3Font
public abstract class PDSimpleFont extends PDFont
A simple font. Simple fonts use a PostScript encoding vector.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddToSubset(int codePoint)Adds the given Unicode point to the subset.EncodinggetEncoding()Returns the Encoding vector.abstract FontBoxFontgetFontBoxFont()Returns the embedded or system font used for rendering.GlyphListgetGlyphList()Returns the Encoding vector.protected Map<String,Integer>getInvertedEncoding()Inverts the font's Encoding.abstract android.graphics.PathgetPath(String name)Returns the path for the character with the given name.protected floatgetStandard14Width(int code)Returns the glyph width from the AFM if this is a Standard 14 font.protected BooleangetSymbolicFlag()Returns the value of the symbolic flag, allowing for the fact that the result may be indeterminate.abstract booleanhasGlyph(String name)Returns true if the font contains the character with the given name.protected BooleanisFontSymbolic()Internal implementation of isSymbolic, allowing for the fact that the result may be indeterminate.booleanisStandard14()Returns true if this font is one of the "Standard 14" fonts and receives special handling.booleanisSymbolic()Returns true the font is a symbolic (that is, it does not use the Adobe Standard Roman character set).booleanisVertical()Returns true if the font uses vertical writing mode.protected voidreadEncoding()Reads the Encoding from the Font dictionary or the embedded or substituted font file.protected abstract EncodingreadEncodingFromFont()Called by readEncoding() if the encoding needs to be extracted from the font file.voidsubset()Replaces this font with a subset containing only the given Unicode characters.StringtoUnicode(int code)Returns the Unicode character sequence which corresponds to the given character code.StringtoUnicode(int code, GlyphList customGlyphList)Returns the Unicode character sequence which corresponds to the given character code.booleanwillBeSubset()Returns true if this font will be subset when embedded.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from class com.tom_roush.pdfbox.pdmodel.font.PDFont
encode, encode, equals, getAverageFontWidth, getBoundingBox, getCOSObject, getDisplacement, getFontDescriptor, getFontMatrix, getHeight, getName, getPositionVector, getSpaceWidth, getStandard14AFM, getStringWidth, getSubType, getType, getWidth, getWidthFromFont, getWidths, hashCode, isDamaged, isEmbedded, readCMap, readCode, setFontDescriptor, toString
-
-
-
-
Method Detail
-
readEncoding
protected void readEncoding() throws IOExceptionReads the Encoding from the Font dictionary or the embedded or substituted font file. Must be called at the end of any subclass constructors.- Throws:
IOException- if the font file could not be read
-
readEncodingFromFont
protected abstract Encoding readEncodingFromFont() throws IOException
Called by readEncoding() if the encoding needs to be extracted from the font file.- Throws:
IOException- if the font file could not be read.
-
getEncoding
public Encoding getEncoding()
Returns the Encoding vector.
-
getGlyphList
public GlyphList getGlyphList()
Returns the Encoding vector.
-
getInvertedEncoding
protected Map<String,Integer> getInvertedEncoding()
Inverts the font's Encoding. Any duplicate (Name -> Code) mappings will be lost.
-
isSymbolic
public final boolean isSymbolic()
Returns true the font is a symbolic (that is, it does not use the Adobe Standard Roman character set).
-
isFontSymbolic
protected Boolean isFontSymbolic()
Internal implementation of isSymbolic, allowing for the fact that the result may be indeterminate.
-
getSymbolicFlag
protected final Boolean getSymbolicFlag()
Returns the value of the symbolic flag, allowing for the fact that the result may be indeterminate.
-
toUnicode
public String toUnicode(int code) throws IOException
Description copied from class:PDFontReturns the Unicode character sequence which corresponds to the given character code.- Overrides:
toUnicodein classPDFont- Parameters:
code- character code- Returns:
- Unicode character(s)
- Throws:
IOException
-
toUnicode
public String toUnicode(int code, GlyphList customGlyphList) throws IOException
Description copied from class:PDFontReturns the Unicode character sequence which corresponds to the given character code.- Overrides:
toUnicodein classPDFont- Parameters:
code- character codecustomGlyphList- a custom glyph list to use instead of the Adobe Glyph List- Returns:
- Unicode character(s)
- Throws:
IOException
-
isVertical
public boolean isVertical()
Description copied from class:PDFontReturns true if the font uses vertical writing mode.- Specified by:
isVerticalin classPDFont
-
getStandard14Width
protected final float getStandard14Width(int code)
Description copied from class:PDFontReturns the glyph width from the AFM if this is a Standard 14 font.- Specified by:
getStandard14Widthin classPDFont- Parameters:
code- character code- Returns:
- width in 1/1000 text space
-
isStandard14
public boolean isStandard14()
Description copied from class:PDFontReturns true if this font is one of the "Standard 14" fonts and receives special handling.- Overrides:
isStandard14in classPDFont
-
getPath
public abstract android.graphics.Path getPath(String name) throws IOException
Returns the path for the character with the given name. For some fonts, GIDs may be used instead of names when calling this method.- Returns:
- glyph path
- Throws:
IOException- if the path could not be read
-
hasGlyph
public abstract boolean hasGlyph(String name) throws IOException
Returns true if the font contains the character with the given name.- Throws:
IOException- if the path could not be read
-
getFontBoxFont
public abstract FontBoxFont getFontBoxFont()
Returns the embedded or system font used for rendering. This is never null.
-
addToSubset
public void addToSubset(int codePoint)
Description copied from class:PDFontAdds the given Unicode point to the subset.- Specified by:
addToSubsetin classPDFont- Parameters:
codePoint- Unicode code point
-
subset
public void subset() throws IOExceptionDescription copied from class:PDFontReplaces this font with a subset containing only the given Unicode characters.- Specified by:
subsetin classPDFont- Throws:
IOException- if the subset could not be written
-
willBeSubset
public boolean willBeSubset()
Description copied from class:PDFontReturns true if this font will be subset when embedded.- Specified by:
willBeSubsetin classPDFont
-
-