From 23e3ab60f863633e4eb029ccad37fe65083dfa41 Mon Sep 17 00:00:00 2001 From: Nathan Williis Date: Tue, 3 Sep 2024 17:53:56 +0100 Subject: [PATCH] Docs: fix code-example blocks in varLib. --- Lib/fontTools/varLib/__init__.py | 4 ++++ Lib/fontTools/varLib/cff.py | 2 +- Lib/fontTools/varLib/mutator.py | 8 ++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Lib/fontTools/varLib/__init__.py b/Lib/fontTools/varLib/__init__.py index 6d0e00ee1..2c390c11a 100644 --- a/Lib/fontTools/varLib/__init__.py +++ b/Lib/fontTools/varLib/__init__.py @@ -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 a Glyphs source, eg., using noto-source as an example: + .. code-block:: sh + $ fontmake -o ttf-interpolatable -g NotoSansArabic-MM.glyphs Then you can make a variable-font this way: + .. code-block:: sh + $ fonttools varLib master_ufo/NotoSansArabic.designspace API *will* change in near future. diff --git a/Lib/fontTools/varLib/cff.py b/Lib/fontTools/varLib/cff.py index 59ac5c6f7..155429ab5 100644 --- a/Lib/fontTools/varLib/cff.py +++ b/Lib/fontTools/varLib/cff.py @@ -96,7 +96,7 @@ def merge_PrivateDicts(top_dicts, vsindex_dict, var_model, fd_map): * step through each key in FontDict.Private. * 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 submodel using ``vsindex_dict[vsindex]``. The indices of the diff --git a/Lib/fontTools/varLib/mutator.py b/Lib/fontTools/varLib/mutator.py index 6c327f945..80e46bb24 100644 --- a/Lib/fontTools/varLib/mutator.py +++ b/Lib/fontTools/varLib/mutator.py @@ -1,7 +1,9 @@ """ 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 @@ -162,7 +164,9 @@ def instantiateVariableFont(varfont, location, inplace=False, overlap=True): defining the desired location along the variable font's axes. 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 input varfont is modified and reduced to a static font.