fop 0.94

org.apache.fop.fonts
Class CustomFont

java.lang.Object
  extended by org.apache.fop.fonts.Typeface
      extended by org.apache.fop.fonts.CustomFont
All Implemented Interfaces:
FontDescriptor, FontMetrics, MutableFont
Direct Known Subclasses:
CIDFont, SingleByteFont

public abstract class CustomFont
extends Typeface
implements FontDescriptor, MutableFont

Abstract base class for custom fonts loaded from files, for example.


Constructor Summary
CustomFont()
           
 
Method Summary
 int getAscender()
          Returns the ascender value of the font.
 int getAscender(int size)
          Returns the ascent of the font described by this FontMetrics object.
 int getCapHeight()
          Returns the capital height of the font.
 int getCapHeight(int size)
          Returns the size of a capital letter measured from the font's baseline.
 int getDescender()
          Returns the descender value of the font.
 int getDescender(int size)
          Returns the descent of the font described by this FontMetrics object.
 java.lang.String getEmbedFileName()
          Returns an URI representing an embeddable font file.
 javax.xml.transform.Source getEmbedFileSource()
          Returns a Source representing an embeddable font file.
 java.lang.String getEmbedResourceName()
          Returns the lookup name to an embeddable font file available as a resource.
 int getFirstChar()
          Returns the index of the first character defined in this font.
 int getFlags()
          Returns the flags for the font.
 int[] getFontBBox()
          Returns the font's bounding box.
 java.lang.String getFontName()
          Returns the font name.
 java.lang.String getFontSubName()
          Returns font's subfamily name.
 FontType getFontType()
          Returns the type of the font.
 int getItalicAngle()
          Returns the italic angle for the font.
 java.util.Map getKerningInfo()
          Returns the kerning map for the font.
 int getLastChar()
          Returns the index of the last character defined in this font.
 int getMissingWidth()
          Returns the width to be used when no width is available.
 int getStemV()
          Returns the vertical stem width for the font.
 java.lang.String getStrippedFontName()
           
 int getXHeight(int size)
          Determines the typical font height of this FontMetrics object
 boolean hasKerningInfo()
          Indicates if the font has kering information.
 boolean isKerningEnabled()
          Used to determine if kerning is enabled.
 void putKerningEntry(java.lang.Integer key, java.util.Map value)
          Adds an entry to the kerning table.
 void setAscender(int ascender)
          Sets the ascent value.
 void setCapHeight(int capHeight)
          Sets the capital height value.
 void setDescender(int descender)
          Sets the descent value.
 void setEmbedFileName(java.lang.String path)
          Sets the path to the embeddable font file.
 void setEmbedResourceName(java.lang.String name)
          Sets the resource name of the embeddable font file.
 void setFirstChar(int index)
          Sets the index of the first character in the character table.
 void setFlags(int flags)
          Sets the font's flags
 void setFontBBox(int[] bbox)
          Sets the font's bounding box
 void setFontName(java.lang.String name)
          Sets the font name.
 void setFontSubFamilyName(java.lang.String subFamilyName)
          Sets the font's subfamily name.
 void setFontType(FontType fontType)
          Sets the font type.
 void setItalicAngle(int italicAngle)
          Sets the font's italic angle.
 void setKerningEnabled(boolean enabled)
          Enables/disabled kerning.
 void setLastChar(int index)
          Sets the index of the last character in the character table.
 void setMissingWidth(int width)
          Sets the font's default width
 void setResolver(FontResolver resolver)
          Sets the font resolver.
 void setStemV(int stemV)
          Sets the font's StemV value.
 void setXHeight(int xHeight)
          Returns the XHeight value of the font.
 
Methods inherited from class org.apache.fop.fonts.Typeface
getEncoding, getMaxAscent, hasChar, isMultiByte, mapChar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.fop.fonts.FontDescriptor
isEmbeddable
 
Methods inherited from interface org.apache.fop.fonts.FontMetrics
getMaxAscent, getWidth, getWidths
 

Constructor Detail

CustomFont

public CustomFont()
Method Detail

getFontName

public java.lang.String getFontName()
Description copied from interface: FontMetrics
Returns the font name.

Specified by:
getFontName in interface FontMetrics
Returns:
the font name
See Also:
FontMetrics.getFontName()

getStrippedFontName

public java.lang.String getStrippedFontName()
See Also:
org.apache.fop.fonts.FontMetrics#getStrippedFontName()

getFontSubName

public java.lang.String getFontSubName()
Returns font's subfamily name.

Returns:
the font's subfamily name

getEmbedFileName

public java.lang.String getEmbedFileName()
Returns an URI representing an embeddable font file. The URI will often be a filename or an URL.

Returns:
URI to an embeddable font file or null if not available.

