org.extex.font.format.xtf
Class LoadableXtfFont

java.lang.Object
  extended by org.extex.font.format.xtf.LoadableXtfFont
All Implemented Interfaces:
BackendFont, BaseFont, ExtexFont, XtfMetricFont, LoadableFont, LogEnabled

public class LoadableXtfFont
extends java.lang.Object
implements LoadableFont, XtfMetricFont, BackendFont, LogEnabled

Class to load xtf fonts.

At the moment only ttf!

Version:
$Revision: 6604 $
Author:
Michael Niedermair

Constructor Summary
LoadableXtfFont()
           
 
Method Summary
 void enableLogging(java.util.logging.Logger logger)
          Setter for the logger.
 FontKey getActualFontKey()
          Returns the actual FontKey for this font after a font substitution.
 FixedDimen getActualSize()
          Returns the actual size of the font.
 byte[] getAfm()
          Returns the afm data, or null, if not available.
 int getCheckSum()
          Returns the checksum of the font.
 FixedGlue getDepth(UnicodeChar uc)
          Returns the depth of the char.
 FixedDimen getDesignSize()
          Returns the design size of the font.
 FixedDimen getEm()
          Returns the size of 'M'.
 int getEncodingForChar(int codepoint)
          Returns the number of the encoding vector for the codepoint.
 java.util.List<java.lang.String[]> getEncodingVectors()
          Returns the encoding vectors as list of string array (without a '/') or null, if no one exists.
 FixedDimen getEx()
          Returns the size of 'x'.
 FixedDimen getFontDimen(java.lang.String name)
          Returns the size of the parameter with the name 'name'.
 FontKey getFontKey()
          Returns the FontKey for this font.
 java.lang.String getFontName()
          Returns the name of the font.
 GlyphName getGlyphname()
          Getter for glyphname.
 FixedGlue getHeight(UnicodeChar uc)
          Returns the height of the char.
 FixedDimen getItalicCorrection(UnicodeChar uc)
          Returns the italic correction of the char. Returns always 0pt.
 FixedDimen getKerning(UnicodeChar uc1, UnicodeChar uc2)
          Returns the kerning between two chars.
 UnicodeChar getLigature(UnicodeChar uc1, UnicodeChar uc2)
          Returns the ligature for two chars.
 java.lang.String getName()
          Returns the internal name of the font.
 byte[] getPfa()
          Returns the pfa data, or null, if not available.
 byte[] getPfb()
          Returns the pfb data, or null, if not available.
 FixedCount getScaleFactor()
          Returns the scale factor of the font. Returns allways 0.
 FixedGlue getSpace()
          Returns the size of the 'space'.
 FixedGlue getWidth(UnicodeChar uc)
          Returns the width of the char.
 byte[] getXtf()
          Returns the xtf data, or null, if not available.
 boolean hasEncodingVector()
          Returns true, if the font has an encoding vector, otherwise false.
 boolean hasGlyph(UnicodeChar uc)
          Returns true, if the glyph exists.
 boolean hasMultiFonts()
          If true, the font has more the one font in it.
 boolean isType1()
          Returns true, if the font is a type 1 font (with afm/pfb), otherwise false.
 boolean isXtf()
          Returns true, if the font is a ttf/otf font, otherwise false.
 void loadFont(java.io.InputStream in, CoreFontFactory factory, FontKey key)
          Load a font from the stream.
 void usedCharacter(BackendCharacter bc)
          Tells the font, which character is used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadableXtfFont

public LoadableXtfFont()
Method Detail

enableLogging

public void enableLogging(java.util.logging.Logger logger)
Setter for the logger.

Specified by:
enableLogging in interface LogEnabled
Parameters:
logger - the logger to use
See Also:
LogEnabled.enableLogging(java.util.logging.Logger)

getActualFontKey

public FontKey getActualFontKey()
Returns the actual FontKey for this font after a font substitution.

Specified by:
getActualFontKey in interface BackendFont
Specified by:
getActualFontKey in interface BaseFont
Returns:
Returns the actual FontKey for this font.
See Also:
BaseFont.getActualFontKey()

getActualSize

public FixedDimen getActualSize()
Returns the actual size of the font.

Specified by:
getActualSize in interface ExtexFont
Returns:
Returns the actual size of the font.
See Also:
ExtexFont.getActualSize()

getAfm

public byte[] getAfm()
Returns the afm data, or null, if not available. TODO mgn raus

