org.extex.font.format.xtf.tables.cff
Class T2TDOCharset

java.lang.Object
  extended by org.extex.font.format.xtf.tables.cff.T2CharString
      extended by org.extex.font.format.xtf.tables.cff.T2Operator
          extended by org.extex.font.format.xtf.tables.cff.T2TopDICTOperator
              extended by org.extex.font.format.xtf.tables.cff.T2TDONumber
                  extended by org.extex.font.format.xtf.tables.cff.T2TDOCharset
All Implemented Interfaces:
XMLWriterConvertible

public class T2TDOCharset
extends T2TDONumber

Charset.

Charset data is located via the offset operand to the charset operator in the Top DICT. Each charset is described by a format-type identifier byte followed by format-specific data.

Format 0

Type Name Description
Card8 format =0
SID glyph
[nGlyphs-1]
Glyph name array

Each element of the glyph array represents the name of the corresponding glyph. This format should be used when the SIDs are in a fairly random order. The number of glyphs (nGlyphs) is the value of the count field in the CharStrings INDEX. (There is one less element in the glyph name array than nGlyphs because the .notdef glyph name is omitted.)

Format 1

Type Name Description
Card8 format =1
struct Range1
[varies]
Range1 array

Range1 Format (Charset)

Type Name Description
SID first First glyph in range
Card8 nLeft Glyphs left in range (excluding first)

Each Range1 describes a group of sequential SIDs. The number of ranges is not explicitly specified in the font. Instead, software utilizing this data simply processes ranges until all glyphs in the font are covered. This format is particularly suited to charsets that are well ordered.

Format 2

Type Name Description
Card8 format =2
struct Range2
[varies]
Range2 array

Range2 Format

Type Name Description
SID first First glyph in range
Card16 nLeft Glyphs left in range (excluding first)

Format 2 differs from format 1 only in the size of the nLeft field in each range. This format is most suitable for fonts with a large well-ordered charset - for example, for Asian CIDFonts.

Careful attention to the allocation order of SIDs typically yields very small font charsets. Still more optimization is possible by observing that many fonts adopt one of 3 common charsets. In these cases the operand to the charset operator in the Top DICT specifies a predefined charset id, in place of an offset, as shown in Table Charset ID.

Charset ID

Id Name
0 ISOAdobe
1 Expert
2 ExpertSubset

If the font has an ISOAdobe charset, the charset operator can be omitted from the Top DICT since its default value is 0. Details of predefined charsets can be found in Appendix�C. A font may use a predefined charset if it exactly matches in the first nGlyphs. CID fonts must not use predefined charsets.
Two or more fonts may share the same charset by setting the offset operand of the charset operator to the same value in each font.

Version:
$Revision: 7274 $
Author:
Michael Niedermair

Field Summary
static int EXPERT
          Expert
static int EXPERT_SUBSET
          ExpertSubset
static int FONT_DEFINE
          FontDefine
static int ISO_ADOPE
          ISOAdobe
 
Fields inherited from class org.extex.font.format.xtf.tables.cff.T2TopDICTOperator
CFF_CHARSET, CFF_CHARSTRINGS, CFF_CHARSTRINGTYPE, CFF_CIDCOUNT, CFF_CIDFONTREVISION, CFF_CIDFONTTYPE, CFF_CIDFONTVERSION, CFF_COPYRIGHT, CFF_ENCODING, CFF_FAMILYNAME, CFF_FDARRAY, CFF_FDSELECT, CFF_FONTBBOX, CFF_FONTMATRIX, CFF_FONTNAME, CFF_FULLNAME, CFF_ISFIXEDPITCH, CFF_ITALICANGLE, CFF_NOTICE, CFF_PAINTTYPE, CFF_POSTSCRIPT, CFF_PRIVATE, CFF_ROS, CFF_STROKEWIDTH, CFF_SYNTHETICBASE, CFF_UIDBASE, CFF_UNDERLINEPOSITION, CFF_UNDERLINETHICKNESS, CFF_UNIQUEID, CFF_VERSION, CFF_WEIGHT, CFF_XUID, TYPE_CHARSET, TYPE_CHARSTRINGS, TYPE_CHARSTRINGTYPE, TYPE_CIDCOUNT, TYPE_CIDFONTREVISION, TYPE_CIDFONTTYPE, TYPE_CIDFONTVERSION, TYPE_COPYRIGHT, TYPE_ENCODING, TYPE_FAMILYNAME, TYPE_FDARRAY, TYPE_FDSELECT, TYPE_FONTBBOX, TYPE_FONTMATRIX, TYPE_FONTNAME, TYPE_FULLNAME, TYPE_ISFIXEDPITCH, TYPE_ITALICANGLE, TYPE_NOTDEF, TYPE_NOTICE, TYPE_PAINTTYPE, TYPE_POSTSCRIPT, TYPE_PRIVATE, TYPE_ROS, TYPE_STROKEWIDTH, TYPE_SYNTHETICBASE, TYPE_UIDBASE, TYPE_UNDERLINEPOSITION, TYPE_UNDERLINETHICKNESS, TYPE_UNIQUEID, TYPE_VERSION, TYPE_WEIGHT, TYPE_XUID
 