getEmbedFileSource

public javax.xml.transform.Source getEmbedFileSource()
                                              throws java.io.IOException
Returns a Source representing an embeddable font file.

Returns:
Source for an embeddable font file
Throws:
java.io.IOException - if embedFileName is not null but Source is not found

getEmbedResourceName

public java.lang.String getEmbedResourceName()
Returns the lookup name to an embeddable font file available as a resource. (todo) Remove this method, this should be done using a resource: URI.

Returns:
the lookup name

getAscender

public int getAscender()
Description copied from interface: FontDescriptor
Returns the ascender value of the font. (Ascent in pdf spec)

Specified by:
getAscender in interface FontDescriptor
Returns:
the ascender
See Also:
FontDescriptor.getAscender()

getDescender

public int getDescender()
Description copied from interface: FontDescriptor
Returns the descender value of the font. (Descent in pdf spec)

Specified by:
getDescender in interface FontDescriptor
Returns:
the descender value
See Also:
FontDescriptor.getDescender()

getCapHeight

public int getCapHeight()
Description copied from interface: FontDescriptor
Returns the capital height of the font.

Specified by:
getCapHeight in interface FontDescriptor
Returns:
the capiptal height
See Also:
FontDescriptor.getCapHeight()

getAscender

public int getAscender(int size)
Description copied from interface: FontMetrics
Returns the ascent of the font described by this FontMetrics object. It returns the nominal ascent within the em box.

Specified by:
getAscender in interface FontMetrics
Parameters:
size - font size
Returns:
ascent in milliponts
See Also:
FontMetrics.getAscender(int)

getDescender

public int getDescender(int size)
Description copied from interface: FontMetrics
Returns the descent of the font described by this FontMetrics object.

Specified by:
getDescender in interface FontMetrics
Parameters:
size - font size
Returns:
descent in milliponts
See Also:
FontMetrics.getDescender(int)

getCapHeight

public int getCapHeight(int size)
Description copied from interface: FontMetrics
Returns the size of a capital letter measured from the font's baseline.

Specified by:
getCapHeight in interface FontMetrics
Parameters:
size - font size
Returns:
height of capital characters
See Also:
FontMetrics.getCapHeight(int)

getXHeight

public int getXHeight(int size)
Description copied from interface: FontMetrics
Determines the typical font height of this FontMetrics object

Specified by:
getXHeight in interface FontMetrics
Parameters:
size - font size
Returns:
font height in millipoints
See Also:
FontMetrics.getXHeight(int)

getFontBBox

public int[] getFontBBox()
Description copied from interface: FontDescriptor
Returns the font's bounding box.

Specified by:
getFontBBox in interface FontDescriptor
Returns:
the bounding box
See Also:
FontDescriptor.getFontBBox()

getFlags

public int getFlags()
Description copied from interface: FontDescriptor
Returns the flags for the font. (See pdf spec)

Specified by:
getFlags in interface FontDescriptor
Returns:
the flags
See Also:
FontDescriptor.getFlags()

getStemV

public int getStemV()
Description copied from interface: FontDescriptor
Returns the vertical stem width for the font.

Specified by:
getStemV in interface FontDescriptor
Returns:
the vertical stem width
See Also:
FontDescriptor.getStemV()

getItalicAngle

public int getItalicAngle()
Description copied from interface: FontDescriptor
Returns the italic angle for the font.

Specified by:
getItalicAngle in interface FontDescriptor
Returns:
the italic angle
See Also:
FontDescriptor.getItalicAngle()

getMissingWidth

public int getMissingWidth()
Returns the width to be used when no width is available.

Returns:
a character width

getFontType

public FontType getFontType()
Description copied from interface: FontMetrics
Returns the type of the font.

Specified by:
getFontType in interface FontMetrics
Returns:
the font type
See Also:
FontMetrics.getFontType()

getFirstChar

public int getFirstChar()
Returns the index of the first character defined in this font.

Returns:
the index of the first character

getLastChar

public int getLastChar()
Returns the index of the last character defined in this font.

Returns:
the index of the last character

isKerningEnabled

public boolean isKerningEnabled()
Used to determine if kerning is enabled.

Returns:
True if kerning is enabled.

hasKerningInfo

public final boolean hasKerningInfo()
Description copied from interface: FontMetrics
Indicates if the font has kering information.

Specified by:
hasKerningInfo in interface FontMetrics
Returns:
True, if kerning is available.
See Also:
FontMetrics.hasKerningInfo()

getKerningInfo

public final java.util.Map getKerningInfo()
Description copied from interface: FontMetrics
Returns the kerning map for the font.

Specified by:
getKerningInfo in interface FontMetrics
Returns:
the kerning map
See Also:
FontMetrics.getKerningInfo()