Specified by:
getAfm in interface BackendFont
Returns:
Returns the afm data, or null, if not available.
See Also:
BackendFont.getAfm()

getCheckSum

public int getCheckSum()
Returns the checksum of the font. TODO mgn raus

Specified by:
getCheckSum in interface BackendFont
Returns:
the checksum.
See Also:
BackendFont.getCheckSum()

getDepth

public FixedGlue getDepth(UnicodeChar uc)
Returns the depth of the char. If the character is not defined or an invalid value is given, then the depth 0pt is returned.

Specified by:
getDepth in interface ExtexFont
Parameters:
uc - The Unicode char.
Returns:
Returns the depth of the char.
See Also:
ExtexFont.getDepth(org.extex.core.UnicodeChar)

getDesignSize

public FixedDimen getDesignSize()
Returns the design size of the font.

Specified by:
getDesignSize in interface ExtexFont
Returns:
Returns the design size of the font.
See Also:
ExtexFont.getDesignSize()

getEm

public FixedDimen getEm()
Returns the size of 'M'.

Specified by:
getEm in interface ExtexFont
Returns:
Returns the size of 'M'.
See Also:
ExtexFont.getEm()

getEncodingForChar

public int getEncodingForChar(int codepoint)
Returns the number of the encoding vector for the codepoint. If no enocding vector exists, -1 is returned. TODO mgn raus

Specified by:
getEncodingForChar in interface BackendFont
Parameters:
codepoint - The codepoint of the char.
Returns:
Returns the number of the encoding vector for the codepoint.
See Also:
BackendFont.getEncodingForChar(int)

getEncodingVectors

public java.util.List<java.lang.String[]> getEncodingVectors()
Returns the encoding vectors as list of string array (without a '/') or null, if no one exists. TODO mgn raus

Specified by:
getEncodingVectors in interface BackendFont
Returns:
Returns the encoding vectors.
See Also:
BackendFont.getEncodingVectors()

getEx

public FixedDimen getEx()
Returns the size of 'x'.

Specified by:
getEx in interface ExtexFont
Returns:
Returns the size of 'x'.
See Also:
ExtexFont.getEx()

getFontDimen

public FixedDimen getFontDimen(java.lang.String name)
Returns the size of the parameter with the name 'name'.

The size are multiples of the design size!

Specified by:
getFontDimen in interface ExtexFont
Parameters:
name - The name of the parameter.
Returns:
Returns the size of the parameter with the name 'name'.
See Also:
ExtexFont.getFontDimen(java.lang.String)

getFontKey

public FontKey getFontKey()
Returns the FontKey for this font.

Specified by:
getFontKey in interface BaseFont
Returns:
Returns the FontKey for this font.
See Also:
BaseFont.getFontKey()

getFontName

public java.lang.String getFontName()
Returns the name of the font.

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

getGlyphname

public GlyphName getGlyphname()
Getter for glyphname.

Returns:
the glyphname

getHeight

public FixedGlue getHeight(UnicodeChar uc)
Returns the height of the char. If the character is not defined or an invalid value is given, then the height 0pt is returned.

Specified by:
getHeight in interface ExtexFont
Parameters:
uc - The Unicode char.
Returns:
Returns the height of the char.
See Also:
ExtexFont.getHeight(org.extex.core.UnicodeChar)

getItalicCorrection

public FixedDimen getItalicCorrection(UnicodeChar uc)
Returns the italic correction of the char. If the character is not defined or an invalid value is given, then the italic correction 0pt is returned. Returns always 0pt.

Specified by:
getItalicCorrection in interface ExtexFont
Parameters:
uc - The Unicode char.
Returns:
Returns the italic correction of the char.
See Also:
ExtexFont.getItalicCorrection(org.extex.core.UnicodeChar)

getKerning

public FixedDimen getKerning(UnicodeChar uc1,
                             UnicodeChar uc2)
Returns the kerning between two chars.

Specified by:
getKerning in interface ExtexFont
Parameters:
uc1 - The Unicode char (first one).
uc2 - The Unicode char (second one).
Returns:
Returns the kerning between two chars.
See Also:
ExtexFont.getKerning(org.extex.core.UnicodeChar, org.extex.core.UnicodeChar)

getLigature

public UnicodeChar getLigature(UnicodeChar uc1,
                               UnicodeChar uc2)
Returns the ligature for two chars. If no ligature exists then null is returned.