Fields inherited from class org.extex.font.format.xtf.tables.cff.T2CharString
ESCAPE, ESCAPE_BYTE, T2CALLGSUBR, T2CALLSUBR, T2CNTRMASK, T2ENDCHAR, T2FLEX, T2FLEX1, T2HFLEX, T2HFLEX1, T2HHCURVETO, T2HINTMASK, T2HLINETO, T2HMOVETO, T2HSTEM, T2HSTEMHM, T2HVCURVETO, T2RCURVELINE, T2RETURN, T2RLINECURVE, T2RLINETO, T2RMOVETO, T2RRCURVETO, T2VHCURVETO, T2VLINETO, T2VMOVETO, T2VSTEM, T2VSTEMHM, T2VVCURVETO, TYPE_CALLGSUBR, TYPE_CALLSUBR, TYPE_CNTRMASK, TYPE_ENDCHAR, TYPE_FLEX, TYPE_FLEX1, TYPE_HFLEX, TYPE_HFLEX1, TYPE_HHCURVETO, TYPE_HINTMASK, TYPE_HLINETO, TYPE_HMOVETO, TYPE_HSTEM, TYPE_HSTEMHM, TYPE_HVCURVETO, TYPE_RCURVELINE, TYPE_RETURN, TYPE_RLINECURVE, TYPE_RLINETO, TYPE_RMOVETO, TYPE_RRCURVETO, TYPE_VHCURVETO, TYPE_VLINETO, TYPE_VMOVETO, TYPE_VSTEM, TYPE_VSTEMHM, TYPE_VVCURVETO
 
Constructor Summary
T2TDOCharset(java.util.List<T2CharString> stack)
          Create a new object.
 
Method Summary
 int getID()
          Returns the id of the operator.
 java.lang.String getName()
          Return the name of the operator.
 java.lang.String getNameForPos(int pos)
          Returns the name for a position.
 int getSid(int pos)
          Returns the sid.
 int getSidForStringIndex(int stringIndexpos)
          Returns the sid for a value.
 void init(RandomAccessR rar, OtfTableCFF cff, int baseoffset, CffFont cffFont)
          Initialize.
 void writeXML(XMLStreamWriter writer)
          Write the data to a XMLStreamWriter.
 
Methods inherited from class org.extex.font.format.xtf.tables.cff.T2TDONumber
getBytes, getDouble, getInteger, getValue, isDouble, isInteger, toString
 
Methods inherited from class org.extex.font.format.xtf.tables.cff.T2TopDICTOperator
isTopDICTOperator, newInstance
 
Methods inherited from class org.extex.font.format.xtf.tables.cff.T2Operator
checkWidth, convertStackaddID, isOperator, newInstance, toText
 
Methods inherited from class org.extex.font.format.xtf.tables.cff.T2CharString
getInitPrio, isArray, isBoolean, isEscape, readNumber, readNumber, readSID, readTopDICTOperator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ISO_ADOPE

public static final int ISO_ADOPE
ISOAdobe

See Also:
Constant Field Values

EXPERT

public static final int EXPERT
Expert

See Also:
Constant Field Values

EXPERT_SUBSET

public static final int EXPERT_SUBSET
ExpertSubset

See Also:
Constant Field Values

FONT_DEFINE

public static final int FONT_DEFINE
FontDefine

See Also:
Constant Field Values
Constructor Detail

T2TDOCharset

public T2TDOCharset(java.util.List<T2CharString> stack)
             throws java.io.IOException
Create a new object.

Parameters:
stack - the stack
Throws:
java.io.IOException - if an IO.error occurs.
Method Detail

getID

public int getID()
Returns the id of the operator.

Specified by:
getID in class T2Operator
Returns:
Returns the id of the operator.
See Also:
T2Operator.getID()

getName

public java.lang.String getName()
Return the name of the operator.

Specified by:
getName in class T2Operator
Returns:
Return the name of the operator.
See Also:
T2Operator.getName()

getNameForPos

public java.lang.String getNameForPos(int pos)
Returns the name for a position.

Parameters:
pos - The position.
Returns:
Returns the name for a position.

getSid

public int getSid(int pos)
Returns the sid.

If the pos out of range, 0 (.notdef) is returned.

Parameters:
pos - nThe position in the array.
Returns:
Returns the sid.

getSidForStringIndex

public int getSidForStringIndex(int stringIndexpos)
Returns the sid for a value. If the value is not found, 0 is returned.

Parameters:
stringIndexpos - TODO
Returns:
Returns the sid for a value.

init

public void init(RandomAccessR rar,
                 OtfTableCFF cff,
                 int baseoffset,
                 CffFont cffFont)
          throws java.io.IOException
Initialize.

Overrides:
init in class T2Operator
Parameters:
rar - The input
cff - The cff table
baseoffset - The base offset from cff.
cffFont - The cff font.
Throws:
java.io.IOException - if an IO-error occurred.
See Also:
T2Operator.init(org.extex.util.file.random.RandomAccessR, org.extex.font.format.xtf.tables.OtfTableCFF, int, org.extex.font.format.xtf.tables.cff.CffFont)

writeXML

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

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