📄 otff.htm
字号:
<HTML>
<HEAD>
<TITLE>The Opentype Font File</TITLE>
<STYLE>
<!--
BODY {background: #FFFFFF; link: #000080}
H1 {font-size: 24pt; color: #c60029}
H2 {font-size: 18pt; color: black}
H3 {font-size: 16pt; color: black}
H4 {font-size: 14pt; color: black}
CAPTION {font-size: 16pt; font-weight: Bold}
A:link {text-decoration: none}
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000080">
<TABLE WIDTH=480 CELLPADDING=8 CELLSPACING=0 BORDER=0>
<TR><TD><IMG WIDTH=100 HEIGHT=1 ALT="" SRC="/truetype/otspec/pixel.gif" BORDER=0></TD>
<TD><H1>Developing OpenType</H1></TD>
</TR>
<TR><TD></TD><TD ALIGN=TOP>
<H2>The OpenType Font File</H2>
<P>
An OpenType font file contains data, in table format, that comprises
either a TrueType or a PostScript outline font. The rasterizer uses combinations of data from different tables to render the glyph data in the font.
<P>
<H3>Data Types</H3>
<P>
The following data types are used in the OpenType
font file. All OpenType fonts use Motorola-style byte ordering
(Big Endian):
<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR>
<TH ALIGN=LEFT BGCOLOR="#C0C0C0">Data Type</TH><TH ALIGN=LEFT BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD><TBODY><TR>
<TR>
<TD VALIGN=TOP>BYTE</TD><TD VALIGN=TOP>8-bit unsigned integer.</TD></TR>
<TR>
<TD VALIGN=TOP>CHAR</TD><TD VALIGN=TOP>8-bit signed integer.</TD></TR>
<TR>
<TD VALIGN=TOP>USHORT</TD><TD VALIGN=TOP>16-bit unsigned integer.</TD></TR>
<TR>
<TD VALIGN=TOP>SHORT</TD><TD VALIGN=TOP>16-bit signed integer.</TD></TR>
<TR>
<TD VALIGN=TOP>ULONG</TD><TD VALIGN=TOP>32-bit unsigned integer.</TD></TR>
<TR>
<TD VALIGN=TOP>LONG</TD><TD VALIGN=TOP>32-bit signed integer.</TD></TR>
<TR>
<TD VALIGN=TOP>FIXED</TD><TD VALIGN=TOP>32-bit signed fixed-point number (16.16)</TD></TR>
<TR>
<TD VALIGN=TOP>FUNIT</TD><TD VALIGN=TOP>Smallest measurable distance in the em space.</TD></TR>
<TR>
<TD VALIGN=TOP>FWORD</TD><TD VALIGN=TOP>16-bit signed integer (SHORT) that describes a quantity in FUnits.</TD></TR>
<TR>
<TD VALIGN=TOP>UFWORD</TD><TD VALIGN=TOP>Unsigned 16-bit integer (USHORT) that describes a quantity in FUnits. </TD></TR>
<TR>
<TD VALIGN=TOP>F2DOT14</TD><TD VALIGN=TOP>16-bit signed fixed number with the low 14 bits of fraction (2.14).</TD></TR>
</TABLE> <P>
Most tables have version numbers, and the
version number for the entire font is contained in the Table Directory. Note that there are two different version number
types, each with its own numbering scheme. USHORT version numbers
always start at zero (0). Fixed version numbers always start
at one (1.0 or 0x00010000).
<P>
The Fixed point format consists of a signed,
2's complement mantissa and an unsigned fraction. To compute the
actual value, take the mantissa and add the fraction. Examples
of 2.14 values are:
<P>
<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR>
<TH ALIGN=LEFT BGCOLOR="#C0C0C0">Decimal Value
<TH ALIGN=LEFT BGCOLOR="#C0C0C0">Hex Value</TH><TH ALIGN=LEFT BGCOLOR="#C0C0C0">Mantissa</TH><TH ALIGN=LEFT BGCOLOR="#C0C0C0">Fraction</TH></TR>
</THEAD><TBODY><TR>
<TR>
<TD VALIGN=TOP>1.999939</TD><TD VALIGN=TOP>0x7fff</TD>
<TD VALIGN=TOP>1</TD><TD VALIGN=TOP>16383/16384</TD></TR>
<TR>
<TD VALIGN=TOP>1.75</TD><TD VALIGN=TOP>0x7000</TD>
<TD VALIGN=TOP>1</TD><TD VALIGN=TOP>0/16384</TD></TR>
<TR>
<TD VALIGN=TOP>0.000061</TD><TD VALIGN=TOP>0x0001</TD>
<TD VALIGN=TOP>0</TD><TD VALIGN=TOP>1/16384</TD></TR>
<TR>
<TD VALIGN=TOP>0.0</TD><TD VALIGN=TOP>0x0000</TD>
<TD VALIGN=TOP>0</TD><TD VALIGN=TOP>0/16384</TD></TR>
<TR>
<TD VALIGN=TOP>-0.000061</TD><TD VALIGN=TOP>0xffff</TD>
<TD VALIGN=TOP>-1</TD><TD VALIGN=TOP>16383/16384</TD></TR>
<TR>
<TD VALIGN=TOP>-2.0</TD><TD VALIGN=TOP>0x8000</TD>
<TD VALIGN=TOP>-2</TD><TD VALIGN=TOP>0/16384</TD></TR>
</TABLE>
<H2>Organization of an OpenType Font</H2>
<p>A key characteristic of the OpenType format is the TrueType sfnt "wrapper", which provides organization for a collection of tables in a general and extensible manner.
<P>
The OpenType font file begins at byte 0 with
the Offset Table.
<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Type</TH>
<TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP>Fixed</TD><TD VALIGN=TOP>sfnt version</TD>
<TD VALIGN=TOP>0x00010000 for version 1.0.</TD></TR>
<TR>
<TD VALIGN=TOP>USHORT </TD><TD VALIGN=TOP>numTables</TD>
<TD VALIGN=TOP>Number of tables. </TD></TR>
<TR>
<TD VALIGN=TOP>USHORT </TD><TD VALIGN=TOP>searchRange</TD>
<TD VALIGN=TOP>(Maximum power of 2 <= numTables) x 16.</TD></TR>
<TR>
<TD VALIGN=TOP>USHORT </TD><TD VALIGN=TOP>entrySelector</TD>
<TD VALIGN=TOP>Log2(maximum power of 2 <= numTables).</TD></TR>
<TR>
<TD VALIGN=TOP>USHORT </TD><TD VALIGN=TOP>rangeShift</TD>
<TD VALIGN=TOP>NumTables x 16-searchRange.</TD></TR>
</TABLE> <P>
<P>
OpenType fonts will continue to use the value of 1.0 for the sfnt version number.
<P>
The Offset Table is followed at byte 12 by the Table Directory
entries. Entries in the Table Directory must be sorted in ascending
order by tag. Offset values in the Table Directory
are measured from the start of the font file.
<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR>
<TH ALIGN=LEFT BGCOLOR="#C0C0C0">Type
<TH ALIGN=LEFT BGCOLOR="#C0C0C0">Name</TH><TH ALIGN=LEFT BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD><TBODY><TR>
<TR>
<TD VALIGN=TOP>ULONG</TD><TD VALIGN=TOP>tag</TD>
<TD VALIGN=TOP>4 -byte identifier.</TD></TR>
<TR>
<TD VALIGN=TOP>ULONG</TD><TD VALIGN=TOP>checkSum</TD>
<TD VALIGN=TOP>CheckSum for this table.</TD></TR>
<TR>
<TD VALIGN=TOP>ULONG</TD><TD VALIGN=TOP>offset</TD>
<TD VALIGN=TOP>Offset from beginning of TrueType font file.</TD></TR>
<TR>
<TD VALIGN=TOP>ULONG</TD><TD VALIGN=TOP>length</TD>
<TD VALIGN=TOP>Length of this table.</TD></TR>
</TABLE> <P>
<P>
The Table Directory makes it possible for
a given font to contain only those tables it actually needs. As
a result there is no standard value for numTables.
<P>
Tags are the names given to tables in the OpenType font file.
All tag names consist of four characters. Names with less than four letters are allowed
if followed by the necessary trailing spaces.
Table checksums are the unsigned sum of the
longs of a given table. In C, the following function can be used
to determine a checksum:
<PRE><TT>ULONG
CalcTableChecksum(ULONG *Table, ULONG Length)
{
ULONG Sum = 0L;
ULONG *Endptr = Table+((Length+3) & ~3) / sizeof(ULONG);
while (Table < EndPtr)
Sum += *Table++;
return Sum;
}</TT></PRE>
<P>
<CITE>Note: This function implies that the length
of a table must be a multiple of four bytes. While this is not
a requirement for the TrueType scaler itself, it is suggested
that all tables begin on four byte boundries, and pad any remaining
space between tables with zeros. The length of all tables should
be recorded in the table directory with their actual length.</CITE>
<P>
<H3>Font Tables</H3>
<P>
The rasterizer has a much easier time traversing tables if they
are padded so that each table begins on a 4-byte boundary. It
is highly recommended that all tables be long aligned and padded
with zeroes.
<p>
For OpenType fonts based on TrueType outlines, the following tables are used:
<BR> <BR><FONT SIZE=5>Tables Related to TrueType Outlines</FONT>
<TABLE width=350 BGCOLOR="#F0F0F0" CELLPADDING=2>
<THEAD>
<TR><TH ALIGN=LEFT BGCOLOR="#c0c0c0">Tag</TH><TH ALIGN=LEFT BGCOLOR="#C0C0C0">Name</TH></TR>
</THEAD>
<TBODY>
<TR>
<TD VALIGN=TOP><A HREF="/truetype/otspec/cvt.htm">cvt</A></TD><TD VALIGN=TOP>Control Value Table</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/fpgm.htm">fpgm</A></TD><TD VALIGN=TOP>Font program</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/glyf.htm">glyf</A></TD><TD VALIGN=TOP>Glyph data</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/loca.htm">loca</A></TD><TD VALIGN=TOP>Index to location</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/maxp.htm">maxp</A></TD><TD VALIGN=TOP>Maximum profile</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/prep.htm">prep</A></TD><TD VALIGN=TOP>CVT Program</TD></TR>
</TABLE> <P>
<P>
The PostScript font extensions define a new set of tables containing data
specific to PostScript fonts that are used instead of the tables listed above.<BR>
<BR> <BR><FONT SIZE=5>Tables Related to PostScript Outlines</FONT>
<TABLE WIDTH=350 BGCOLOR="#F0F0F0" CELLPADDING=2><THEAD>
<TR>
<TH BGCOLOR="#c0c0c0">Tag</TH><TH BGCOLOR="#C0C0C0">Name</TH></TR>
</THEAD>
<TBODY>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/cff.htm">CFF</A></TD><TD VALIGN=TOP>PostScript font program (compact font format)</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/fvar.htm">fvar</A></TD><TD VALIGN=TOP>Apple's font variations table</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/mmsd.htm">MMSD</A></TD><TD VALIGN=TOP>Multiple master supplementary data</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/mmfx.htm">MMFX</A></TD><TD VALIGN=TOP>Multiple master font metrics</TD></TR>
</TABLE> <P>
Whether TrueType or PostScript outlines are used in an OpenType font, the following tables are required for the font to function correctly:
<BR> <BR><FONT SIZE=5>Required Tables</FONT>
<TABLE width=350 BGCOLOR="#F0F0F0" CELLPADDING=2>
<THEAD>
<TR>
<TH ALIGN=LEFT BGCOLOR="#c0c0c0">Tag</TH><TH ALIGN=LEFT BGCOLOR="#C0C0C0">Name</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/cmap.htm">cmap</A></TD><TD VALIGN=TOP>Character to glyph mapping</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/dsig.htm">DSIG</A></TD><TD VALIGN=TOP>Digital signature</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/head.htm">head</A></TD><TD VALIGN=TOP>Font header</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/hhea.htm">hhea</A></TD><TD VALIGN=TOP>Horizontal header</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/hmtx.htm">hmtx</A></TD><TD VALIGN=TOP>Horizontal metrics</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/name.htm">name</A></TD><TD VALIGN=TOP>Naming table</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/os2.htm">OS/2</A></TD><TD VALIGN=TOP>OS/2 and Windows specific metrics</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/post.htm">post</A></TD><TD VALIGN=TOP>PostScript information</TD></TR>
</TABLE>
<P>
There are also several optional tables that support vertical layout as well as other advanced typographic functions:<BR>
<BR> <BR><FONT SIZE=5>Advanced Typographic Tables</FONT>
<TABLE width=350 BGCOLOR="#F0F0F0" CELLPADDING=2><THEAD>
<TR>
<TH ALIGN=LEFT BGCOLOR="#c0c0c0">Tag</TH><TH ALIGN=LEFT BGCOLOR="#C0C0C0">Name</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/base.htm">BASE</A></TD><TD VALIGN=TOP>Baseline data</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/gdef.htm">GDEF</A></TD><TD VALIGN=TOP>Glyph definition data</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/gpos.htm">GPOS</A></TD><TD VALIGN=TOP>Glyph positioning data</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/gsub.htm">GSUB</A></TD><TD VALIGN=TOP>Glyph substitution data</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/jstf.htm">JSTF</A></TD><TD VALIGN=TOP>Justification data</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/vhea.htm">vhea</A></TD><TD VALIGN=TOP>Vertical Metrics header</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/vmtx.htm">vmtx</A></TD><TD VALIGN=TOP>Vertical Metrics</TD></TR>
</TABLE> <P>
<P>
OpenType fonts may also contain bitmaps of glyphs, in addition to outlines. Hand-tuned bitmaps have been especially useful in TrueType fonts for very small sizes of complex glyphs. If a bitmap for a particular size is provided in a font, it will be used by the system instead of the outline when rendering the glyph.
<BR> <BR><FONT SIZE=5>Tables Related to Bitmap Glyphs</FONT>
<TABLE width=350 BGCOLOR="#F0F0F0" CELLPADDING=2><THEAD>
<TR>
<TH ALIGN=LEFT BGCOLOR="#c0c0c0">Tag</TH><TH ALIGN=LEFT BGCOLOR="#C0C0C0">Name</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/ebdt.htm">EBDT</A></TD><TD VALIGN=TOP>Embedded bitmap data</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/eblc.htm">EBLC</A></TD><TD VALIGN=TOP>Embedded bitmap location data</TD></TR>
<TR>
<TD VALIGN=TOP><A HREF="/TRUETYPE/OTSPEC/ebsc.htm">EBSC</A></TD><TD VALIGN=TOP>Embedded bitmap scaling data</TD></TR>
</TABLE> <P>
<br> <br>
<FONT FACE="Arial, Helvetica" SIZE=1>
Microsoft Typography Web Site <A HREF="/truetype/otspec/CPYRIGHT.htm">© 1996 Microsoft Corporation</A>
<BR>
Comments to the Microsoft Typography group: <A HREF="mailto:ttwsite@microsoft.com">ttwsite@microsoft.com</A>
<BR>
<A HREF="/truetype/default.htm">Home</a> | <a href="/truetype/creators.htm">Information for Developers</a>
<BR>
Last updated 05 September 1996
</FONT>
</TABLE>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -