org.apache.fontbox.type1

## Class Type1Font

- java.lang.Object
- - org.apache.fontbox.type1.Type1Font

All Implemented Interfaces:
  EncodedFont, FontBoxFont, Type1CharStringReader

    public final class Type1Font
    extends Object
    implements Type1CharStringReader, EncodedFont, FontBoxFont

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

Author:
  John Hewson

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static Type1Font` `createWithPFB(byte[] pfbBytes)` Constructs a new Type1Font object from a .pfb stream.
`static Type1Font` `createWithPFB(InputStream pfbStream)` Constructs a new Type1Font object from a .pfb stream.
`static Type1Font` `createWithSegments(byte[] segment1, byte[] segment2)` Constructs a new Type1Font object from two header-less .pfb segments.
`byte[]` `getASCIISegment()` Returns the ASCII segment.
`byte[]` `getBinarySegment()` Returns the binary segment.
`int` `getBlueFuzz()` Returns the blue fuzz.
`float` `getBlueScale()` Returns the blue scale.
`int` `getBlueShift()` Returns the blue shift.
`List<Number>` `getBlueValues()` Returns the blues values.
`Map<String,byte[]>` `getCharStringsDict()` Returns the /CharStrings dictionary as raw bytes.
`Encoding` `getEncoding()` Returns the Encoding, if present.
`List<Number>` `getFamilyBlues()` Returns the family blues values.
`String` `getFamilyName()` Returns the family name.
`List<Number>` `getFamilyOtherBlues()` Returns the other family blues values.
`BoundingBox` `getFontBBox()` Returns the font bounding box.
`String` `getFontID()` Returns the font ID.
`List<Number>` `getFontMatrix()` Returns the font matrix.
`String` `getFontName()` Returns the font name.
`int` `getFontType()` Returns the font type.
`String` `getFullName()` Returns the full name.
`float` `getItalicAngle()` Returns the italic angle.
`int` `getLanguageGroup()` Returns the language group.
`String` `getName()` The PostScript name of the font.
`String` `getNotice()` Returns the notice.
`List<Number>` `getOtherBlues()` Returns the other blues values.
`int` `getPaintType()` Returns the paint type.
`GeneralPath` `getPath(String name)` Returns the path for the character with the given name.
`List<Number>` `getStdHW()` Returns the StdHW value.
`List<Number>` `getStdVW()` Returns the StdVW value.
`List<Number>` `getStemSnapH()` Returns the StemSnapH value.
`List<Number>` `getStemSnapV()` Returns the StemSnapV value.
`float` `getStrokeWidth()` Returns the stroke width.
`List<byte[]>` `getSubrsArray()` Returns the /Subrs array as raw bytes.
`Type1CharString` `getType1CharString(String name)` Returns the Type 1 CharString for the character with the given name.
`float` `getUnderlinePosition()` Returns the underline position
`float` `getUnderlineThickness()` Returns the underline thickness.
`int` `getUniqueID()` Returns unique ID.
`String` `getVersion()` Returns the version.
`String` `getWeight()` Returns the weight.
`float` `getWidth(String name)` Returns the advance width for the character with the given name.
`boolean` `hasGlyph(String name)` Returns true if the font contains the given glyph.
`boolean` `isFixedPitch()` Determines if the font has a fixed pitch.
`boolean` `isForceBold()` Determines if the font is bold.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Method Detail

#### createWithPFB

    public static Type1Font createWithPFB(InputStream pfbStream)
                                   throws IOException

Constructs a new Type1Font object from a .pfb stream.

Parameters:
  `pfbStream` - .pfb input stream, including headers
Returns:
  a type1 font
Throws:
  `IOException` - if something went wrong

#### createWithPFB

    public static Type1Font createWithPFB(byte[] pfbBytes)
                                   throws IOException

Constructs a new Type1Font object from a .pfb stream.

Parameters:
  `pfbBytes` - .pfb data, including headers
Returns:
  a type1 font
Throws:
  `IOException` - if something went wrong

#### createWithSegments

    public static Type1Font createWithSegments(byte[] segment1,
                                               byte[] segment2)
                                        throws IOException

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

Parameters:
  `segment1` - The first segment, without header
  `segment2` - The second segment, without header
Returns:
  A new Type1Font instance
Throws:
  `IOException` - if something went wrong

#### getSubrsArray

    public List<byte[]> getSubrsArray()

Returns the /Subrs array as raw bytes.

Returns:
  Type 1 char string bytes

#### getCharStringsDict

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

Returns the /CharStrings dictionary as raw bytes.

Returns:
  Type 1 char string bytes

#### getName

    public String getName()

Description copied from interface: `FontBoxFont`
The PostScript name of the font.

Specified by:
  `getName` in interface `FontBoxFont`
Returns:
  the postscript of the font or null

#### getPath

    public GeneralPath getPath(String name)
                        throws IOException

Description copied from interface: `FontBoxFont`
Returns the path for the character with the given name.

Specified by:
  `getPath` in interface `FontBoxFont`
Parameters:
  `name` - PostScript glyph name
Returns:
  glyph path
Throws:
  `IOException` - if the path could not be read

#### getWidth

    public float getWidth(String name)
                   throws IOException

Description copied from interface: `FontBoxFont`
Returns the advance width for the character with the given name.

Specified by:
  `getWidth` in interface `FontBoxFont`
Parameters:
  `name` - PostScript glyph name
Returns:
  glyph advance width
Throws:
  `IOException` - if the path could not be read

#### hasGlyph

    public boolean hasGlyph(String name)

Description copied from interface: `FontBoxFont`
Returns true if the font contains the given glyph.

Specified by:
  `hasGlyph` in interface `FontBoxFont`
Parameters:
  `name` - PostScript glyph name
Returns:
  true if the font contains a glyph with the given name, otherwise false

#### getType1CharString

    public Type1CharString getType1CharString(String name)
                                       throws IOException

Description copied from interface: `Type1CharStringReader`
Returns the Type 1 CharString for the character with the given name.

Specified by:
  `getType1CharString` in interface `Type1CharStringReader`
Parameters:
  `name` - the character name of the Type1 charstring
Returns:
  Type 1 CharString
Throws:
  `IOException` - if something went wrong

#### getFontName

    public String getFontName()

Returns the font name.

Returns:
  the font name

#### getEncoding

    public Encoding getEncoding()

Returns the Encoding, if present.

Specified by:
  `getEncoding` in interface `EncodedFont`
Returns:
  the encoding or null

#### getPaintType

    public int getPaintType()

Returns the paint type.

Returns:
  the paint type

#### getFontType

    public int getFontType()

Returns the font type.

Returns:
  the font type

#### getFontMatrix

    public List<Number> getFontMatrix()

Returns the font matrix.

Specified by:
  `getFontMatrix` in interface `FontBoxFont`
Returns:
  the font matrix

#### getFontBBox

    public BoundingBox getFontBBox()
                            throws IOException

Returns the font bounding box.

Specified by:
  `getFontBBox` in interface `FontBoxFont`
Returns:
  the font bounding box
Throws:
  `IOException` - if there are less than 4 numbers

#### getUniqueID

    public int getUniqueID()

Returns unique ID.

Returns:
  the unique ID

#### getStrokeWidth

    public float getStrokeWidth()

Returns the stroke width.

Returns:
  the stroke width

#### getFontID

    public String getFontID()

Returns the font ID.

Returns:
  the font ID

#### getVersion

    public String getVersion()

Returns the version.

Returns:
  the version

#### getNotice

    public String getNotice()

Returns the notice.

Returns:
  the notice

#### getFullName

    public String getFullName()

Returns the full name.

Returns:
  the full name

#### getFamilyName

    public String getFamilyName()

Returns the family name.

Returns:
  the family name

#### getWeight

    public String getWeight()

Returns the weight.

Returns:
  the weight

#### getItalicAngle

    public float getItalicAngle()

Returns the italic angle.

Returns:
  the italic angle

#### isFixedPitch

    public boolean isFixedPitch()

Determines if the font has a fixed pitch.

Returns:
  true if the font has a fixed pitch

#### getUnderlinePosition

    public float getUnderlinePosition()

Returns the underline position

Returns:
  the underline position

#### getUnderlineThickness

    public float getUnderlineThickness()

Returns the underline thickness.

Returns:
  the underline thickness

#### getBlueValues

    public List<Number> getBlueValues()

Returns the blues values.

Returns:
  the blues values

#### getOtherBlues

    public List<Number> getOtherBlues()

Returns the other blues values.

Returns:
  the other blues values

#### getFamilyBlues

    public List<Number> getFamilyBlues()

Returns the family blues values.

Returns:
  the family blues values

#### getFamilyOtherBlues

    public List<Number> getFamilyOtherBlues()

Returns the other family blues values.

Returns:
  the other family blues values

#### getBlueScale

    public float getBlueScale()

Returns the blue scale.

Returns:
  the blue scale

#### getBlueShift

    public int getBlueShift()

Returns the blue shift.

Returns:
  the blue shift

#### getBlueFuzz

    public int getBlueFuzz()

Returns the blue fuzz.

Returns:
  the blue fuzz

#### getStdHW

    public List<Number> getStdHW()

Returns the StdHW value.

Returns:
  the StdHW value

#### getStdVW

    public List<Number> getStdVW()

Returns the StdVW value.

Returns:
  the StdVW value

#### getStemSnapH

    public List<Number> getStemSnapH()

Returns the StemSnapH value.

Returns:
  the StemSnapH value

#### getStemSnapV

    public List<Number> getStemSnapV()

Returns the StemSnapV value.

Returns:
  the StemSnapV value

#### isForceBold

    public boolean isForceBold()

Determines if the font is bold.

Returns:
  true if the font is bold

#### getLanguageGroup

    public int getLanguageGroup()

Returns the language group.

Returns:
  the language group

#### getASCIISegment

    public byte[] getASCIISegment()

Returns the ASCII segment.

Returns:
  the ASCII segment.

#### getBinarySegment

    public byte[] getBinarySegment()

Returns the binary segment.

Returns:
  the binary segment.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`