Beef up TTFont and glyphSet explanations.
This commit is contained in:
parent
ba77dbe696
commit
9f833fe518
@ -16,10 +16,10 @@ unless we need to make a distinction.)
|
|||||||
|
|
||||||
The main entry point for such operations is the :py:mod:`fontTools.ttLib.ttFont`
|
The main entry point for such operations is the :py:mod:`fontTools.ttLib.ttFont`
|
||||||
module, but other modules also provide useful functionality for handling OpenType
|
module, but other modules also provide useful functionality for handling OpenType
|
||||||
fonts.
|
fonts:
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 1
|
||||||
|
|
||||||
ttFont
|
ttFont
|
||||||
|
|
||||||
|
@ -20,21 +20,21 @@ font file, or it may be a member of a
|
|||||||
:class:`.TTCollection`. :class:`.TTFont` objects can also be
|
:class:`.TTCollection`. :class:`.TTFont` objects can also be
|
||||||
constructed from scratch.
|
constructed from scratch.
|
||||||
|
|
||||||
|
|
||||||
|
glyphSets and ttGlyphs
|
||||||
|
----------------------
|
||||||
|
|
||||||
In addition to font-wide data, :mod:`.ttLib.ttFont` provides access to
|
In addition to font-wide data, :mod:`.ttLib.ttFont` provides access to
|
||||||
individual glyphs through a :class:`.TTFont` instance's
|
individual glyphs through a :class:`.TTFont` instance's
|
||||||
``glyphSet[]`` attribute. A ``glyphSet`` is a dict-like object that is
|
``.glyphSet[]`` attribute. A ``.glyphSet`` is a dict-like object that is
|
||||||
indexed by glyph names. Users can use the glyphSet to interact with
|
indexed by glyph names. Users can use the glyphSet to interact with
|
||||||
each glyph's contours, components, points, and glyph metrics.
|
each glyph's contours, components, points, and glyph metrics.
|
||||||
|
|
||||||
|
|
||||||
ttGlyphs
|
|
||||||
--------
|
|
||||||
|
|
||||||
Informally, some fontTools code or documentation will make reference to
|
Informally, some fontTools code or documentation will make reference to
|
||||||
the individual glyphs in a ``glyphSet`` as a "ttGlyph" or the
|
the individual glyphs in a ``.glyphSet`` as a "ttGlyph" or the
|
||||||
like. This is convenient terminology, particularly for
|
like. This is convenient terminology, particularly for
|
||||||
discussion. However, it is important to note that there is not a
|
discussion. However, it is important to note that there is not a
|
||||||
"ttGlyph" class. Instead, the ``glyphSet`` attribute of a
|
"ttGlyph" class. Instead, the ``.glyphSet`` attribute of a
|
||||||
:class:`.TTFont` serves as an abstraction layer that provides a
|
:class:`.TTFont` serves as an abstraction layer that provides a
|
||||||
uniform interface to the glyphs, regardless of whether the
|
uniform interface to the glyphs, regardless of whether the
|
||||||
:class:`.TTFont` instance in use comes from a font file with
|
:class:`.TTFont` instance in use comes from a font file with
|
||||||
@ -43,23 +43,23 @@ containing glyph contours) or a font with PostScript-flavored outlines
|
|||||||
(and, therefore, with a ``CFF`` or ``CFF2`` table containing the glyph
|
(and, therefore, with a ``CFF`` or ``CFF2`` table containing the glyph
|
||||||
contours).
|
contours).
|
||||||
|
|
||||||
Regardless of the flavor, each "ttGlyph" entry in the ``glyphSet``
|
Regardless of the flavor, each "ttGlyph" entry in the ``.glyphSet``
|
||||||
includes the corresponding Bezier outlines and components from the
|
includes the corresponding Bezier outlines and components from the
|
||||||
``glyf`` or ``CFF``/``CFF2`` table and the glyph's metrics. Horizontal
|
``glyf`` or ``CFF``/``CFF2`` table and the glyph's metrics. Horizontal
|
||||||
metrics are drawn from the font's ``hmtx`` table, and vertical metrics
|
metrics are drawn from the font's ``hmtx`` table, and vertical metrics
|
||||||
(if any) are drawn from the ``vmtx`` table. These attributes are:
|
(if any) are drawn from the ``vmtx`` table. These attributes are:
|
||||||
|
|
||||||
width
|
width
|
||||||
The advance width of the glyph
|
The advance width of the glyph
|
||||||
|
|
||||||
lsb
|
lsb
|
||||||
The left sidebearing of the glyph
|
The left sidebearing of the glyph
|
||||||
|
|
||||||
height
|
height
|
||||||
(For vertical-layout fonts) The advance height of the glyph
|
(For vertical-layout fonts) The advance height of the glyph
|
||||||
|
|
||||||
tsb
|
tsb
|
||||||
(for vertical-layout fonts) The top sidebearing of the glyph
|
(for vertical-layout fonts) The top sidebearing of the glyph
|
||||||
|
|
||||||
Note that these attributes do not describe the bounding box of the
|
Note that these attributes do not describe the bounding box of the
|
||||||
glyph filled shape, because the filled area might include negative
|
glyph filled shape, because the filled area might include negative
|
||||||
@ -78,8 +78,8 @@ methods. See the :doc:`pens </pens/index>` package documenation
|
|||||||
for more.
|
for more.
|
||||||
|
|
||||||
|
|
||||||
.. rubric:: Package contents:
|
Package contents
|
||||||
:heading-level: 2
|
----------------
|
||||||
|
|
||||||
|
|
||||||
.. autoclass:: fontTools.ttLib.ttFont.TTFont
|
.. autoclass:: fontTools.ttLib.ttFont.TTFont
|
||||||
|
@ -8,6 +8,11 @@ ttGlyphSet: GlyphSets returned by a TTFont object
|
|||||||
The :mod:`fontTools.ttLib.ttGlyphSet` module is a helper for
|
The :mod:`fontTools.ttLib.ttGlyphSet` module is a helper for
|
||||||
:mod:`fontTools.ttLib`.
|
:mod:`fontTools.ttLib`.
|
||||||
|
|
||||||
|
Most users will not need to access this module directly. Instead, the
|
||||||
|
glyphs in a font are accessible as a ``.glyphSet`` dictionary in a
|
||||||
|
:class:`TTFont` instance.
|
||||||
|
|
||||||
.. automodule:: fontTools.ttLib.ttGlyphSet
|
.. automodule:: fontTools.ttLib.ttGlyphSet
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
|
:private-members:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user