Package com.adobe.fontengine.font.type1
Class FontFactory
- java.lang.Object
-
- com.adobe.fontengine.font.type1.FontFactory
-
public final class FontFactory extends java.lang.Object
Creates font objects for legacy type1 fonts.Synchronization
This class represents a namespace and does not contain instance data or mutable static data. It is therefore threadsafe.
-
-
Constructor Summary
Constructors Constructor Description FontFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getNumBytesNeededToIdentify()
Returns the number of initial bytes necessary to identify a stream as a type1 fontstatic int
getNumBytesNeededToIdentifyAFM()
Returns the number of initial bytes necessary to identify a stream as an AFMstatic int
getNumBytesNeededToIdentifyPFM()
Returns the number of initial bytes necessary to identify a stream as a PFMstatic boolean
isAFM(byte[] startingBytes)
Determines if startingBytes represents the start of an AFMstatic boolean
isPFM(byte[] startingBytes)
Determines if startingBytes represents the start of a PFMstatic boolean
isType1(byte[] startingBytes)
Determines if startingBytes represents the start of a type1 fontstatic Type1Font[]
load(FontInputStream in, java.net.URL url)
Given an input stream, creates Type1Font objects that represent it.static MetricFile
loadAFM(FontInputStream str, java.net.URL url)
If the stream contains an AFM, it creates an AFM and returns it.static MetricFile
loadPFM(FontInputStream str, java.net.URL url)
If the stream contains an PFM, it creates an PFM object and returns it.
-
-
-
Method Detail
-
getNumBytesNeededToIdentify
public static int getNumBytesNeededToIdentify()
Returns the number of initial bytes necessary to identify a stream as a type1 font
-
isType1
public static boolean isType1(byte[] startingBytes)
Determines if startingBytes represents the start of a type1 font- Parameters:
startingBytes
- The initial file bytes- Returns:
- true iff the bytes appear to be the start of a type1 font
-
getNumBytesNeededToIdentifyAFM
public static int getNumBytesNeededToIdentifyAFM()
Returns the number of initial bytes necessary to identify a stream as an AFM
-
isAFM
public static boolean isAFM(byte[] startingBytes)
Determines if startingBytes represents the start of an AFM- Parameters:
startingBytes
- The initial file bytes- Returns:
- true iff the bytes appear to be the start of a afm
-
getNumBytesNeededToIdentifyPFM
public static int getNumBytesNeededToIdentifyPFM()
Returns the number of initial bytes necessary to identify a stream as a PFM
-
isPFM
public static boolean isPFM(byte[] startingBytes)
Determines if startingBytes represents the start of a PFM- Parameters:
startingBytes
- The initial file bytes- Returns:
- true iff the bytes appear to be the start of a pfm
-
load
public static Type1Font[] load(FontInputStream in, java.net.URL url) throws java.io.IOException, InvalidFontException, UnsupportedFontException
Given an input stream, creates Type1Font objects that represent it. Note that fonts are parsed at this point. Also note that multiple master fonts are not supported by AFE. Calling this function with a multiple master font will cause an exception to be thrown.- Parameters:
in
- The input stream- Returns:
- An array of type1 fonts
- Throws:
java.io.IOException
- Thrown if the stream cannot be readInvalidFontException
- Thrown if the stream does not represent a valid type1 font.UnsupportedFontException
-
loadAFM
public static MetricFile loadAFM(FontInputStream str, java.net.URL url) throws java.io.IOException, InvalidFontException
If the stream contains an AFM, it creates an AFM and returns it. Note that AFMs are parsed at this point- Parameters:
str
- The stream to be probed.- Returns:
- null if str is not an AFM. A valid AFM object otherwise.
- Throws:
java.io.IOException
- Thrown if the stream cannot be readInvalidFontException
- Thrown if the stream does not represent a valid AFM
-
loadPFM
public static MetricFile loadPFM(FontInputStream str, java.net.URL url) throws java.io.IOException, InvalidFontException
If the stream contains an PFM, it creates an PFM object and returns it. Note that PFMs are parsed at this point- Parameters:
str
- The stream to be probed.- Returns:
- null if str is not an PFM. A valid PFM object otherwise.
- Throws:
java.io.IOException
- Thrown if the stream cannot be readInvalidFontException
-
-