Specified by:
getLigature in interface ExtexFont
Parameters:
uc1 - The Unicode char (first one).
uc2 - The Unicode char (second one).
Returns:
Returns the ligature for two chars.
See Also:
ExtexFont.getLigature(org.extex.core.UnicodeChar, org.extex.core.UnicodeChar)

getName

public java.lang.String getName()
Returns the internal name of the font.

Specified by:
getName in interface BackendFont
Returns:
the internal name of the font.
See Also:
BackendFont.getName()

getPfa

public byte[] getPfa()
Returns the pfa data, or null, if not available. TODO mgn raus

Specified by:
getPfa in interface BackendFont
Returns:
Returns the pfa data, or null, if not available.
See Also:
BackendFont.getPfa()

getPfb

public byte[] getPfb()
Returns the pfb data, or null, if not available. TODO mgn raus

Specified by:
getPfb in interface BackendFont
Returns:
Returns the pfb data, or null, if not available.
See Also:
BackendFont.getPfb()

getScaleFactor

public FixedCount getScaleFactor()
Returns the scale factor of the font. The scale factor is a multiple of 1000. Returns allways 0.

Specified by:
getScaleFactor in interface ExtexFont
Returns:
Returns the scale factor of the font.
See Also:
ExtexFont.getScaleFactor()

getSpace

public FixedGlue getSpace()
Returns the size of the 'space'.

Specified by:
getSpace in interface ExtexFont
Returns:
Returns the size of the 'space'.
See Also:
ExtexFont.getSpace()

getWidth

public FixedGlue getWidth(UnicodeChar uc)
Returns the width of the char. If the character is not defined or an invalid value is given, then the width 0pt is returned.

Specified by:
getWidth in interface ExtexFont
Parameters:
uc - The Unicode char.
Returns:
Returns the width of the char.
See Also:
ExtexFont.getWidth(org.extex.core.UnicodeChar)

getXtf

public byte[] getXtf()
Returns the xtf data, or null, if not available. TODO mgn raus

Specified by:
getXtf in interface BackendFont
Returns:
Returns the xtf data, or null, if not available.
See Also:
BackendFont.getXtf()

hasEncodingVector

public boolean hasEncodingVector()
Returns true, if the font has an encoding vector, otherwise false. TODO mgn raus

Specified by:
hasEncodingVector in interface BackendFont
See Also:
BackendFont.hasEncodingVector()

hasGlyph

public boolean hasGlyph(UnicodeChar uc)
Returns true, if the glyph exists.

Specified by:
hasGlyph in interface ExtexFont
Parameters:
uc - the unicode char
Returns:
true, if the glyph exists.
See Also:
ExtexFont.hasGlyph(org.extex.core.UnicodeChar)

hasMultiFonts

public boolean hasMultiFonts()
If true, the font has more the one font in it. TODO mgn raus

Specified by:
hasMultiFonts in interface BackendFont
Returns:
Returns true, if the font has more fonts in it.
See Also:
BackendFont.hasMultiFonts()

isType1

public boolean isType1()
Returns true, if the font is a type 1 font (with afm/pfb), otherwise false. TODO mgn raus

Specified by:
isType1 in interface BackendFont
Returns:
Returns true, if the font is a type 1 font (with afm/pfb), otherwise false.
See Also:
BackendFont.isType1()

isXtf

public boolean isXtf()
Returns true, if the font is a ttf/otf font, otherwise false. TODO mgn raus

Specified by:
isXtf in interface BackendFont
Returns:
Returns true, if the font is a ttf/otf font, otherwise false.
See Also:
BackendFont.isXtf()

loadFont

public void loadFont(java.io.InputStream in,
                     CoreFontFactory factory,
                     FontKey key)
              throws CorruptFontException,
                     ConfigurationException
Load a font from the stream.

Specified by:
loadFont in interface LoadableFont
Parameters:
in - The stream for reading.
factory - Tthe font factory.
key - The font key.
Throws:
CorruptFontException - if the font is corrupt.
ConfigurationException - from the configuration system.
See Also:
LoadableFont.loadFont(java.io.InputStream, org.extex.font.CoreFontFactory, org.extex.font.FontKey)

usedCharacter

public void usedCharacter(BackendCharacter bc)
Tells the font, which character is used. TODO mgn raus

Specified by:
usedCharacter in interface BackendFont
Parameters:
bc - The character.
See Also:
BackendFont.usedCharacter(org.extex.font.BackendCharacter)