⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cffspec.htm

📁 TrueType字库标准文档
💻 HTM
📖 第 1 页 / 共 5 页
字号:
and permits the efficient implementation of dynamic object loading.)

<P>An empty INDEX is represented by a count field with a 0 value and no additional
fields. Thus, the total size of an empty INDEX is 2 bytes.

<P>[Note: an INDEX may be skipped by jumping to the offset specified by the last
element of the offset array.]

<H2>6. Header</H2>

The binary data begins with a header containing the following fields<BR>&nbsp;

<TABLE BGCOLOR="#F0F0F0" width=480  CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description
</THEAD><TBODY></TR>
<TR>
<TD VALIGN=TOP>Card8</TD><TD VALIGN=TOP>major</TD><TD VALIGN=TOP>Format major version (starting at 1)</TD></TR>
<TR>
<TD VALIGN=TOP>Card8</TD><TD VALIGN=TOP>minor</TD><TD VALIGN=TOP>Format minor version (starting at 0)</TD></TR>
<TR>
<TD VALIGN=TOP>Card8</TD><TD VALIGN=TOP>hdrSize</TD><TD VALIGN=TOP>Header size (bytes)</TD></TR>
<TR>
<TD VALIGN=TOP>OffSize</TD><TD VALIGN=TOP>offSize</TD><TD VALIGN=TOP>Absolute offset (0) size</TABLE>

<P>Implementations reading font set files must include code to check version
numbers so that if and when the format and therefore the version number
changes, older implementations will reject newer versions gracefully. If the
major version number is understood by an implementation it can safely proceed
with reading the font. The minor version number indicates extensions to the
format that are undetectable by implementations that don't support them
although they will be unable to take advantage of these extensions.

<P>The hdrSize field must be used when locating the Name INDEX. It is provided so
that future versions of the format may introduce additional data between the
offSize field and the Name INDEX.

<P>The offSize field specifies the size of all offsets (0) relative to the start
of CFF data.

<H2>7. Name INDEX</H2>

<P>This contains the PostScript names (FontName or CIDFontName) of all the fonts
in the FontSet stored in an INDEX structure. The font names are sorted thereby
permitting a binary search to be performed when locating a specific font within
a FontSet. There must be at least one entry in this INDEX, i.e. the FontSet
must contain at least one font.

<P>A font may be deleted from a FontSet without removing its data by setting the
first byte of its name in the Name INDEX to 0 (NUL). This kind of deletion
offers a simple way to handle font upgrades without rebuilding entire font
sets. Binary search software must detect deletions and restart the search at
the previous or next name in the INDEX to ensure that all appropriate names are
matched. 

<H2>8. Top DICT INDEX</H2>

<P>This contains the top-level DICTs of all the fonts in the FontSet stored in an
INDEX structure. Objects contained within this INDEX correspond to those in the
Name INDEX in both order and number. Each object is a DICT structure that
corresponds to the top-level dictionary of a PostScript font.

<P>A font is identified by an entry in the Name INDEX and its data is accessed via
the corresponding Top DICT.

<H2>9. Top DICT Data</H2>

<P>The names of the Top DICT operators shown below are, where possible, the same
as the corresponding PostScript dict key. Operators that have no corresponding
PostScript dict key are noted in the table below along with a default value, if
any. (Several operators have been derived from FontInfo dict keys but have
been grouped together with the Top DICT operators for simplicity. These are
indicated below.)<BR>&nbsp;

