Package com.adobe.fontengine.font
Class PDFFontDescription
- java.lang.Object
-
- com.adobe.fontengine.font.PDFFontDescription
-
- Direct Known Subclasses:
XDCFontDescription
public abstract class PDFFontDescription extends java.lang.Object
A helper class useful for building pdf font objects.Metrics
Metrics returned by this class are expressed in 1/1000th of em.
Synchronization
This class is immutable after contruction and contains no mutable static data. It is therefore threadsafe.
-
-
Constructor Summary
Constructors Constructor Description PDFFontDescription()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract double
getAdvance(int glyphID)
Fetch the horizontal advance width for the specified glyph.abstract java.lang.String
getBase14Name()
abstract double
getCapHeight()
Fetch the height above the baseline of capital lettersabstract int
getCIDCount()
Get the CID count associated with the CIDKeyedFontabstract Rect
getFontBBox()
Fetch the font bounding box.abstract java.lang.String
getFontFamily()
Fetches the preferred family name associated with this font.abstract int
getGlyphCid(int glyphID)
Fetch the CID for a given glyph.abstract java.lang.String
getGlyphName(int gid)
abstract double
getItalicAngle()
Fetch the italic angle.abstract int
getNumGlyphs()
The number of glyphs in the font.abstract java.lang.String
getPostscriptName()
Fetches the preferred postscript name for the font.abstract ROS
getROS()
Get the Registry, Ordering and Supplement associated with the font.abstract double
getStemV()
Fetch the font's primary vertical stem widthabstract double
getXHeight()
Fetch the height above the baseline for lowercase letters.abstract boolean
isAllCapFont()
abstract boolean
isSerifFont()
abstract boolean
isSmallCapFont()
abstract boolean
pdfFontIsTrueType()
abstract void
stream(java.io.OutputStream out, boolean openTypeFontsAllowed)
Streams a font suitable for embedding in a PDF for editting situations.abstract void
subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS)
abstract void
subsetAndStream(SubsetSimpleTrueType subset, java.io.OutputStream out)
abstract void
subsetAndStream(SubsetSimpleType1 subset, java.io.OutputStream out)
-
-
-
Method Detail
-
getPostscriptName
public abstract java.lang.String getPostscriptName() throws InvalidFontException, UnsupportedFontException
Fetches the preferred postscript name for the font. The Postscript name is not required, in which case this returns null.
-
getFontFamily
public abstract java.lang.String getFontFamily() throws InvalidFontException, UnsupportedFontException
Fetches the preferred family name associated with this font. The family name is not required, in which case this returns null.
-
getStemV
public abstract double getStemV() throws UnsupportedFontException, InvalidFontException
Fetch the font's primary vertical stem width- Returns:
- the stemv scaled to 1000 ppem.
- Throws:
UnsupportedFontException
InvalidFontException
-
getFontBBox
public abstract Rect getFontBBox() throws InvalidFontException, UnsupportedFontException
Fetch the font bounding box. The font bbox is not required in fonts, in which case this returns null.- Returns:
- the fontbbox scaled to 1000 ppem.
- Throws:
InvalidFontException
UnsupportedFontException
-
getCapHeight
public abstract double getCapHeight() throws UnsupportedFontException, InvalidFontException
Fetch the height above the baseline of capital letters- Returns:
- the capHeight scaled to 1000 ppem.
- Throws:
UnsupportedFontException
InvalidFontException
-
getXHeight
public abstract double getXHeight() throws UnsupportedFontException, InvalidFontException
Fetch the height above the baseline for lowercase letters.- Returns:
- the xHeight scaled to 1000 ppem.
- Throws:
UnsupportedFontException
InvalidFontException
-
getItalicAngle
public abstract double getItalicAngle() throws InvalidFontException, UnsupportedFontException
Fetch the italic angle. This is the angle of the primary vertical strokes in the font given in degrees counter clockwise from vertical (e.g. most non-italic fonts will have 0 for their italic angle; italic fonts will often have italic angles around -15).
-
getNumGlyphs
public abstract int getNumGlyphs() throws InvalidFontException, UnsupportedFontException
The number of glyphs in the font.
-
getAdvance
public abstract double getAdvance(int glyphID) throws InvalidFontException, UnsupportedFontException
Fetch the horizontal advance width for the specified glyph.- Parameters:
glyphID
- the glyph to be fetched- Returns:
- the advance width scaled to 1000 ppem.
- Throws:
InvalidGlyphException
- thrown when the glyph contains data that cannot be interpretted and cannot be ignoredUnsupportedFontException
- thrown when the font contains data that indicates that AFE does not support that class of fonts.InvalidFontException
-
getROS
public abstract ROS getROS() throws UnsupportedFontException, InvalidFontException
Get the Registry, Ordering and Supplement associated with the font. If the font does not have a ROS, return null. The ROS is described in technote 5014: "Adobe CMap and CIDFont Files Specification" found at http://partners.adobe.com/public/developer/en/font/5014.CIDFont_Spec.pdf
-
getCIDCount
public abstract int getCIDCount() throws UnsupportedFontException, InvalidFontException
Get the CID count associated with the CIDKeyedFont
-
getGlyphCid
public abstract int getGlyphCid(int glyphID) throws UnsupportedFontException, InvalidFontException
Fetch the CID for a given glyph. This function must only be called if getROS returns a non-null ROS.- Parameters:
glyphID
-- Returns:
- the CID associated with glyphID
- Throws:
UnsupportedFontException
InvalidFontException
-
pdfFontIsTrueType
public abstract boolean pdfFontIsTrueType() throws InvalidFontException, UnsupportedFontException
-
getGlyphName
public abstract java.lang.String getGlyphName(int gid) throws InvalidFontException, UnsupportedFontException
-
getBase14Name
public abstract java.lang.String getBase14Name()
-
isSerifFont
public abstract boolean isSerifFont() throws InvalidFontException, UnsupportedFontException
-
isSmallCapFont
public abstract boolean isSmallCapFont() throws InvalidFontException, UnsupportedFontException
-
isAllCapFont
public abstract boolean isAllCapFont() throws InvalidFontException, UnsupportedFontException
-
stream
public abstract void stream(java.io.OutputStream out, boolean openTypeFontsAllowed) throws InvalidFontException, UnsupportedFontException, java.io.IOException
Streams a font suitable for embedding in a PDF for editting situations.- Parameters:
out
- The stream to which the font is streamed.openTypeFontsAllowed
- True iff the target pdf can contain OpenType fonts (i.e., it is at least PDF 1.7)- Throws:
InvalidFontException
UnsupportedFontException
java.io.IOException
-
subsetAndStream
public abstract void subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Throws:
InvalidFontException
UnsupportedFontException
java.io.IOException
-
subsetAndStream
public abstract void subsetAndStream(SubsetSimpleType1 subset, java.io.OutputStream out) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Throws:
InvalidFontException
UnsupportedFontException
java.io.IOException
-
subsetAndStream
public abstract void subsetAndStream(SubsetSimpleTrueType subset, java.io.OutputStream out) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Throws:
InvalidFontException
UnsupportedFontException
java.io.IOException
-
-