Top Description Fields Constructors Methods
org.apache.fontbox.type1

public final Class Type1Font

extends Object
implements Type1CharStringReader, EncodedFont, FontBoxFont
Class Inheritance
All Implemented Interfaces
org.apache.fontbox.FontBoxFont, org.apache.fontbox.EncodedFont, org.apache.fontbox.type1.Type1CharStringReader
Imports
java.awt.geom.GeneralPath, java.io.IOException, .InputStream, java.util.ArrayList, .Collections, .LinkedHashMap, .List, .Map, java.util.concurrent.ConcurrentHashMap, org.apache.fontbox.FontBoxFont, .EncodedFont, org.apache.fontbox.cff.Type1CharString, .Type1CharStringParser, org.apache.fontbox.encoding.Encoding, org.apache.fontbox.pfb.PfbParser, org.apache.fontbox.util.BoundingBox

Represents an Adobe Type 1 (.pfb) font. Thread safe.
Author
John Hewson

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv float
pack-priv int
pack-priv List<Number>
private final Map<String, Type1CharString>
private Type1CharStringParser
pack-priv final Map<String, byte[]>
pack-priv Encoding
pack-priv List<Number>
pack-priv String
pack-priv List<Number>
pack-priv List<Number>
pack-priv String
pack-priv List<Number>
pack-priv String
pack-priv int
pack-priv boolean
pack-priv String
pack-priv boolean
pack-priv float
pack-priv int
pack-priv String
pack-priv List<Number>
pack-priv int
private final byte[]
private final byte[]
pack-priv List<Number>
pack-priv List<Number>
pack-priv List<Number>
pack-priv List<Number>
pack-priv float
pack-priv final List<byte[]>
pack-priv float
pack-priv float
pack-priv int
pack-priv String
pack-priv String

Constructor Summary

AccessConstructor and Description
pack-priv
Type1Font(byte[] segment1, byte[] segment2)

Constructs a new Type1Font, called by Type1Parser.

Method Summary

Modifier and TypeMethod and Description
public static Type1Font

Returns:

a type1 font
createWithPFB
(InputStream
.pfb input stream, including headers
pfbStream
)

Constructs a new Type1Font object from a .pfb stream.

public static Type1Font

Returns:

a type1 font
createWithPFB
(byte[]
.pfb data, including headers
pfbBytes
)

Constructs a new Type1Font object from a .pfb stream.

public static Type1Font

Returns:

A new Type1Font instance
createWithSegments
(byte[]
The first segment, without header
segment1
,
byte[]
The second segment, without header
segment2
)

Constructs a new Type1Font object from two header-less .pfb segments.

public byte[]

Returns:

the ASCII segment.
getASCIISegment
()

Returns the ASCII segment.

public byte[]

Returns:

the binary segment.
getBinarySegment
()

Returns the binary segment.

public int

Returns:

the blue fuzz
getBlueFuzz
()

Returns the blue fuzz.

public float

Returns:

the blue scale
getBlueScale
()

Returns the blue scale.

public int

Returns:

the blue shift
getBlueShift
()

Returns the blue shift.

public List<Number>

Returns:

the blues values
getBlueValues
()

Returns the blues values.

public Map<String, byte[]>

Returns:

Type 1 char string bytes
getCharStringsDict
()

Returns the /CharStrings dictionary as raw bytes.

public Encoding

Returns:

the encoding or null
getEncoding
()

Implements org.apache.fontbox.EncodedFont.getEncoding.

Returns the Encoding, if present.

public List<Number>

Returns:

the family blues values
getFamilyBlues
()

Returns the family blues values.

public String

Returns:

the family name
getFamilyName
()

Returns the family name.

public List<Number>

Returns:

the other family blues values
getFamilyOtherBlues
()

Returns the other family blues values.

public BoundingBox

Returns:

the font bounding box
getFontBBox
()

Implements org.apache.fontbox.FontBoxFont.getFontBBox.

Returns the font bounding box.

public String

Returns:

the font ID
getFontID
()

Returns the font ID.

public List<Number>

Returns:

the font matrix
getFontMatrix
()

Implements org.apache.fontbox.FontBoxFont.getFontMatrix.

Returns the font matrix.

public String

Returns:

the font name
getFontName
()

Returns the font name.

public int

Returns:

the font type
getFontType
()

Returns the font type.

public String

Returns:

the full name
getFullName
()

Returns the full name.

public float

Returns:

the italic angle
getItalicAngle
()

Returns the italic angle.

public int

Returns:

the language group
getLanguageGroup
()

Returns the language group.

public String
getName()

Implements org.apache.fontbox.FontBoxFont.getName.

The PostScript name of the font.

public String

Returns:

the notice
getNotice
()

Returns the notice.

public List<Number>

Returns:

the other blues values
getOtherBlues
()

Returns the other blues values.

public int

Returns:

