xml examples of public.fontInfo

This commit is contained in:
Colin M. Ford 2023-11-28 15:20:20 -05:00
parent 162a4590e0
commit 2d5655cc38

View File

@ -790,7 +790,7 @@ The ``<variable-fonts>`` element contains one or more ``<variable-font>`` elemen
but the design space is sliced at the given location. *Note:* While valid to have a but the design space is sliced at the given location. *Note:* While valid to have a
specific value that doesnt have a matching ``<source>`` at that value, currently there specific value that doesnt have a matching ``<source>`` at that value, currently there
isnt an implentation that supports this. See `this fontmake issue isnt an implentation that supports this. See `this fontmake issue
<https://github.com/googlefonts/fontmake/issues/920>`. <https://github.com/googlefonts/fontmake/issues/920>`_.
.. code:: xml .. code:: xml
@ -842,6 +842,38 @@ Arbitrary data about this variable font.
.. seealso:: :ref:`lib` .. seealso:: :ref:`lib`
Here is an example of using the ``public.fontInfo`` lib key to gain more granular
control over the font info of a variable font, in this case setting some names to
reflect the fact that this is a Narrow variable font subset from the larger designspace.
This lib key allows font info in variable fonts to be more specific than the font
info of the sources.
.. rubric:: Example
.. code:: xml
<variable-font name="MyFontNarrVF">
<axis-subsets>
<axis-subset name="Weight"/>
<axis-subset name="Width" uservalue="75"/>
</axis-subsets>
<lib>
<dict>
<key>public.fontInfo</key>
<dict>
<key>familyName</key>
<string>My Font Narrow VF</string>
<key>styleName</key>
<string>Regular</string>
<key>postscriptFontName</key>
<integer>MyFontNarrVF-Regular</integer>
<key>trademark</key>
<integer>My Font Narrow VF is a registered trademark...</integer>
</dict>
</dict>
</lib>
</variable-font>
Instances included in the variable font Instances included in the variable font
--------------------------------------- ---------------------------------------
@ -989,6 +1021,57 @@ instance directly.
</instances> </instances>
</designspace> </designspace>
Here is an example of using the ``public.fontInfo`` lib key to gain more granular
control over the font info of the instances.
``openTypeNameWWSFamilyName`` and ``openTypeNameWWSSubfamilyName`` are not able to
be set by attributes on the ``<instance>`` element. The ``openTypeOS2WeightClass``
key is superceding the value that would have been set by the ``weight`` axis value.
The ``trademark`` key is superceding the value that would have been set by UFO source
at the origin. If the designer wishes to set name records for other encodings,
platforms or laguages, they should do so using the ``openTypeNameRecords`` key, like
they would in a UFO source.
See `UFO3 fontinfo.plist specification <https://unifiedfontobject.org/versions/ufo3/fontinfo.plist/>`_.
.. code:: xml
<instance familyname="My Font" stylename="Text Light" filename="instances/MyFont-TextLight.ufo" postscriptfontname="MyFont-TextLight" stylemapfamilyname="My Font Text Light" stylemapstylename="regular">
<location>
<dimension name="optical" xvalue="6"/>
<dimension name="weight" xvalue="325"/>
</location>
<lib>
<dict>
<key>public.fontInfo</key>
<dict>
<key>openTypeNameWWSFamilyName</key>
<string>My Font Text</string>
<key>openTypeNameWWSSubfamilyName</key>
<string>Light</string>
<key>openTypeOS2WeightClass</key>
<integer>300</integer>
<key>trademark</key>
<string>My Font Text Light is a registered trademark...</string>
<key>openTypeNameRecords</key>
<array>
<dict>
<key>encodingID</key>
<integer>1</integer>
<key>languageID</key>
<integer>1031</integer>
<key>nameID</key>
<integer>7</integer>
<key>platformID</key>
<integer>3</integer>
<key>string</key>
<string>Meine Schrift Text Leicht ist eine registrierte Marke...</string>
</dict>
</array>
</dict>
</dict>
</lib>
</instance>
``<glyphs>`` element (instance) ``<glyphs>`` element (instance)
------------------------------- -------------------------------