Top Description Inners Fields Constructors Methods
org.apache.fontbox.cff

public Class CFFType1Font

extends CFFFont
implements EncodedFont
Class Inheritance
All Implemented Interfaces
org.apache.fontbox.EncodedFont
Imports
java.awt.geom.GeneralPath, java.io.IOException, java.util.LinkedHashMap, .List, .Map, java.util.concurrent.ConcurrentHashMap, org.apache.fontbox.EncodedFont, org.apache.fontbox.type1.Type1CharStringReader

A Type 1-equivalent font program represented in a CFF file. Thread safe.
Authors
Villu Ruusmann, John Hewson

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
CFFType1Font.PrivateType1CharStringReader

Private implementation of Type1CharStringReader, because only CFFType1Font can expose this publicly, as CIDFonts only support this for legacy 'seac' commands.

Field Summary

Modifier and TypeField and Description
private final Map<Integer, Type2CharString>
private Type2CharStringParser
private int
private CFFEncoding
private byte[][]
private int
private final Map<String, Object>
private final CFFType1Font.PrivateType1CharStringReader
Inherited from org.apache.fontbox.cff.CFFFont:
charStringsglobalSubrIndextopDict

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addToPrivateDict(String
the given key
name
,
Object
the given value
value
)

Adds the given key/value pair to the private dictionary.

private int
public CFFEncoding

Returns:

the encoding
getEncoding
()

Implements org.apache.fontbox.EncodedFont.getEncoding.

Returns the CFFEncoding of the font.

private byte[][]
private int
private Type2CharStringParser
public GeneralPath
getPath(String
PostScript glyph name
name
)

Implements org.apache.fontbox.FontBoxFont.getPath.

Returns the path for the character with the given name.

public Map<String, Object>

Returns:

the dictionary
getPrivateDict
()

Returns the private dictionary.

private Object
public Type1CharString

Returns:

Type1 charstring of the given PostScript glyph name
getType1CharString
(String
PostScript glyph name
name
)

Returns the Type 1 charstring for the given PostScript glyph name.

public Type2CharString
getType2CharString(int
GID
gid
)

Implements abstract org.apache.fontbox.cff.CFFFont.getType2CharString.

Returns the Type 1 charstring for the given GID.

private Type2CharString
getType2CharString(int gid, String name)

public float
getWidth(String
PostScript glyph name
name
)

Implements org.apache.fontbox.FontBoxFont.getWidth.

Returns the advance width for the character with the given name.

public boolean
hasGlyph(String
PostScript glyph name
name
)

Implements org.apache.fontbox.FontBoxFont.hasGlyph.

Returns true if the font contains the given glyph.

public int

Returns:

GID
nameToGID
(String
a PostScript glyph name.
name
)

Returns the GID for the given PostScript glyph name.

pack-priv void
setEncoding(CFFEncoding
the given CFFEncoding
encoding
)

Sets the CFFEncoding of the font.

Inherited from org.apache.fontbox.cff.CFFFont:
addValueToTopDictgetCharsetgetCharStringBytesgetDatagetFontBBoxgetFontMatrixgetGlobalSubrIndexgetNamegetNumCharStringsgetTopDictsetCharsetsetDatasetGlobalSubrIndexsetNametoString

Field Detail

charStringCacheback to summary
private final Map<Integer, Type2CharString> charStringCache
charStringParserback to summary
private Type2CharStringParser charStringParser
defaultWidthXback to summary
private int defaultWidthX
encodingback to summary
private CFFEncoding encoding
localSubrIndexback to summary
private byte[][] localSubrIndex
nominalWidthXback to summary
private int nominalWidthX
privateDictback to summary
private final Map<String, Object> privateDict
readerback to summary
private final CFFType1Font.PrivateType1CharStringReader reader

Constructor Detail

CFFType1Fontback to summary
public CFFType1Font()

Method Detail

addToPrivateDictback to summary
pack-priv void addToPrivateDict(String name, Object value)

Adds the given key/value pair to the private dictionary.

Parameters
name:String

the given key

value:Object

the given value

getDefaultWidthXback to summary
private int getDefaultWidthX()
getEncodingback to summary
public CFFEncoding getEncoding()