the paint type
getPaintType
()

Returns the paint type.

private Type1CharStringParser
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 List<Number>

Returns:

the StdHW value
getStdHW
()

Returns the StdHW value.

public List<Number>

Returns:

the StdVW value
getStdVW
()

Returns the StdVW value.

public List<Number>

Returns:

the StemSnapH value
getStemSnapH
()

Returns the StemSnapH value.

public List<Number>

Returns:

the StemSnapV value
getStemSnapV
()

Returns the StemSnapV value.

public float

Returns:

the stroke width
getStrokeWidth
()

Returns the stroke width.

public List<byte[]>

Returns:

Type 1 char string bytes
getSubrsArray
()

Returns the /Subrs array as raw bytes.

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.

public float

Returns:

the underline position
getUnderlinePosition
()

Returns the underline position

public float

Returns:

the underline thickness
getUnderlineThickness
()

Returns the underline thickness.

public int

Returns:

the unique ID
getUniqueID
()

Returns unique ID.

public String

Returns:

the version
getVersion
()

Returns the version.

public String

Returns:

the weight
getWeight
()

Returns the weight.

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 boolean

Returns:

true if the font has a fixed pitch
isFixedPitch
()

Determines if the font has a fixed pitch.

public boolean

Returns:

true if the font is bold
isForceBold
()

Determines if the font is bold.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

blueFuzzback to summary
pack-priv int blueFuzz
blueScaleback to summary
pack-priv float blueScale
blueShiftback to summary
pack-priv int blueShift
blueValuesback to summary
pack-priv List<Number> blueValues
charStringCacheback to summary
private final Map<String, Type1CharString> charStringCache
charStringParserback to summary
private Type1CharStringParser charStringParser
charstringsback to summary
pack-priv final Map<String, byte[]> charstrings
encodingback to summary
pack-priv Encoding encoding
familyBluesback to summary
pack-priv List<Number> familyBlues
familyNameback to summary
pack-priv String familyName
familyOtherBluesback to summary
pack-priv List<Number> familyOtherBlues
fontBBoxback to summary
pack-priv List<Number> fontBBox
fontIDback to summary
pack-priv String fontID
fontMatrixback to summary
pack-priv List<Number> fontMatrix
fontNameback to summary
pack-priv String fontName
fontTypeback to summary
pack-priv int fontType
forceBoldback to summary
pack-priv boolean forceBold
fullNameback to summary
pack-priv String fullName
isFixedPitchback to summary
pack-priv boolean isFixedPitch
italicAngleback to summary
pack-priv float italicAngle
languageGroupback to summary
pack-priv int languageGroup
noticeback to summary
pack-priv String notice
otherBluesback to summary
pack-priv List<Number> otherBlues
paintTypeback to summary
pack-priv int paintType
segment1back to summary
private final byte[] segment1
segment2back to summary
private final byte[] segment2
stdHWback to summary
pack-priv List<Number> stdHW
stdVWback to summary
pack-priv List<Number> stdVW
stemSnapHback to summary
pack-priv List<Number> stemSnapH
stemSnapVback to summary
pack-priv List<Number> stemSnapV
strokeWidthback to summary
pack-priv float strokeWidth
subrsback to summary
pack-priv final List<byte[]> subrs
underlinePositionback to summary
pack-priv float underlinePosition
underlineThicknessback to summary
pack-priv float underlineThickness
uniqueIDback to summary
pack-priv int uniqueID
versionback to summary
pack-priv String version
weightback to summary
pack-priv String weight

Constructor Detail

Type1Fontback to summary
pack-priv Type1Font(byte[] segment1, byte[] segment2)

Constructs a new Type1Font, called by Type1Parser.

Method Detail

createWithPFBback to summary
public static Type1Font createWithPFB(InputStream pfbStream) throws IOException

Constructs a new Type1Font object from a .pfb stream.

Parameters
pfbStream:InputStream

.pfb input stream, including headers

Returns:Type1Font

a type1 font

Exceptions
IOException:
if something went wrong
createWithPFBback to summary
public static Type1Font createWithPFB(byte[] pfbBytes) throws IOException

Constructs a new Type1Font object from a .pfb stream.

Parameters
pfbBytes:byte[]

.pfb data, including headers

Returns:Type1Font

a type1 font

Exceptions
IOException:
if something went wrong
createWithSegmentsback to summary
public static Type1Font createWithSegments(byte[] segment1, byte[] segment2) throws IOException

Constructs a new Type1Font object from two header-less .pfb segments.

Parameters
segment1:byte[]

The first segment, without header

segment2:byte[]

The second segment, without header

Returns:Type1Font

A new Type1Font instance

Exceptions
IOException:
if something went wrong
getASCIISegmentback to summary
public byte[] getASCIISegment()

Returns the ASCII segment.

Returns:byte[]

the ASCII segment.

