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
getEmbedFontName()
String
getEmbedResourceName()
Returns the lookup name to an embeddable font file available as a resource.
Set
getFamilyNames()
Returns the font family names.
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()
String
getFullName()
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()
Returns the font family name stripped of whitespace.
int
getWeight()
Returns the font weight (100, 200...800, 900).
int
getXHeight(int size)
boolean
hasKerningInfo()
boolean
isKerningEnabled()
Used to determine if kerning is enabled.
boolean
isSymbolicFont()
void
putKerningEntry(Integer key, Map value)
void
replaceKerningMap(Map kerningMap)
Replaces the existing kerning map with a new one.
void
setAscender(int ascender)
void
setCapHeight(int capHeight)
void
setDescender(int descender)
void
setEmbedFileName(String path)
void
setEmbedResourceName(String name)
void
setFamilyNames(Set names)
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
setFullName(String name)
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
setWeight(int weight)
Sets the font weight.
void
setXHeight(int xHeight)
Returns the XHeight value of the font.

Methods inherited from class org.apache.fop.fonts.Typeface

getEncoding, getMaxAscent, hadMappingOperations, hasChar, isMultiByte, mapChar, notifyMapOperation

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

getEmbedFontName

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

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

getFamilyNames

public Set getFamilyNames()
Returns the font family names.
Specified by:
getFamilyNames in interface FontMetrics
Returns:
the font family names (a Set of Strings)

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

getFullName

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

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()
Returns the font family name stripped of whitespace.
Returns:
the stripped font family

getWeight

public int getWeight()
Returns the font weight (100, 200...800, 900). This value may be different from the one that was actually used to register the font.
Returns:
the font weight (or 0 if the font weight is unknown)

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.

isSymbolicFont

public boolean isSymbolicFont()
Specified by:
isSymbolicFont in interface FontDescriptor

putKerningEntry

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

replaceKerningMap

public void replaceKerningMap(Map kerningMap)
Replaces the existing kerning map with a new one.
Parameters:
kerningMap - the kerning map (Map, the integers are character codes)

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

setFamilyNames

public void setFamilyNames(Set names)
Specified by:
setFamilyNames 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

setFullName

public void setFullName(String name)
Specified by:
setFullName 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

setWeight

public void setWeight(int weight)
Sets the font weight. Valid values are 100, 200...800, 900.
Parameters:
weight - the font weight

setXHeight

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

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