<TABLE BGCOLOR="#F0F0F0" width=480  CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Value</TH><TH BGCOLOR="#C0C0C0">Operand(s)</TH><TH BGCOLOR="#C0C0C0">Default,notes
</THEAD><TBODY></TR>
<TR>
<TD VALIGN=TOP>version</TD><TD VALIGN=TOP>0</TD><TD VALIGN=TOP>SID</TD><TD VALIGN=TOP>-, FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>Notice</TD><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>SID</TD><TD VALIGN=TOP>-, FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>Copyright</TD><TD VALIGN=TOP>12 0</TD><TD VALIGN=TOP>SID</TD><TD VALIGN=TOP>-, FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>FullName</TD><TD VALIGN=TOP>2</TD><TD VALIGN=TOP>SID</TD><TD VALIGN=TOP>-, FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>FamilyName</TD><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>SID</TD><TD VALIGN=TOP>-, FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>Weight</TD><TD VALIGN=TOP>4</TD><TD VALIGN=TOP>SID</TD><TD VALIGN=TOP>-, FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>isFixedPitch</TD><TD VALIGN=TOP>12 1</TD><TD VALIGN=TOP>boolean</TD><TD VALIGN=TOP>0(false), FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>ItalicAngle</TD><TD VALIGN=TOP>12 2</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>0, FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>UnderlinePosition</TD><TD VALIGN=TOP>12 3</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>-100, FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>UnderlineThickness</TD><TD VALIGN=TOP>12 4</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>50, FontInfo</TD></TR>
<TR>
<TD VALIGN=TOP>PaintType</TD><TD VALIGN=TOP>12 5</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>0</TD></TR>
<TR>
<TD VALIGN=TOP>CharstringType</TD><TD VALIGN=TOP>12 6</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>2</TD></TR>
<TR>
<TD VALIGN=TOP>FontMatrix</TD><TD VALIGN=TOP>12 7</TD><TD VALIGN=TOP>array</TD><TD VALIGN=TOP>0.001 0 0 0.001 0 0</TD></TR>
<TR>
<TD VALIGN=TOP>UniqueID</TD><TD VALIGN=TOP>13</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>-</TD></TR>
<TR>
<TD VALIGN=TOP>FontBBox</TD><TD VALIGN=TOP>5</TD><TD VALIGN=TOP>array</TD><TD VALIGN=TOP>-</TD></TR>
<TR>
<TD VALIGN=TOP>StrokeWidth</TD><TD VALIGN=TOP>12 8</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>0</TD></TR>
<TR>
<TD VALIGN=TOP>XUID</TD><TD VALIGN=TOP>14</TD><TD VALIGN=TOP>array</TD><TD VALIGN=TOP>-</TD></TR>
<TR>
<TD VALIGN=TOP>charset</TD><TD VALIGN=TOP>15</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>-, charsetoffset(0)</TD></TR>
<TR>
<TD VALIGN=TOP>Encoding</TD><TD VALIGN=TOP>16</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>0, encodingoffset(0)</TD></TR>
<TR>
<TD VALIGN=TOP>CharStrings</TD><TD VALIGN=TOP>17</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>-, CharStringsoffset(0)</TD></TR>
<TR>
<TD VALIGN=TOP>Private</TD><TD VALIGN=TOP>18</TD><TD VALIGN=TOP>numbernumber</TD><TD VALIGN=TOP>-, PrivateDICTsizeandoffset(0)</TD></TR>
<TR>
<TD VALIGN=TOP>SyntheticBase</TD><TD VALIGN=TOP>12 20</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>-, syntheticbasefontindex</TD></TR>
<TR>
<TD VALIGN=TOP>PostScript</TD><TD VALIGN=TOP>12 21</TD><TD VALIGN=TOP>SID</TD><TD VALIGN=TOP>-, embeddedPostScript</TD></TR>
<TR>
<TD VALIGN=TOP>BaseFontName</TD><TD VALIGN=TOP>12 22</TD><TD VALIGN=TOP>SID</TD><TD VALIGN=TOP>-, Streamer</TD></TR>
<TR>
<TD VALIGN=TOP>BaseFontBlend</TD><TD VALIGN=TOP>12 23</TD><TD VALIGN=TOP>delta</TD><TD VALIGN=TOP>-, Streamer</TABLE>

<P>The embedded PostScript operator provides an escape mechanism that may be used
to address extensibility or compatibility issues in a printer font (see
appendix E).  

<P>The separation of dictionary data into top-level and Private dictionaries
reflects PostScript usage where Top DICT data is parsed at findfont time and
used to construct a valid PostScript font dictionary. The Private operator
value specifies a size and an offset that is followed at font rendering time in
order to construct the data structures associated with Private DICT data.

<P>Multiple master fonts require the following additions to the Top DICT operator
set.<BR>&nbsp; 

<TABLE BGCOLOR="#F0F0F0" width=480  CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Value</TH><TH BGCOLOR="#C0C0C0">Operand(s)</TH><TH BGCOLOR="#C0C0C0">Default,notes
</THEAD><TBODY></TR>
<TR>
<TD VALIGN=TOP>UDV</TD><TD VALIGN=TOP>12 24</TD><TD VALIGN=TOP>array</TD><TD VALIGN=TOP>-</TD></TR>
<TR>
<TD VALIGN=TOP>BlendDesignMap</TD><TD VALIGN=TOP>12 25</TD><TD VALIGN=TOP>array</TD><TD VALIGN=TOP>-</TD></TR>
<TR>
<TD VALIGN=TOP>BlendAxisTypes</TD><TD VALIGN=TOP>12 26</TD><TD VALIGN=TOP>SID array</TD><TD VALIGN=TOP>-</TABLE>

<P>The UDV operator specifies the User Design Vector for the font's default
instance. The strings associated with the BlendAxisTypes array name the axes
of the font. Multiple master fonts are described fully in section 20.

