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

@ -96,7 +96,7 @@ def merge_PrivateDicts(top_dicts, vsindex_dict, var_model, fd_map):
* step through each key in FontDict.Private. * step through each key in FontDict.Private.
* For each key, step through each relevant source font Private dict, and * For each key, step through each relevant source font Private dict, and
build a list of values to blend. build a list of values to blend.
The 'relevant' source fonts are selected by first getting the right The 'relevant' source fonts are selected by first getting the right
submodel using ``vsindex_dict[vsindex]``. The indices of the submodel using ``vsindex_dict[vsindex]``. The indices of the

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,7 +164,9 @@ 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.:
{'wght': 400, 'wdth': 100} .. code-block::
{'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
input varfont is modified and reduced to a static font. input varfont is modified and reduced to a static font.