java.lang.Object
org.sejda.sambox.pdmodel.font.PDFont
org.sejda.sambox.pdmodel.font.PDSimpleFont
- All Implemented Interfaces:
COSObjectable,PDFontLike,Subsettable
- Direct Known Subclasses:
PDTrueTypeFont,PDType1CFont,PDType1Font,PDType3Font
A simple font. Simple fonts use a PostScript encoding vector.
- Author:
- John Hewson
-
Field Summary
FieldsFields inherited from class org.sejda.sambox.pdmodel.font.PDFont
DEFAULT_FONT_MATRIX, dict -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToSubset(int codePoint) Adds the given Unicode point to the subset.Returns the Encoding vector.abstract org.apache.fontbox.FontBoxFontReturns the embedded or system font used for rendering.Returns the Encoding vector.abstract GeneralPathReturns the path for the character with the given name.protected final floatgetStandard14Width(int code) Returns the glyph width from the AFM if this is a Standard 14 font.protected final BooleanReturns the value of the symbolic flag, allowing for the fact that the result may be indeterminate.booleanhasExplicitWidth(int code) Returns true if the Font dictionary specifies an explicit width for the given glyph.abstract booleanReturns true if the font contains the character with the given name.protected BooleanInternal implementation of isSymbolic, allowing for the fact that the result may be indeterminate.booleanReturns true if this font is one of the "Standard 14" fonts and receives special handling.final booleanReturns true the font is a symbolic (that is, it does not use the Adobe Standard Roman character set).booleanReturns true if the font uses vertical writing mode.protected voidReads the Encoding from the Font dictionary or the embedded or substituted font file.protected abstract EncodingCalled 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.toUnicode(int code) Returns the Unicode character sequence which corresponds to the given character code.Returns the Unicode character sequence which corresponds to the given character code.booleanMethods inherited from class org.sejda.sambox.pdmodel.font.PDFont
encode, encode, encodeLeniently, equals, getAverageFontWidth, getCOSObject, getDisplacement, getFontDescriptor, getFontMatrix, getPositionVector, getSpaceWidth, getStandard14AFM, getStringWidth, getStringWidthLeniently, getSubType, getToUnicodeCMap, getTransientMetadata, getType, getWidth, getWidths, hashCode, readCMap, readCode, setFontDescriptor, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.sejda.sambox.pdmodel.font.PDFontLike
getBoundingBox, getHeight, getName, getWidthFromFont, isDamaged, isEmbedded, isMappingFallbackUsed, isOriginalEmbeddedMissing
-
Field Details
-
encoding
-
glyphList
-
-
Method Details
-
readEncoding
Reads 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
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
Returns the Encoding vector. -
getGlyphList
Returns the Encoding vector. -
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
Internal implementation of isSymbolic, allowing for the fact that the result may be indeterminate. -
getSymbolicFlag
Returns the value of the symbolic flag, allowing for the fact that the result may be indeterminate. -
toUnicode
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
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
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
Returns true if the font contains the character with the given name.- Throws:
IOException- if the path could not be read
-
getFontBoxFont
public abstract org.apache.fontbox.FontBoxFont getFontBoxFont()Returns the embedded or system font used for rendering. This is never null. -
addToSubset
public void addToSubset(int codePoint) Description copied from interface:SubsettableAdds the given Unicode point to the subset.- Parameters:
codePoint- Unicode code point
-
subset
Description copied from interface:SubsettableReplaces this font with a subset containing only the given Unicode characters.- Throws:
IOException- if the subset could not be written
-
willBeSubset
public boolean willBeSubset()- Returns:
- true if this font will be subset when embedded.
-
hasExplicitWidth
Description copied from interface:PDFontLikeReturns true if the Font dictionary specifies an explicit width for the given glyph. This includes Width, W but not default widths entries.- Parameters:
code- character code- Throws:
IOException- if the font could not be read
-