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.ObjectA 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 doublegetAdvance(int glyphID)Fetch the horizontal advance width for the specified glyph.abstract java.lang.StringgetBase14Name()abstract doublegetCapHeight()Fetch the height above the baseline of capital lettersabstract intgetCIDCount()Get the CID count associated with the CIDKeyedFontabstract RectgetFontBBox()Fetch the font bounding box.abstract java.lang.StringgetFontFamily()Fetches the preferred family name associated with this font.abstract intgetGlyphCid(int glyphID)Fetch the CID for a given glyph.abstract java.lang.StringgetGlyphName(int gid)abstract doublegetItalicAngle()Fetch the italic angle.abstract intgetNumGlyphs()The number of glyphs in the font.abstract java.lang.StringgetPostscriptName()Fetches the preferred postscript name for the font.abstract ROSgetROS()Get the Registry, Ordering and Supplement associated with the font.abstract doublegetStemV()Fetch the font's primary vertical stem widthabstract doublegetXHeight()Fetch the height above the baseline for lowercase letters.abstract booleanisAllCapFont()abstract booleanisSerifFont()abstract booleanisSmallCapFont()abstract booleanpdfFontIsTrueType()abstract voidstream(java.io.OutputStream out, boolean openTypeFontsAllowed)Streams a font suitable for embedding in a PDF for editting situations.abstract voidsubsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS)abstract voidsubsetAndStream(SubsetSimpleTrueType subset, java.io.OutputStream out)abstract voidsubsetAndStream(SubsetSimpleType1 subset, java.io.OutputStream out)
-
-
-
Method Detail
-
getPostscriptName
public abstract java.lang.String getPostscriptName() throws InvalidFontException, UnsupportedFontExceptionFetches 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, UnsupportedFontExceptionFetches 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, InvalidFontExceptionFetch the font's primary vertical stem width- Returns:
- the stemv scaled to 1000 ppem.
- Throws:
UnsupportedFontExceptionInvalidFontException
-
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:
InvalidFontExceptionUnsupportedFontException
-
getCapHeight
public abstract double getCapHeight() throws UnsupportedFontException, InvalidFontExceptionFetch the height above the baseline of capital letters- Returns:
- the capHeight scaled to 1000 ppem.
- Throws:
UnsupportedFontExceptionInvalidFontException
-
getXHeight
public abstract double getXHeight() throws UnsupportedFontException, InvalidFontExceptionFetch the height above the baseline for lowercase letters.- Returns:
- the xHeight scaled to 1000 ppem.
- Throws:
UnsupportedFontExceptionInvalidFontException
-
getItalicAngle
public abstract double getItalicAngle() throws InvalidFontException, UnsupportedFontExceptionFetch 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, UnsupportedFontExceptionThe number of glyphs in the font.
-
getAdvance
public abstract double getAdvance(int glyphID) throws InvalidFontException, UnsupportedFontExceptionFetch 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, InvalidFontExceptionGet the CID count associated with the CIDKeyedFont
-
getGlyphCid
public abstract int getGlyphCid(int glyphID) throws UnsupportedFontException, InvalidFontExceptionFetch 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:
UnsupportedFontExceptionInvalidFontException
-
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.IOExceptionStreams 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:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
subsetAndStream
public abstract void subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Throws:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
subsetAndStream
public abstract void subsetAndStream(SubsetSimpleType1 subset, java.io.OutputStream out) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Throws:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
subsetAndStream
public abstract void subsetAndStream(SubsetSimpleTrueType subset, java.io.OutputStream out) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Throws:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
-