org.apache.fop.fonts

Class CustomFont

Implemented Interfaces:
FontDescriptor, FontMetrics, MutableFont
Known Direct Subclasses:
CIDFont, SingleByteFont

public abstract class CustomFont
extends Typeface
implements FontDescriptor, MutableFont

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

Method Summary

int
getAscender()
int
getAscender(int size)
int
getCapHeight()
int
getCapHeight(int size)
int
getDescender()
int
getDescender(int size)
String
getEmbedFileName()
Returns an URI representing an embeddable font file.
Source
getEmbedFileSource()
Returns a Source representing an embeddable font file.
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()
int[]
getFontBBox()
String
getFontName()
String
getFontSubName()
Returns font's subfamily name.
FontType
getFontType()
int
getItalicAngle()
Map
getKerningInfo()
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()
String
getStrippedFontName()
int
getXHeight(int size)
boolean
hasKerningInfo()
boolean
isKerningEnabled()
Used to determine if kerning is enabled.
void
putKerningEntry(Integer key, Map value)
void
setAscender(int ascender)
void
setCapHeight(int capHeight)
void
setDescender(int descender)
void
setEmbedFileName(String path)
void
setEmbedResourceName(String name)
void
setFirstChar(int index)
void
setFlags(int flags)
void
setFontBBox(int[] bbox)
void
setFontName(String name)
void
setFontSubFamilyName(String subFamilyName)
Sets the font's subfamily name.
void
setFontType(FontType fontType)
void
setItalicAngle(int italicAngle)
void
setKerningEnabled(boolean enabled)
void
setLastChar(int index)
void
setMissingWidth(int width)
void
setResolver(FontResolver resolver)
Sets the font resolver.
void
setStemV(int stemV)
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

Method Details

getAscender

public int getAscender()
Specified by:
getAscender in interface FontDescriptor

getAscender

public int getAscender(int size)
Specified by:
getAscender in interface FontMetrics

getCapHeight

public int getCapHeight()
Specified by:
getCapHeight in interface FontDescriptor

getCapHeight

public int getCapHeight(int size)
Specified by:
getCapHeight in interface FontMetrics

getDescender

public int getDescender()
Specified by:
getDescender in interface FontDescriptor

getDescender

public int getDescender(int size)
Specified by:
getDescender in interface FontMetrics

getEmbedFileName

public 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 Source getEmbedFileSource()
            throws IOException
Returns a Source representing an embeddable font file.
Returns:
Source for an embeddable font file

getEmbedResourceName

public 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

getFirstChar

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

getFlags

public int getFlags()
Specified by:
getFlags in interface FontDescriptor

getFontBBox

public int[] getFontBBox()
Specified by:
getFontBBox in interface FontDescriptor

getFontName

public String getFontName()
Specified by:
getFontName in interface FontMetrics

getFontSubName

public String getFontSubName()
Returns font's subfamily name.
Returns:
the font's subfamily name

getFontType

public FontType getFontType()
Specified by:
getFontType in interface FontMetrics
See Also:
org.apache.fop.fonts.FontDescriptor.getFontType()

getItalicAngle

public int getItalicAngle()
Specified by:
getItalicAngle in interface FontDescriptor

getKerningInfo

public final Map getKerningInfo()
Specified by:
getKerningInfo in interface FontMetrics

getLastChar

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

getMissingWidth

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

getStemV

public int getStemV()
Specified by:
getStemV in interface FontDescriptor

getStrippedFontName

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

getXHeight

public int getXHeight(int size)
Specified by:
getXHeight in interface FontMetrics

hasKerningInfo

public final boolean hasKerningInfo()
Specified by:
hasKerningInfo in interface FontMetrics

isKerningEnabled

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

putKerningEntry

public void putKerningEntry(Integer key,
                            Map value)
Specified by:
putKerningEntry in interface MutableFont

setAscender

public void setAscender(int ascender)
Specified by:
setAscender in interface MutableFont

setCapHeight

public void setCapHeight(int capHeight)
Specified by:
setCapHeight in interface MutableFont

setDescender

public void setDescender(int descender)
Specified by:
setDescender in interface MutableFont

setEmbedFileName

public void setEmbedFileName(String path)
Specified by:
setEmbedFileName in interface MutableFont

setEmbedResourceName

public void setEmbedResourceName(String name)
Specified by:
setEmbedResourceName in interface MutableFont

setFirstChar

public void setFirstChar(int index)
Specified by:
setFirstChar in interface MutableFont

setFlags

public void setFlags(int flags)
Specified by:
setFlags in interface MutableFont

setFontBBox

public void setFontBBox(int[] bbox)
Specified by:
setFontBBox in interface MutableFont

setFontName

public void setFontName(String name)
Specified by:
setFontName in interface MutableFont

setFontSubFamilyName

public void setFontSubFamilyName(String subFamilyName)
Sets the font's subfamily name.
Parameters:
subFamilyName - the subfamily name of the font

setFontType

public void setFontType(FontType fontType)
Specified by:
setFontType in interface MutableFont

setItalicAngle

public void setItalicAngle(int italicAngle)
Specified by:
setItalicAngle in interface MutableFont

setKerningEnabled

public void setKerningEnabled(boolean enabled)
Specified by:
setKerningEnabled in interface MutableFont

setLastChar

public void setLastChar(int index)
Specified by:
setLastChar in interface MutableFont

setMissingWidth

public void setMissingWidth(int width)
Specified by:
setMissingWidth in interface MutableFont

setResolver

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

setStemV

public void setStemV(int stemV)
Specified by:
setStemV in interface MutableFont

setXHeight

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

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