Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.font

public abstract Class PDSimpleFont

extends PDFont
Class Inheritance
Known Direct Subclasses
org.apache.pdfbox.pdmodel.font.PDTrueTypeFont, org.apache.pdfbox.pdmodel.font.PDType1CFont, org.apache.pdfbox.pdmodel.font.PDType1Font, org.apache.pdfbox.pdmodel.font.PDType3Font
Imports
java.awt.geom.GeneralPath, java.io.IOException, java.util.HashSet, .Map, .Set, org.apache.commons.logging.Log, .LogFactory, org.apache.fontbox.FontBoxFont, org.apache.pdfbox.cos.COSBase, .COSDictionary, .COSName, org.apache.pdfbox.pdmodel.common.PDRectangle, org.apache.pdfbox.pdmodel.font.Standard14Fonts.FontName, org.apache.pdfbox.pdmodel.font.encoding.DictionaryEncoding, .Encoding, .GlyphList, .MacRomanEncoding, .StandardEncoding, .WinAnsiEncoding, .ZapfDingbatsEncoding

A simple font. Simple fonts use a PostScript encoding vector.
Author
John Hewson

Field Summary

Modifier and TypeField and Description
protected Encoding
protected GlyphList
private Boolean
private static final Log
private final Set<Integer>
Inherited from org.apache.pdfbox.pdmodel.font.PDFont:
DEFAULT_FONT_MATRIXdict

Constructor Summary

AccessConstructor and Description
pack-priv
PDSimpleFont()

Constructor for embedding.

pack-priv
PDSimpleFont(Standard14Fonts.FontName baseFont)

Constructor for Standard 14.

