Skip to content

Commit f16f1b5

Browse files
committed
[css-fonts-4] Port Appendix A from L3
1 parent 0fb88c2 commit f16f1b5

1 file changed

Lines changed: 121 additions & 2 deletions

File tree

css-fonts-4/Overview.bs

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,7 @@ same set of codepoints.
21232123
The associated font might not contain glyphs for the entire set of
21242124
codepoints defined by the 'unicode-range' descriptor. When the font
21252125
is used, the <dfn>effective character map</dfn> is the intersection of the
2126-
codepoints defined by 'unicode-range' with the font's <em>character map</em>.
2126+
codepoints defined by 'unicode-range' with the font's <a>character map</a>.
21272127
This allows authors to define supported ranges in terms of broad
21282128
ranges without worrying about the precise codepoint ranges supported
21292129
by the underlying font.
@@ -4735,7 +4735,126 @@ The <code>fontFamily</code> and <code>basePalette</code> interfaces are parsed a
47354735
<h2 id="platform-props-to-css" class="no-num">
47364736
Appendix A: Mapping platform font properties to CSS properties</h2>
47374737

4738-
Issue: Import from level 3
4738+
4739+
<em>This appendix is included as background for some of the problems and
4740+
situations that are described in other sections. It should be viewed as
4741+
informative only.</em>
4742+
4743+
Font properties in CSS are designed to be
4744+
independent of the underlying font formats used;
4745+
they can be used to specify bitmap fonts,
4746+
Type1 fonts,
4747+
SVG fonts
4748+
in addition to the common TrueType and OpenType fonts.
4749+
But there are facets of the TrueType and OpenType formats
4750+
that often cause confusion for authors
4751+
and present challenges to implementers
4752+
on different platforms.
4753+
4754+
Originally developed at Apple,
4755+
TrueType [[TRUETYPE]] was designed as an outline font format
4756+
for both screen and print.
4757+
Microsoft joined Apple
4758+
in developing the TrueType format
4759+
and both platforms have supported
4760+
TrueType fonts since then.
4761+
Font data in the TrueType format consists of
4762+
a set of tables distinguished with common four-letter tag names,
4763+
each containing a specific type of data.
4764+
For example,
4765+
naming information,
4766+
including copyright and license information,
4767+
is stored in the 'name' table.
4768+
The <a>character map</a> ('cmap') table
4769+
contains a mapping
4770+
of character encodings to glyphs.
4771+
Apple later added additional tables
4772+
for supporting enhanced typographic functionality;
4773+
these are now called Apple Advanced Typography, or AAT, fonts.
4774+
Microsoft and Adobe developed
4775+
a separate set of tables for advanced typography
4776+
and called their format OpenType [[OPENTYPE]].
4777+
The OpenType specification is standardized at ISO as the
4778+
Open Font Format [[OPEN-FONT-FORMAT]].
4779+
4780+
In many cases the font data used under Microsoft Windows
4781+
or Linux
4782+
is slightly different from the data used under Apple's Mac OS X
4783+
because the TrueType format allowed for
4784+
explicit variation across platforms.
4785+
This includes font metrics,
4786+
names and
4787+
<a>character map</a> data.
4788+
4789+
Specifically,
4790+
font family name data is handled differently
4791+
across platforms.
4792+
For TrueType and OpenType fonts
4793+
these names are contained in the 'name' table,
4794+
in name records with name ID 1.
4795+
Multiple names can be stored for different locales,
4796+
but Microsoft recommends fonts
4797+
always include at least a US English version of the name.
4798+
On Windows,
4799+
Microsoft made the decision for backwards compatibility
4800+
to limit this family name to a maximum of four faces;
4801+
for larger groupings the
4802+
"preferred family" (name ID 16) or
4803+
"WWS family" (name ID 21)
4804+
can be used.
4805+
Other platforms such as OSX don't have this limitation,
4806+
so the family name is used to define all possible groupings.
4807+
4808+
Other name table data provides names used
4809+
to uniquely identify a specific face within a family.
4810+
The full font name (name ID 4) and
4811+
the Postscript name (name ID 6)
4812+
describe a single face uniquely.
4813+
For example,
4814+
the bold face of the Gill Sans family
4815+
has a fullname of "Gill Sans Bold" and
4816+
a Postscript name of "GillSans-Bold".
4817+
There can be multiple localized versions of the fullname for a given face,
4818+
but the Postscript name is always a unique name
4819+
made from a limited set of ASCII characters.
4820+
4821+
On various platforms,
4822+
different names are used to search for a font.
4823+
For example,
4824+
with the Windows GDI CreateIndirectFont API,
4825+
either a family or fullname can be used to lookup a face,
4826+
while on Mac OS X the CTFontCreateWithName API call is used
4827+
to lookup a given face
4828+
using the fullname and Postscript name.
4829+
Under Linux,
4830+
the fontconfig API allows
4831+
fonts to be searched using any of these names.
4832+
In situations where platform API's
4833+
automatically substitute other font choices,
4834+
it may be necessary to
4835+
verify a returned font matches a given name.
4836+
4837+
The weight of a given face can be determined
4838+
via the usWeightClass field of the OS/2 table
4839+
or inferred from the style name (name ID 2).
4840+
Likewise, the width can be determined
4841+
via the usWidthClass of the OS/2 table
4842+
or inferred from the style name.
4843+
For historical reasons
4844+
related to synthetic bolding at weights 200 or lower with the Windows GDI API,
4845+
font designers have sometimes skewed values in the OS/2 table
4846+
to avoid these weights.
4847+
4848+
Rendering complex scripts that use contextual shaping
4849+
such as Thai,
4850+
Arabic
4851+
and Devanagari
4852+
requires features present only in OpenType or AAT fonts.
4853+
Currently,
4854+
complex script rendering is supported
4855+
on Windows and Linux using OpenType font features
4856+
while both OpenType and AAT font features are used
4857+
under Mac OS X.
47394858

47404859
<h2 id="priv-sec">
47414860
Security and Privacy Considerations

0 commit comments

Comments
 (0)