setFontName

public void setFontName(java.lang.String name)
Description copied from interface: MutableFont
Sets the font name.

Specified by:
setFontName in interface MutableFont
Parameters:
name - font name
See Also:
MutableFont.setFontName(String)

setFontSubFamilyName

public void setFontSubFamilyName(java.lang.String subFamilyName)
Sets the font's subfamily name.

Parameters:
subFamilyName - the subfamily name of the font

setEmbedFileName

public void setEmbedFileName(java.lang.String path)
Description copied from interface: MutableFont
Sets the path to the embeddable font file.

Specified by:
setEmbedFileName in interface MutableFont
Parameters:
path - URI to the file
See Also:
MutableFont.setEmbedFileName(String)

setEmbedResourceName

public void setEmbedResourceName(java.lang.String name)
Description copied from interface: MutableFont
Sets the resource name of the embeddable font file.

Specified by:
setEmbedResourceName in interface MutableFont
Parameters:
name - resource name
See Also:
MutableFont.setEmbedResourceName(String)

setCapHeight

public void setCapHeight(int capHeight)
Description copied from interface: MutableFont
Sets the capital height value.

Specified by:
setCapHeight in interface MutableFont
Parameters:
capHeight - capital height
See Also:
MutableFont.setCapHeight(int)

setXHeight

public void setXHeight(int xHeight)
Returns the XHeight value of the font.

Parameters:
xHeight - the XHeight value

setAscender

public void setAscender(int ascender)
Description copied from interface: MutableFont
Sets the ascent value.

Specified by:
setAscender in interface MutableFont
Parameters:
ascender - ascent height
See Also:
MutableFont.setAscender(int)

setDescender

public void setDescender(int descender)
Description copied from interface: MutableFont
Sets the descent value.

Specified by:
setDescender in interface MutableFont
Parameters:
descender - descent value
See Also:
MutableFont.setDescender(int)

setFontBBox

public void setFontBBox(int[] bbox)
Description copied from interface: MutableFont
Sets the font's bounding box

Specified by:
setFontBBox in interface MutableFont
Parameters:
bbox - bounding box
See Also:
MutableFont.setFontBBox(int[])

setFlags

public void setFlags(int flags)
Description copied from interface: MutableFont
Sets the font's flags

Specified by:
setFlags in interface MutableFont
Parameters:
flags - flags
See Also:
MutableFont.setFlags(int)

setStemV

public void setStemV(int stemV)
Description copied from interface: MutableFont
Sets the font's StemV value.

Specified by:
setStemV in interface MutableFont
Parameters:
stemV - StemV
See Also:
MutableFont.setStemV(int)

setItalicAngle

public void setItalicAngle(int italicAngle)
Description copied from interface: MutableFont
Sets the font's italic angle.

Specified by:
setItalicAngle in interface MutableFont
Parameters:
italicAngle - italic angle
See Also:
MutableFont.setItalicAngle(int)

setMissingWidth

public void setMissingWidth(int width)
Description copied from interface: MutableFont
Sets the font's default width

Specified by:
setMissingWidth in interface MutableFont
Parameters:
width - default width
See Also:
MutableFont.setMissingWidth(int)

setFontType

public void setFontType(FontType fontType)
Description copied from interface: MutableFont
Sets the font type.

Specified by:
setFontType in interface MutableFont
Parameters:
fontType - font type
See Also:
MutableFont.setFontType(FontType)

setFirstChar

public void setFirstChar(int index)
Description copied from interface: MutableFont
Sets the index of the first character in the character table.

Specified by:
setFirstChar in interface MutableFont
Parameters:
index - index of first character
See Also:
MutableFont.setFirstChar(int)

setLastChar

public void setLastChar(int index)
Description copied from interface: MutableFont
Sets the index of the last character in the character table.

Specified by:
setLastChar in interface MutableFont
Parameters:
index - index of the last character
See Also:
MutableFont.setLastChar(int)

setKerningEnabled

public void setKerningEnabled(boolean enabled)
Description copied from interface: MutableFont
Enables/disabled kerning.

Specified by:
setKerningEnabled in interface MutableFont
Parameters:
enabled - True if kerning should be enabled if available
See Also:
MutableFont.setKerningEnabled(boolean)

setResolver

public void setResolver(FontResolver resolver)
Sets the font resolver. Needed for URI resolution.

Parameters:
resolver - the font resolver

putKerningEntry

public void putKerningEntry(java.lang.Integer key,
                            java.util.Map value)
Description copied from interface: MutableFont
Adds an entry to the kerning table.

Specified by:
putKerningEntry in interface MutableFont
Parameters:
key - Kerning key
value - Kerning value
See Also:
MutableFont.putKerningEntry(Integer, Map)

fop 0.94

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.