org.extex.font.format.xtf.tables
Class TtfTableLTSH

java.lang.Object
  extended by org.extex.font.format.xtf.tables.AbstractXtfTable
      extended by org.extex.font.format.xtf.tables.TtfTableLTSH
All Implemented Interfaces:
XtfGlyphName, XtfTable, XMLWriterConvertible

public class TtfTableLTSH
extends AbstractXtfTable
implements XtfTable, XMLWriterConvertible

The table 'LTSH' (The Linear Threshold Table).

The LTSH table relates to OpenType fonts containing TrueType outlines. There are noticeable improvements to fonts on the screen when instructions are carefully applied to the sidebearings. The gain in readability is offset by the necessity for the OS to grid fit the glyphs in order to find the actual advance width for the glyphs (since instructions may be moving the sidebearing points). The TrueType outline format already has two mechanisms to side step the speed issues: the 'hdmx' table, where precomputed advance widths may be saved for selected ppem sizes, and the 'vdmx' table, where precomputed vertical advance widths may be saved for selected ppem sizes. The 'LTSH' table (Linear ThreSHold) is a second, complementary method.

The LTSH table defines the point at which it is reasonable to assume linearly scaled advance widths on a glyph-by-glyph basis. This table should not be included unless bit 4 of the "flags" field in the 'head' table is set. The criteria for linear scaling is:

a. (ppem size is 50) AND (difference between the rounded linear width and the rounded instructed width � 2% of the rounded linear width)

or b. Linear width == Instructed width

The LTSH table records the ppem for each glyph at which the scaling becomes linear again, despite instructions effecting the advance width. It is a requirement that, at and above the recorded threshold size, the glyph remain linear in its scaling (i.e., not legal to set threshold at 55 ppem if glyph becomes nonlinear again at 90 ppem). The format for the table is:

Type Name Description
USHORT version Version number (starts at 0).
USHORT numGlyphs Number of glyphs (from "numGlyphs" in 'maxp' table).
BYTE yPels[numGlyphs] The vertical pel height at which the glyph can be assumed to scale linearly. On a per glyph basis.

Note that glyphs which do not have instructions on their sidebearings should have yPels = 1; i.e., always scales linearly.

Version:
$Revision: 6604 $
Author:
Michael Niedermair

Constructor Summary
TtfTableLTSH(XtfTableMap tablemap, XtfTableDirectory.Entry de, RandomAccessR rar)
          Create a new object
 
Method Summary
 int getNumGlyphs()
          Returns the numGlyphs.
 java.lang.String getShortcut()
          Returns the table shortcut.
 int getType()
          Get the table type, as a table directory value.
 int getVersion()
          Returns the version.
 byte[] getYPels()
          Returns the yPels.
 void writeXML(XMLStreamWriter writer)
          Write the data to a XMLStreamWriter.
 
Methods inherited from class org.extex.font.format.xtf.tables.AbstractXtfTable
getGlyphName, getInitOrder, getTableMap, init, writeStartElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.extex.font.format.xtf.tables.XtfTable
getInitOrder, getTableMap, init
 

Constructor Detail

TtfTableLTSH

public TtfTableLTSH(XtfTableMap tablemap,
                    XtfTableDirectory.Entry de,
                    RandomAccessR rar)
             throws java.io.IOException
Create a new object

Parameters:
tablemap - the table map
de - entry
rar - input
Throws:
java.io.IOException - if an IO-error occurs
Method Detail

getNumGlyphs

public int getNumGlyphs()
Returns the numGlyphs.

Returns:
Returns the numGlyphs.

getShortcut

public java.lang.String getShortcut()
Returns the table shortcut.

Specified by:
getShortcut in interface XtfTable
Returns:
Returns the table shortcut.
See Also:
XtfTable.getShortcut()

getType

public int getType()
Get the table type, as a table directory value.

Specified by:
getType in interface XtfTable
Returns:
Returns the table type

getVersion

public int getVersion()
Returns the version.

Returns:
Returns the version.

getYPels

public byte[] getYPels()
Returns the yPels.

Returns:
Returns the yPels.

writeXML

public void writeXML(XMLStreamWriter writer)
              throws java.io.IOException
Write the data to a XMLStreamWriter.

Specified by:
writeXML in interface XMLWriterConvertible
Parameters:
writer - the XML-Writer
Throws:
java.io.IOException - if an IO-error occurs.
See Also:
XMLWriterConvertible.writeXML( org.extex.util.xml.XMLStreamWriter)