Implements org.apache.fontbox.EncodedFont.getEncoding.

Returns the CFFEncoding of the font.

Returns:CFFEncoding

the encoding

Annotations
@Override
getLocalSubrIndexback to summary
private byte[][] getLocalSubrIndex()
getNominalWidthXback to summary
private int getNominalWidthX()
getParserback to summary
private Type2CharStringParser getParser()
getPathback to summary
public GeneralPath getPath(String name) throws IOException

Implements org.apache.fontbox.FontBoxFont.getPath.

Doc from org.apache.fontbox.FontBoxFont.getPath.

Returns the path for the character with the given name.

Parameters
name:String

PostScript glyph name

Returns:GeneralPath

glyph path

Annotations
@Override
Exceptions
IOException:
if the path could not be read
getPrivateDictback to summary
public Map<String, Object> getPrivateDict()

Returns the private dictionary.

Returns:Map<String, Object>

the dictionary

getPropertyback to summary
private Object getProperty(String name)
getType1CharStringback to summary
public Type1CharString getType1CharString(String name) throws IOException

Returns the Type 1 charstring for the given PostScript glyph name.

Parameters
name:String

PostScript glyph name

Returns:Type1CharString

Type1 charstring of the given PostScript glyph name

Exceptions
IOException:
if the charstring could not be read
getType2CharStringback to summary
public Type2CharString getType2CharString(int gid) throws IOException

Implements abstract org.apache.fontbox.cff.CFFFont.getType2CharString.

Returns the Type 1 charstring for the given GID.

Parameters
gid:int

GID

Returns:Type2CharString

Doc from org.apache.fontbox.cff.CFFFont.getType2CharString.

the Type2 charstring of the given cid/gid

Annotations
@Override
Exceptions
IOException:
if the charstring could not be read
getType2CharStringback to summary
private Type2CharString getType2CharString(int gid, String name) throws IOException
getWidthback to summary
public float getWidth(String name) throws IOException

Implements org.apache.fontbox.FontBoxFont.getWidth.

Doc from org.apache.fontbox.FontBoxFont.getWidth.

Returns the advance width for the character with the given name.

Parameters
name:String

PostScript glyph name

Returns:float

glyph advance width

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

Implements org.apache.fontbox.FontBoxFont.hasGlyph.

Doc from org.apache.fontbox.FontBoxFont.hasGlyph.

Returns true if the font contains the given glyph.

Parameters
name:String

PostScript glyph name

Returns:boolean

true if the font contains a glyph with the given name, otherwise false

Annotations
@Override
nameToGIDback to summary
public int nameToGID(String name)

Returns the GID for the given PostScript glyph name.

Parameters
name:String

a PostScript glyph name.

Returns:int

GID

setEncodingback to summary
pack-priv void setEncoding(CFFEncoding encoding)

Sets the CFFEncoding of the font.

Parameters
encoding:CFFEncoding

the given CFFEncoding

org.apache.fontbox.cff back to summary

private Class CFFType1Font.PrivateType1CharStringReader

extends Object
implements Type1CharStringReader
Class Inheritance
  • java.lang.Object
  • org.apache.fontbox.cff.CFFType1Font.PrivateType1CharStringReader
All Implemented Interfaces
org.apache.fontbox.type1.Type1CharStringReader

Private implementation of Type1CharStringReader, because only CFFType1Font can expose this publicly, as CIDFonts only support this for legacy 'seac' commands.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Type1CharString
getType1CharString(String
the character name of the Type1 charstring
name
)

Implements org.apache.fontbox.type1.Type1CharStringReader.getType1CharString.

Returns the Type 1 CharString for the character with the given name.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PrivateType1CharStringReaderback to summary
private PrivateType1CharStringReader()

Method Detail

getType1CharStringback to summary
public Type1CharString getType1CharString(String name) throws IOException

Implements org.apache.fontbox.type1.Type1CharStringReader.getType1CharString.

Doc from org.apache.fontbox.type1.Type1CharStringReader.getType1CharString.

Returns the Type 1 CharString for the character with the given name.

Parameters
name:String

the character name of the Type1 charstring

Returns:Type1CharString

Type 1 CharString

Annotations
@Override
Exceptions
IOException:
if something went wrong