Docs: fix code-example blocks in varLib.

This commit is contained in:
Nathan Williis 2024-09-03 17:53:56 +01:00
parent 4b9cb1030e
commit 23e3ab60f8
3 changed files with 11 additions and 3 deletions

View File

@ -10,10 +10,14 @@ ttf-interpolatable files for the masters and build a variable-font from
them. Such ttf-interpolatable and designspace files can be generated from them. Such ttf-interpolatable and designspace files can be generated from
a Glyphs source, eg., using noto-source as an example: a Glyphs source, eg., using noto-source as an example:
.. code-block:: sh
$ fontmake -o ttf-interpolatable -g NotoSansArabic-MM.glyphs $ fontmake -o ttf-interpolatable -g NotoSansArabic-MM.glyphs
Then you can make a variable-font this way: Then you can make a variable-font this way:
.. code-block:: sh
$ fonttools varLib master_ufo/NotoSansArabic.designspace $ fonttools varLib master_ufo/NotoSansArabic.designspace
API *will* change in near future. API *will* change in near future.

View File

@ -1,7 +1,9 @@
""" """
Instantiate a variation font. Run, eg: Instantiate a variation font. Run, eg:
$ fonttools varLib.mutator ./NotoSansArabic-VF.ttf wght=140 wdth=85 .. code-block:: sh
$ fonttools varLib.mutator ./NotoSansArabic-VF.ttf wght=140 wdth=85
""" """
from fontTools.misc.fixedTools import floatToFixedToFloat, floatToFixed from fontTools.misc.fixedTools import floatToFixedToFloat, floatToFixed
@ -162,6 +164,8 @@ def instantiateVariableFont(varfont, location, inplace=False, overlap=True):
defining the desired location along the variable font's axes. defining the desired location along the variable font's axes.
The location values must be specified as user-space coordinates, e.g.: The location values must be specified as user-space coordinates, e.g.:
.. code-block::
{'wght': 400, 'wdth': 100} {'wght': 400, 'wdth': 100}
By default, a new TTFont object is returned. If ``inplace`` is True, the By default, a new TTFont object is returned. If ``inplace`` is True, the