getBinarySegmentback to summary
public byte[] getBinarySegment()

Returns the binary segment.

Returns:byte[]

the binary segment.

getBlueFuzzback to summary
public int getBlueFuzz()

Returns the blue fuzz.

Returns:int

the blue fuzz

getBlueScaleback to summary
public float getBlueScale()

Returns the blue scale.

Returns:float

the blue scale

getBlueShiftback to summary
public int getBlueShift()

Returns the blue shift.

Returns:int

the blue shift

getBlueValuesback to summary
public List<Number> getBlueValues()

Returns the blues values.

Returns:List<Number>

the blues values

getCharStringsDictback to summary
public Map<String, byte[]> getCharStringsDict()

Returns the /CharStrings dictionary as raw bytes.

Returns:Map<String, byte[]>

Type 1 char string bytes

getEncodingback to summary
public Encoding getEncoding()

Implements org.apache.fontbox.EncodedFont.getEncoding.

Returns the Encoding, if present.

Returns:Encoding

the encoding or null

Annotations
@Override
getFamilyBluesback to summary
public List<Number> getFamilyBlues()

Returns the family blues values.

Returns:List<Number>

the family blues values

getFamilyNameback to summary
public String getFamilyName()

Returns the family name.

Returns:String

the family name

getFamilyOtherBluesback to summary
public List<Number> getFamilyOtherBlues()

Returns the other family blues values.

Returns:List<Number>

the other family blues values

getFontBBoxback to summary
public BoundingBox getFontBBox() throws IOException

Implements org.apache.fontbox.FontBoxFont.getFontBBox.

Returns the font bounding box.

Returns:BoundingBox

the font bounding box

Annotations
@Override
Exceptions
IOException:
if there are less than 4 numbers
getFontIDback to summary
public String getFontID()

Returns the font ID.

Returns:String

the font ID

getFontMatrixback to summary
public List<Number> getFontMatrix()

Implements org.apache.fontbox.FontBoxFont.getFontMatrix.

Returns the font matrix.

Returns:List<Number>

the font matrix

Annotations
@Override
getFontNameback to summary
public String getFontName()

Returns the font name.

Returns:String

the font name

getFontTypeback to summary
public int getFontType()

Returns the font type.

Returns:int

the font type

getFullNameback to summary
public String getFullName()

Returns the full name.

Returns:String

the full name

getItalicAngleback to summary
public float getItalicAngle()

Returns the italic angle.

Returns:float

the italic angle

getLanguageGroupback to summary
public int getLanguageGroup()

Returns the language group.

Returns:int

the language group

getNameback to summary
public String getName()

Implements org.apache.fontbox.FontBoxFont.getName.

Doc from org.apache.fontbox.FontBoxFont.getName.

The PostScript name of the font.

Returns:String

the postscript of the font or null

Annotations
@Override
getNoticeback to summary
public String getNotice()

Returns the notice.

Returns:String

the notice

getOtherBluesback to summary
public List<Number> getOtherBlues()

Returns the other blues values.

Returns:List<Number>

the other blues values

getPaintTypeback to summary
public int getPaintType()

Returns the paint type.

Returns:int

the paint type

getParserback to summary
private Type1CharStringParser 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
getStdHWback to summary
public List<Number> getStdHW()

Returns the StdHW value.

Returns:List<Number>

the StdHW value

getStdVWback to summary
public List<Number> getStdVW()

Returns the StdVW value.

Returns:List<Number>

the StdVW value

getStemSnapHback to summary
public List<Number> getStemSnapH()

Returns the StemSnapH value.

Returns:List<Number>

the StemSnapH value

getStemSnapVback to summary
public List<Number> getStemSnapV()

Returns the StemSnapV value.

Returns:List<Number>

the StemSnapV value

getStrokeWidthback to summary
public float getStrokeWidth()

Returns the stroke width.

Returns:float

the stroke width

getSubrsArrayback to summary
public List<byte[]> getSubrsArray()

Returns the /Subrs array as raw bytes.

Returns:List<byte[]>

Type 1 char string bytes

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
getUnderlinePositionback to summary
public float getUnderlinePosition()

Returns the underline position

Returns:float

the underline position

getUnderlineThicknessback to summary
public float getUnderlineThickness()

Returns the underline thickness.

Returns:float

the underline thickness

getUniqueIDback to summary
public int getUniqueID()

Returns unique ID.

Returns:int

the unique ID

getVersionback to summary
public String getVersion()

Returns the version.

Returns:String

the version

getWeightback to summary
public String getWeight()

Returns the weight.

Returns:String

the weight

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
isFixedPitchback to summary
public boolean isFixedPitch()

Determines if the font has a fixed pitch.

Returns:boolean

true if the font has a fixed pitch

isForceBoldback to summary
public boolean isForceBold()

Determines if the font is bold.

Returns:boolean

true if the font is bold

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override