pack-priv
PDSimpleFont(COSDictionary
Font dictionary.
fontDictionary
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
addToSubset(int
Unicode code point
codePoint
)

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.addToSubset.

Adds the given Unicode point to the subset.

private void
public Encoding

Returns:

encoding
getEncoding
()

Returns the Encoding.

public abstract FontBoxFont

Returns:

the embedded or system font used for rendering
getFontBoxFont
()

Returns the embedded or system font used for rendering.

public GlyphList

Returns:

the glyphlist
getGlyphList
()

Returns the glyphlist.

public abstract GeneralPath

Returns:

glyph path of the character with the given name
getPath
(String
glyph name
name
)

Returns the path for the character with the given name.

protected final float
getStandard14Width(int
character code
code
)

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.getStandard14Width.

Returns the glyph width from the AFM if this is a Standard 14 font.

protected final Boolean

Returns:

the value of the isSymbolic flag form the font descriptor
getSymbolicFlag
()

Returns the value of the symbolic flag, allowing for the fact that the result may be indeterminate.

public boolean
hasExplicitWidth(int
character code
code
)

Implements org.apache.pdfbox.pdmodel.font.PDFontLike.hasExplicitWidth.

Returns true if the Font dictionary specifies an explicit width for the given glyph.

public abstract boolean

Returns:

true if the font contains the character with the given name
hasGlyph
(String
glyph name
name
)

Returns true if the font contains the character with the given name.

protected Boolean

Returns:

true if isSymbolic
isFontSymbolic
()

Internal implementation of isSymbolic, allowing for the fact that the result may be indeterminate.

protected boolean
public boolean
isStandard14()

Overrides org.apache.pdfbox.pdmodel.font.PDFont.isStandard14.

Returns true if this font is one of the "Standard 14" fonts and receives special handling.

public final boolean

Returns:

true if the font is a symbolic
isSymbolic
()

Returns true if the font is a symbolic (that is, it does not use the Adobe Standard Roman character set).

public boolean
isVertical()

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.isVertical.

Returns true if the font uses vertical writing mode.

protected void
readEncoding()

Reads the Encoding from the Font dictionary or the embedded or substituted font file.

protected abstract Encoding

Returns:

encoding of the font
readEncodingFromFont
()

Called by readEncoding() if the encoding needs to be extracted from the font file.

public void
subset()

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.subset.

Replaces this font with a subset containing only the given Unicode characters.

public String
toUnicode(int
character code
code
)

Overrides org.apache.pdfbox.pdmodel.font.PDFont.toUnicode.

Returns the Unicode character sequence which corresponds to the given character code.

public String
toUnicode(int
character code
code
,
GlyphList
a custom glyph list to use instead of the Adobe Glyph List
customGlyphList
)

Overrides org.apache.pdfbox.pdmodel.font.PDFont.toUnicode.

Returns the Unicode character sequence which corresponds to the given character code.

public boolean
willBeSubset()

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.willBeSubset.

Returns true if this font will be subset when embedded.

Inherited from org.apache.pdfbox.pdmodel.font.PDFont:
encodeencodeequalsgetAverageFontWidthgetCOSObjectgetDisplacementgetFontDescriptorgetFontMatrixgetPositionVectorgetSpaceWidthgetStandard14AFMgetStringWidthgetSubTypegetToUnicodeCMapgetTypegetWidthgetWidthshashCodereadCMapreadCodesetFontDescriptortoString

Field Detail

encodingback to summary
protected Encoding encoding
glyphListback to summary
protected GlyphList glyphList
isSymbolicback to summary
private Boolean isSymbolic
LOGback to summary
private static final Log LOG

Hides org.apache.pdfbox.pdmodel.font.PDFont.LOG.

noUnicodeback to summary
private final Set<Integer> noUnicode

Constructor Detail

PDSimpleFontback to summary
pack-priv PDSimpleFont()

Constructor for embedding.

PDSimpleFontback to summary
pack-priv PDSimpleFont(Standard14Fonts.FontName baseFont)

Constructor for Standard 14.

PDSimpleFontback to summary
pack-priv PDSimpleFont(COSDictionary fontDictionary)

Constructor.

Parameters
fontDictionary:COSDictionary

Font dictionary.

Method Detail

addToSubsetback to summary
public void addToSubset(int codePoint)

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.addToSubset.

Doc from org.apache.pdfbox.pdmodel.font.PDFont.addToSubset.

Adds the given Unicode point to the subset.

Parameters
codePoint:int

Unicode code point

Annotations
@Override
assignGlyphListback to summary
private void assignGlyphList(Standard14Fonts.FontName fontName)
getEncodingback to summary
public Encoding getEncoding()

Returns the Encoding.

Returns:Encoding

encoding

getFontBoxFontback to summary
public abstract FontBoxFont getFontBoxFont()

Returns the embedded or system font used for rendering. This is never null.

Returns:FontBoxFont

the embedded or system font used for rendering

getGlyphListback to summary
public GlyphList getGlyphList()

Returns the glyphlist.

Returns:GlyphList

the glyphlist

getPathback to summary
public abstract GeneralPath 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. *

Parameters
name:String

glyph name

Returns:GeneralPath

glyph path of the character with the given name

Exceptions
IOException:
if the path could not be read
getStandard14Widthback to summary
protected final float getStandard14Width(int code)

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.getStandard14Width.

Doc from org.apache.pdfbox.pdmodel.font.PDFont.getStandard14Width.

Returns the glyph width from the AFM if this is a Standard 14 font.

Parameters
code:int

character code

Returns:float

width in 1/1000 text space

Annotations
@Override
getSymbolicFlagback to summary
protected final Boolean getSymbolicFlag()

Returns the value of the symbolic flag, allowing for the fact that the result may be indeterminate.

Returns:Boolean

the value of the isSymbolic flag form the font descriptor

hasExplicitWidthback to summary
public boolean hasExplicitWidth(int code) throws IOException

Implements org.apache.pdfbox.pdmodel.font.PDFontLike.hasExplicitWidth.

Doc from org.apache.pdfbox.pdmodel.font.PDFontLike.hasExplicitWidth.

Returns true if the Font dictionary specifies an explicit width for the given glyph. This includes Width, W but not default widths entries.

Parameters
code:int

character code

Returns:boolean

true if the Font dictionary specifies an explicit width for the given glyph

Annotations
@Override
Exceptions
IOException:
if the font could not be read
hasGlyphback to summary
public abstract boolean hasGlyph(String name) throws IOException

Returns true if the font contains the character with the given name.

Parameters
name:String

glyph name

Returns:boolean

true if the font contains the character with the given name

Exceptions
IOException:
if the path could not be read
isFontSymbolicback to summary
protected Boolean isFontSymbolic()

Internal implementation of isSymbolic, allowing for the fact that the result may be indeterminate.

Returns:Boolean

true if isSymbolic

isNonZeroBoundingBoxback to summary
protected boolean isNonZeroBoundingBox(PDRectangle bbox)
isStandard14back to summary
public boolean isStandard14()

Overrides org.apache.pdfbox.pdmodel.font.PDFont.isStandard14.

Doc from org.apache.pdfbox.pdmodel.font.PDFont.isStandard14.

Returns true if this font is one of the "Standard 14" fonts and receives special handling.

Returns:boolean

true if this font is one of the "Standard 14" fonts

Annotations
@Override
isSymbolicback to summary
public final boolean isSymbolic()

Returns true if the font is a symbolic (that is, it does not use the Adobe Standard Roman character set).

Returns:boolean

true if the font is a symbolic

isVerticalback to summary
public boolean isVertical()

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.isVertical.

Doc from org.apache.pdfbox.pdmodel.font.PDFont.isVertical.

Returns true if the font uses vertical writing mode.

Returns:boolean

true if the font uses vertical writing mode

Annotations
@Override
readEncodingback to summary
protected void readEncoding() throws IOException

Reads the Encoding from the Font dictionary or the embedded or substituted font file. Must be called at the end of any subclass constructors.

Exceptions
IOException:
if the font file could not be read
readEncodingFromFontback to summary
protected abstract Encoding readEncodingFromFont() throws IOException

Called by readEncoding() if the encoding needs to be extracted from the font file.

Returns:Encoding

encoding of the font

Exceptions
IOException:
if the font file could not be read.
subsetback to summary
public void subset() throws IOException

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.subset.

Doc from org.apache.pdfbox.pdmodel.font.PDFont.subset.

Replaces this font with a subset containing only the given Unicode characters.

Annotations
@Override
Exceptions
IOException:
if the subset could not be written
toUnicodeback to summary
public String toUnicode(int code)

Overrides org.apache.pdfbox.pdmodel.font.PDFont.toUnicode.

Doc from org.apache.pdfbox.pdmodel.font.PDFont.toUnicode.

Returns the Unicode character sequence which corresponds to the given character code.

Parameters
code:int

character code

Returns:String

Unicode character(s)

Annotations
@Override
toUnicodeback to summary
public String toUnicode(int code, GlyphList customGlyphList)

Overrides org.apache.pdfbox.pdmodel.font.PDFont.toUnicode.

Doc from org.apache.pdfbox.pdmodel.font.PDFont.toUnicode.

Returns the Unicode character sequence which corresponds to the given character code.

Parameters
code:int

character code

customGlyphList:GlyphList

a custom glyph list to use instead of the Adobe Glyph List

Returns:String

Unicode character(s)

Annotations
@Override
willBeSubsetback to summary
public boolean willBeSubset()

Implements abstract org.apache.pdfbox.pdmodel.font.PDFont.willBeSubset.

Doc from org.apache.pdfbox.pdmodel.font.PDFont.willBeSubset.

Returns true if this font will be subset when embedded.

Returns:boolean

true if this font will be subset when embedded

Annotations
@Override