diff --git a/Lib/fontTools/varLib/__init__.py b/Lib/fontTools/varLib/__init__.py
index b428580d6..818c484c4 100644
--- a/Lib/fontTools/varLib/__init__.py
+++ b/Lib/fontTools/varLib/__init__.py
@@ -683,9 +683,11 @@ _DesignSpaceData = namedtuple(
def _add_CFF2(varFont, model, master_fonts):
- from .cff import (convertCFFtoCFF2, merge_region_fonts)
+ from .cff import merge_region_fonts
glyphOrder = varFont.getGlyphOrder()
- convertCFFtoCFF2(varFont)
+ if "CFF2" not in varFont:
+ from .cff import convertCFFtoCFF2
+ convertCFFtoCFF2(varFont)
ordered_fonts_list = model.reorderMasters(master_fonts, model.reverseMapping)
# re-ordering the master list simplifies building the CFF2 data item lists.
merge_region_fonts(varFont, model, ordered_fonts_list, glyphOrder)
@@ -884,7 +886,7 @@ def build(designspace, master_finder=lambda s:s, exclude=[], optimize=True):
_merge_TTHinting(vf, model, master_fonts)
if 'GSUB' not in exclude and ds.rules:
_add_GSUB_feature_variations(vf, ds.axes, ds.internal_axis_supports, ds.rules, ds.rulesProcessingLast)
- if 'CFF2' not in exclude and 'CFF ' in vf:
+ if 'CFF2' not in exclude and ('CFF ' in vf or 'CFF2' in vf):
_add_CFF2(vf, model, master_fonts)
if "post" in vf:
# set 'post' to format 2 to keep the glyph names dropped from CFF2
diff --git a/Lib/fontTools/varLib/cff.py b/Lib/fontTools/varLib/cff.py
index 967fde7c5..7915272d6 100644
--- a/Lib/fontTools/varLib/cff.py
+++ b/Lib/fontTools/varLib/cff.py
@@ -266,6 +266,12 @@ def merge_PrivateDicts(top_dicts, vsindex_dict, var_model, fd_map):
private_dict.rawDict[key] = dataList
+def _cff_or_cff2(font):
+ if "CFF " in font:
+ return font["CFF "]
+ return font["CFF2"]
+
+
def getfd_map(varFont, fonts_list):
""" Since a subset source font may have fewer FontDicts in their
FDArray than the default font, we have to match up the FontDicts in
@@ -278,7 +284,7 @@ def getfd_map(varFont, fonts_list):
default_font = fonts_list[0]
region_fonts = fonts_list[1:]
num_regions = len(region_fonts)
- topDict = default_font['CFF '].cff.topDictIndex[0]
+ topDict = _cff_or_cff2(default_font).cff.topDictIndex[0]
if not hasattr(topDict, 'FDSelect'):
# All glyphs reference only one FontDict.
# Map the FD index for regions to index 0.
@@ -294,7 +300,7 @@ def getfd_map(varFont, fonts_list):
fd_map[fdIndex] = {}
for ri, region_font in enumerate(region_fonts):
region_glyphOrder = region_font.getGlyphOrder()
- region_topDict = region_font['CFF '].cff.topDictIndex[0]
+ region_topDict = _cff_or_cff2(region_font).cff.topDictIndex[0]
if not hasattr(region_topDict, 'FDSelect'):
# All the glyphs share the same FontDict. Pick any glyph.
default_fdIndex = gname_mapping[region_glyphOrder[0]]
@@ -313,7 +319,7 @@ CVarData = namedtuple('CVarData', 'varDataList masterSupports vsindex_dict')
def merge_region_fonts(varFont, model, ordered_fonts_list, glyphOrder):
topDict = varFont['CFF2'].cff.topDictIndex[0]
top_dicts = [topDict] + [
- ttFont['CFF '].cff.topDictIndex[0]
+ _cff_or_cff2(ttFont).cff.topDictIndex[0]
for ttFont in ordered_fonts_list[1:]
]
num_masters = len(model.mapping)
diff --git a/Tests/varLib/data/TestCFF2Input.designspace b/Tests/varLib/data/TestCFF2Input.designspace
new file mode 100644
index 000000000..ebbf14aa1
--- /dev/null
+++ b/Tests/varLib/data/TestCFF2Input.designspace
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/varLib/data/master_cff2_input/TestCFF2_Black.ttx b/Tests/varLib/data/master_cff2_input/TestCFF2_Black.ttx
new file mode 100644
index 000000000..22f827581
--- /dev/null
+++ b/Tests/varLib/data/master_cff2_input/TestCFF2_Black.ttx
@@ -0,0 +1,510 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source Code Variable
+
+
+ Regular
+
+
+ 1.010;ADBO;SourceCode_Black
+
+
+ Source Code Variable
+
+
+ Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
+
+
+ SourceCode_Black
+
+
+ Roman Master 2
+
+
+ Source Code Variable
+
+
+ Regular
+
+
+ 1.010;ADBO;SourceCode_Black
+
+
+ Source Code Variable
+
+
+ Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
+
+
+ SourceCode_Black
+
+
+ Roman Master 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 24 0 rmoveto
+ 552 0 rlineto
+ 0 660 rlineto
+ -552 0 rlineto
+ 0 -660 rlineto
+ 212 104 rmoveto
+ 26 56 rlineto
+ 36 96 rlineto
+ 4 0 rlineto
+ 36 -96 rlineto
+ 26 -56 rlineto
+ -128 0 rlineto
+ -100 68 rmoveto
+ 0 336 rlineto
+ 82 -168 rlineto
+ -82 -168 rlineto
+ 162 252 rmoveto
+ -40 96 rlineto
+ -18 36 rlineto
+ 120 0 rlineto
+ -18 -36 rlineto
+ -40 -96 rlineto
+ -4 0 rlineto
+ 84 -84 rmoveto
+ 82 168 rlineto
+ 0 -336 rlineto
+ -82 168 rlineto
+
+
+ 0 0 rmoveto
+ 176 0 rlineto
+ 73 316 rlineto
+ 14 62 17 78 14 66 rrcurveto
+ 4 0 rlineto
+ 14 -66 19 -78 14 -62 rrcurveto
+ 73 -316 rlineto
+ 182 0 rlineto
+ -196 650 rlineto
+ -208 0 rlineto
+ -196 -650 rlineto
+ 141 138 rmoveto
+ 316 0 rlineto
+ 0 133 rlineto
+ -316 0 rlineto
+ 0 -133 rlineto
+
+
+ 214 0 rmoveto
+ 172 0 rlineto
+ 0 506 rlineto
+ 187 0 rlineto
+ 0 144 rlineto
+ -546 0 rlineto
+ 0 -144 rlineto
+ 187 0 rlineto
+ 0 -506 rlineto
+
+
+ -107 260 39 rmoveto
+ -65 0 -28 11 -49 24 rrcurveto
+ 89 -53 rlineto
+ -15 89 rlineto
+ -9 52 -22 18 -43 0 rrcurveto
+ -26 0 -27 -14 -14 -38 rrcurveto
+ 0 -90 71 -54 139 0 rrcurveto
+ 163 0 99 84 0 117 rrcurveto
+ 0 98 -58 68 -142 45 rrcurveto
+ -33 10 rlineto
+ -72 22 -24 24 0 49 rrcurveto
+ 0 61 47 23 67 0 rrcurveto
+ 42 0 27 -4 52 -24 rrcurveto
+ -85 47 rlineto
+ 10 -67 rlineto
+ 11 -75 37 -14 39 0 rrcurveto
+ 26 0 29 15 5 41 rrcurveto
+ -8 88 -76 48 -121 0 rrcurveto
+ -158 0 -85 -80 0 -115 rrcurveto
+ 0 -93 66 -69 121 -39 rrcurveto
+ 32 -11 rlineto
+ 80 -28 23 -19 0 -53 rrcurveto
+ 0 -55 -43 -39 -72 0 rrcurveto
+ 64 275 rmoveto
+ 0 417 rlineto
+ -71 0 rlineto
+ 0 -417 rlineto
+ 71 0 rlineto
+ -79 -429 rmoveto
+ 71 0 rlineto
+ 0 429 rlineto
+ -71 0 rlineto
+ 0 -429 rlineto
+
+
+ 292 34 rmoveto
+ 163 0 83 80 0 100 rrcurveto
+ 0 182 -302 -4 0 56 rrcurveto
+ 0 21 18 11 36 0 rrcurveto
+ 55 0 39 -16 52 -32 rrcurveto
+ 84 98 rlineto
+ -53 52 -69 36 -97 0 rrcurveto
+ -141 0 -88 -68 0 -104 rrcurveto
+ 0 -188 302 12 0 -68 rrcurveto
+ 0 -20 -19 -10 -37 0 rrcurveto
+ -61 0 -55 20 -72 40 rrcurveto
+ -74 -116 rlineto
+ 65 -54 101 -28 70 0 rrcurveto
+ -19 -150 rmoveto
+ 160 854 rlineto
+ -100 12 rlineto
+ -160 -854 rlineto
+ 100 -12 rlineto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/varLib/data/master_cff2_input/TestCFF2_ExtraLight.ttx b/Tests/varLib/data/master_cff2_input/TestCFF2_ExtraLight.ttx
new file mode 100644
index 000000000..e3a35f036
--- /dev/null
+++ b/Tests/varLib/data/master_cff2_input/TestCFF2_ExtraLight.ttx
@@ -0,0 +1,510 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source Code Variable
+
+
+ Regular
+
+
+ 1.010;ADBO;SourceCode_ExtraLight
+
+
+ Source Code Variable
+
+
+ Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
+
+
+ SourceCode_ExtraLight
+
+
+ Roman Master 0
+
+
+ Source Code Variable
+
+
+ Regular
+
+
+ 1.010;ADBO;SourceCode_ExtraLight
+
+
+ Source Code Variable
+
+
+ Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
+
+
+ SourceCode_ExtraLight
+
+
+ Roman Master 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 84 0 rmoveto
+ 432 0 rlineto
+ 0 660 rlineto
+ -432 0 rlineto
+ 0 -660 rlineto
+ 48 32 rmoveto
+ 102 176 rlineto
+ 64 106 rlineto
+ 4 0 rlineto
+ 62 -106 rlineto
+ 100 -176 rlineto
+ -332 0 rlineto
+ -10 42 rmoveto
+ 0 536 rlineto
+ 154 -270 rlineto
+ -154 -266 rlineto
+ 176 292 rmoveto
+ -56 92 rlineto
+ -94 168 rlineto
+ 302 0 rlineto
+ -94 -168 rlineto
+ -54 -92 rlineto
+ -4 0 rlineto
+ 26 -26 rmoveto
+ 152 270 rlineto
+ 0 -536 rlineto
+ -152 266 rlineto
+
+
+ 50 0 rmoveto
+ 32 0 rlineto
+ 140 396 rlineto
+ 28 80 24 68 24 82 rrcurveto
+ 4 0 rlineto
+ 24 -82 24 -68 28 -80 rrcurveto
+ 138 -396 rlineto
+ 34 0 rlineto
+ -236 660 rlineto
+ -28 0 rlineto
+ -236 -660 rlineto
+ 102 236 rmoveto
+ 293 0 rlineto
+ 0 28 rlineto
+ -293 0 rlineto
+ 0 -28 rlineto
+
+
+ 284 0 rmoveto
+ 32 0 rlineto
+ 0 632 rlineto
+ 234 0 rlineto
+ 0 28 rlineto
+ -500 0 rlineto
+ 0 -28 rlineto
+ 234 0 rlineto
+ 0 -632 rlineto
+
+
+ -107 245 7 rmoveto
+ -65 0 -39 15 -46 50 rrcurveto
+ 36 -48 rlineto
+ -28 100 rlineto
+ -4 16 -12 4 -11 0 rrcurveto
+ -14 0 -8 -7 -1 -14 rrcurveto
+ 24 -85 61 -51 107 0 rrcurveto
+ 91 0 90 53 0 111 rrcurveto
+ 0 70 -26 66 -134 57 rrcurveto
+ -19 8 rlineto
+ -93 39 -42 49 0 68 rrcurveto
+ 0 91 60 48 88 0 rrcurveto
+ 56 0 35 -14 44 -50 rrcurveto
+ -38 47 rlineto
+ 28 -100 rlineto
+ 6 -15 10 -5 11 0 rrcurveto
+ 14 0 8 7 1 14 rrcurveto
+ -24 88 -67 48 -84 0 rrcurveto
+ -92 0 -82 -51 0 -108 rrcurveto
+ 0 -80 45 -53 92 -42 rrcurveto
+ 37 -17 rlineto
+ 114 -52 26 -46 0 -65 rrcurveto
+ 0 -92 -65 -54 -90 0 rrcurveto
+ 18 327 rmoveto
+ 0 428 rlineto
+ -22 0 rlineto
+ 0 -428 rlineto
+ 22 0 rlineto
+ -22 -449 rmoveto
+ 22 0 rlineto
+ 0 449 rlineto
+ -22 0 rlineto
+ 0 -449 rlineto
+
+
+ 311 34 rmoveto
+ 103 0 88 56 0 94 rrcurveto
+ 0 184 -338 -32 0 142 rrcurveto
+ 0 68 57 44 85 0 rrcurveto
+ 76 0 34 -24 44 -38 rrcurveto
+ 20 20 rlineto
+ -41 38 -45 32 -85 0 rrcurveto
+ -99 0 -78 -54 0 -88 rrcurveto
+ 0 -166 338 28 0 -156 rrcurveto
+ 0 -70 -56 -50 -103 0 rrcurveto
+ -85 0 -66 38 -40 34 rrcurveto
+ -18 -22 rlineto
+ 45 -38 73 -40 91 0 rrcurveto
+ -70 -146 rmoveto
+ 158 860 rlineto
+ -30 4 rlineto
+ -158 -860 rlineto
+ 30 -4 rlineto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/varLib/data/master_cff2_input/TestCFF2_Regular.ttx b/Tests/varLib/data/master_cff2_input/TestCFF2_Regular.ttx
new file mode 100644
index 000000000..bf0a96236
--- /dev/null
+++ b/Tests/varLib/data/master_cff2_input/TestCFF2_Regular.ttx
@@ -0,0 +1,508 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source Code Variable
+
+
+ Regular
+
+
+ 1.010;ADBO;SourceCodeVariable-Roman
+
+
+ Source Code Variable
+
+
+ Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
+
+
+ SourceCodeVariable-Roman
+
+
+ Roman
+
+
+ Source Code Variable
+
+
+ Regular
+
+
+ 1.010;ADBO;SourceCodeVariable-Roman
+
+
+ Source Code Variable
+
+
+ Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
+
+
+ SourceCodeVariable-Roman
+
+
+ Roman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 62 0 rmoveto
+ 476 0 rlineto
+ 0 660 rlineto
+ -476 0 rlineto
+ 0 -660 rlineto
+ 109 59 rmoveto
+ 73 131 rlineto
+ 54 102 rlineto
+ 4 0 rlineto
+ 52 -102 rlineto
+ 73 -131 rlineto
+ -256 0 rlineto
+ -44 52 rmoveto
+ 0 461 rlineto
+ 127 -232 rlineto
+ -127 -229 rlineto
+ 171 277 rmoveto
+ -50 93 rlineto
+ -66 119 rlineto
+ 234 0 rlineto
+ -65 -119 rlineto
+ -49 -93 rlineto
+ -4 0 rlineto
+ 48 -48 rmoveto
+ 126 232 rlineto
+ 0 -461 rlineto
+ -126 229 rlineto
+
+
+ 31 0 rmoveto
+ 86 0 rlineto
+ 115 366 rlineto
+ 23 73 21 72 21 76 rrcurveto
+ 4 0 rlineto
+ 20 -76 22 -72 23 -73 rrcurveto
+ 113 -366 rlineto
+ 90 0 rlineto
+ -221 656 rlineto
+ -96 0 rlineto
+ -221 -656 rlineto
+ 117 199 rmoveto
+ 301 0 rlineto
+ 0 68 rlineto
+ -301 0 rlineto
+ 0 -68 rlineto
+
+
+ 258 0 rmoveto
+ 84 0 rlineto
+ 0 585 rlineto
+ 217 0 rlineto
+ 0 71 rlineto
+ -518 0 rlineto
+ 0 -71 rlineto
+ 217 0 rlineto
+ 0 -585 rlineto
+
+
+ -107 248 35 rmoveto
+ -39 0 -45 5 -46 18 rrcurveto
+ 53 -36 rlineto
+ -17 76 rlineto
+ -12 53 -22 13 -24 0 rrcurveto
+ -22 0 -14 -11 -9 -20 rrcurveto
+ 4 -87 81 -59 107 0 rrcurveto
+ 136 0 82 76 0 107 rrcurveto
+ 0 82 -41 65 -135 47 rrcurveto
+ -38 13 rlineto
+ -71 23 -40 35 0 64 rrcurveto
+ 0 75 57 37 74 0 rrcurveto
+ 30 0 36 -5 42 -17 rrcurveto
+ -52 36 rlineto
+ 17 -76 rlineto
+ 12 -52 25 -14 22 0 rrcurveto
+ 19 0 17 10 8 21 rrcurveto
+ -6 86 -80 60 -101 0 rrcurveto
+ -115 0 -83 -80 0 -102 rrcurveto
+ 0 -100 62 -54 105 -37 rrcurveto
+ 37 -13 rlineto
+ 85 -30 36 -30 0 -63 rrcurveto
+ 0 -74 -53 -42 -82 0 rrcurveto
+ 31 287 rmoveto
+ 0 428 rlineto
+ -40 0 rlineto
+ 0 -428 rlineto
+ 40 0 rlineto
+ -41 -437 rmoveto
+ 40 0 rlineto
+ 0 437 rlineto
+ -40 0 rlineto
+ 0 -437 rlineto
+
+
+ 304 34 rmoveto
+ 125 0 86 65 0 96 rrcurveto
+ 0 183 -324 -21 0 110 rrcurveto
+ 0 50 42 32 67 0 rrcurveto
+ 68 0 36 -21 47 -36 rrcurveto
+ 44 49 rlineto
+ -46 44 -54 33 -89 0 rrcurveto
+ -115 0 -81 -59 0 -94 rrcurveto
+ 0 -174 324 22 0 -124 rrcurveto
+ 0 -51 -42 -35 -78 0 rrcurveto
+ -76 0 -62 31 -52 37 rrcurveto
+ -39 -58 rlineto
+ 52 -43 84 -36 83 0 rrcurveto
+ -51 -147 rmoveto
+ 159 857 rlineto
+ -56 7 rlineto
+ -159 -858 rlineto
+ 56 -6 rlineto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/varLib/varLib_test.py b/Tests/varLib/varLib_test.py
index 545b98e0d..fc56d3106 100644
--- a/Tests/varLib/varLib_test.py
+++ b/Tests/varLib/varLib_test.py
@@ -317,6 +317,28 @@ class BuildTest(unittest.TestCase):
tables = ["fvar", "CFF2"]
self.expect_ttx(varfont, expected_ttx_path, tables)
+ def test_varlib_build_CFF2_from_CFF2(self):
+ ds_path = self.get_test_input('TestCFF2Input.designspace')
+ ttx_dir = self.get_test_input("master_cff2_input")
+ expected_ttx_path = self.get_test_output("BuildTestCFF2.ttx")
+
+ self.temp_dir()
+ for path in self.get_file_list(ttx_dir, '.ttx', 'TestCFF2_'):
+ self.compile_font(path, ".otf", self.tempdir)
+
+ ds = DesignSpaceDocument.fromfile(ds_path)
+ for source in ds.sources:
+ source.path = os.path.join(
+ self.tempdir, os.path.basename(source.filename).replace(".ufo", ".otf")
+ )
+ ds.updatePaths()
+
+ varfont, _, _ = build(ds)
+ varfont = reload_font(varfont)
+
+ tables = ["fvar", "CFF2"]
+ self.expect_ttx(varfont, expected_ttx_path, tables)
+
def test_varlib_build_sparse_CFF2(self):
ds_path = self.get_test_input('TestSparseCFF2VF.designspace')
ttx_dir = self.get_test_input("master_sparse_cff2")