<P>CIDFonts require the following extensions to the Top DICT operator set.<BR>&nbsp;
<TABLE BGCOLOR="#F0F0F0" width=480  CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Value</TH><TH BGCOLOR="#C0C0C0">Operand(s)</TH><TH BGCOLOR="#C0C0C0">Default,notes
</THEAD><TBODY></TR>
<TR>
<TD VALIGN=TOP>ROS</TD><TD VALIGN=TOP>12 30</TD><TD VALIGN=TOP>SID SID number</TD><TD VALIGN=TOP>-, Registry Ordering Supplement</TD></TR>
<TR>
<TD VALIGN=TOP>CIDFontVersion</TD><TD VALIGN=TOP>12 31</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>0</TD></TR>
<TR>
<TD VALIGN=TOP>CIDFontRevision</TD><TD VALIGN=TOP>12 32</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>0</TD></TR>
<TR>
<TD VALIGN=TOP>CIDFontType</TD><TD VALIGN=TOP>12 33</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>0</TD></TR>
<TR>
<TD VALIGN=TOP>CIDCount</TD><TD VALIGN=TOP>12 34</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>8720</TD></TR>
<TR>
<TD VALIGN=TOP>UIDBase</TD><TD VALIGN=TOP>12 35</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>-</TD></TR>
<TR>
<TD VALIGN=TOP>FDArray</TD><TD VALIGN=TOP>12 36</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>-, Font DICT (FD) INDEX offset (0)</TD></TR>
<TR>
<TD VALIGN=TOP>FDIndex</TD><TD VALIGN=TOP>12 37</TD><TD VALIGN=TOP>number</TD><TD VALIGN=TOP>-, FDIndex offset (0)</TD></TR>
<TR>
<TD VALIGN=TOP>FontName</TD><TD VALIGN=TOP>12 38</TD><TD VALIGN=TOP>SID</TD><TD VALIGN=TOP>-, FD FontName</TABLE>

<P>The ROS operator combines the Registry, Ordering, and Supplement keys together.
CIDFonts are described fully in section 21.

<P>Chameleon fonts require the following addition to the Top DICT operator set.<BR>&nbsp;

<TABLE BGCOLOR="#F0F0F0" width=480  CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Value</TH><TH BGCOLOR="#C0C0C0">Operand(s)</TH><TH BGCOLOR="#C0C0C0">Default,notes
</THEAD><TBODY></TR>
<TR>
<TD VALIGN=TOP>Chameleon</TD><TD VALIGN=TOP>12 39</TD><TD VALIGN=TOP>none</TD><TD VALIGN=TOP>-</TABLE>

<P>The Chameleon operator simply serves to identify Chameleon fonts. Chameleon
fonts use the Private operator to size and locate a Chameleon font descriptor
rather than a Private DICT.

<P>The Top DICT begins with the SyntheticBase, UDV, ROS, and Chameleon operators
for synthetic, multiple master, CIDFonts, and Chameleon fonts respectively.
Single master fonts begin with some other operator. (This permits the
determination of the kind of font without parsing the entire Top DICT.)

<H2>10. String INDEX</H2>

<P>All the strings, with the exception of FontName and CIDFontName strings which
appear in the Name INDEX, used by different fonts within the FontSet are
collected together into an INDEX structure and are referenced by a 2-byte
unsigned number called a string identifier or SID. Only unique strings are
stored in the table thereby removing duplication across fonts. Further space
saving is obtained by allocating commonly occurring strings to predefined
SIDs. These strings, known as the standard strings, describe all the names used
in the ISOAdobe and Expert charsets along with a few other strings common to
Type 1 fonts. A complete list of standard strings is given in appendix A.

<P>The client program will contain a array of standard strings with nStdStrings
elements. Thus, the standard strings take SIDs in the range 0 to
nStdStrings-1. The first string in the String INDEX corresponds to the SID
whose value is equal to nStdStrings, the first non-standard string, and so
on. When the client needs to determine the string that corresponds to a
particular SID it performs the following: test if SID is in standard range then
fetch from internal table, otherwise, fetch string from the String INDEX using
a value of SID-nStdStrings.

<P>Since an SID is a 2-byte unsigned number the string table has limit of
65536-nStdStrings unique strings.

<P>A FontSet with zero non-standard strings is represented by an empty INDEX.

<H2>11. Glyph Organization</H2>

<P>The glyphs within a font constitute a charset and are accessed via an encoding.
An encoding is an array of codes associated with some or all glyphs in a font
and a charset is an array of "names" for all glyphs in the font. (In CFF these
names are actually SIDs or CIDs.) 

<P>In order to understand how charsets, encodings, and glyphs are related in CFF
it is useful to think of them as 3 "parallel" arrays that are indexed in
unison. Thus, it is possible to name and encode the glyph at given index or
glyph id (GID) by using the GID to index the charset and encoding arrays,
respectively.

<P>By definition the first glyph (GID 0) is ".notdef" and must be present in all
fonts. Since this is always the case, it is not necessary to represent either
the encoding (unencoded) or name (.notdef) for GID 0. Consequently, taking
advantage of this optimization, the encoding and charset arrays always begin
with GID 1.

<H2>12. Encodings</H2>

<P>Encoding data is located via the offset operand to the Encoding operator in the
Top DICT. Each encoding is described by a format-type identifier byte followed
by format-specific data. Two formats are currently defined.

<H3>Format 0</H3><BR>&nbsp;

<TABLE BGCOLOR="#F0F0F0" width=480  CELLPADDING=3>
<THEAD>
<TR>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -