cff
- fontTools.varLib.cff.merge_PrivateDicts(top_dicts, vsindex_dict, var_model, fd_map)[source]
I step through the FontDicts in the FDArray of the varfont TopDict. For each varfont FontDict:
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.
The ‘relevant’ source fonts are selected by first getting the right submodel using
vsindex_dict[vsindex]
. The indices of thesubModel.locations
are mapped to source font list indices by assuming the latter order is the same as the order of thevar_model.locations
. I can then get the index of each subModel location in the list ofvar_model.locations
.
- fontTools.varLib.cff.getfd_map(varFont, fonts_list)[source]
Since a subset source font may have fewer FontDicts in their FDArray than the default font, we have to match up the FontDicts in the different fonts . We do this with the FDSelect array, and by assuming that the same glyph will reference matching FontDicts in each source font. We return a mapping from fdIndex in the default font to a dictionary which maps each master list index of each region font to the equivalent fdIndex in the region font.
- class fontTools.varLib.cff.CVarData(varDataList, masterSupports, vsindex_dict)
Bases:
tuple
- masterSupports
Alias for field number 1
- varDataList
Alias for field number 0
- vsindex_dict
Alias for field number 2
- class fontTools.varLib.cff.CFFToCFF2OutlineExtractor(pen, localSubrs, globalSubrs, nominalWidthX, defaultWidthX, private=None, blender=None)[source]
Bases:
T2OutlineExtractor
This class is used to remove the initial width from the CFF charstring without trying to add the width to self.nominalWidthX, which is None.
- class fontTools.varLib.cff.MergeOutlineExtractor(pen, localSubrs, globalSubrs, nominalWidthX, defaultWidthX, private=None, blender=None)[source]
Bases:
CFFToCFF2OutlineExtractor
Used to extract the charstring commands - including hints - from a CFF charstring in order to merge it as another set of region data into a CFF2 variable font charstring.
- class fontTools.varLib.cff.CFF2CharStringMergePen(default_commands, glyphName, num_masters, master_idx, roundTolerance=0.01)[source]
Bases:
T2CharStringPen
Pen to merge Type 2 CharStrings.
- reorder_blend_args(commands, get_delta_func)[source]
We first re-order the master coordinate values. For a moveto to lineto, the args are now arranged as:
[ [master_0 x,y], [master_1 x,y], [master_2 x,y] ]
We re-arrange this to:
[ [master_0 x, master_1 x, master_2 x], [master_0 y, master_1 y, master_2 y] ]
If the master values are all the same, we collapse the list to as single value instead of a list.
We then convert this to:
[ [master_0 x] + [x delta tuple] + [numBlends=1] [master_0 y] + [y delta tuple] + [numBlends=1] ]