Merge pull request #1642 from fonttools/CFF2-fixes

Fixes merge bug when VF source have no blends or no marking glyphs in any charstrings.
This commit is contained in:
Cosimo Lupo 2019-06-17 16:57:16 +01:00 committed by GitHub
commit eda353c4c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 625 additions and 15 deletions

View File

@ -161,7 +161,7 @@ def merge_PrivateDicts(top_dicts, vsindex_dict, var_model, fd_map):
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 model_keys[vsindex]. The indices of the submodel using vsindex_dict[vsindex]. The indices of the
subModel.locations are mapped to source font list indices by subModel.locations are mapped to source font list indices by
assuming the latter order is the same as the order of the assuming the latter order is the same as the order of the
var_model.locations. I can then get the index of each subModel var_model.locations. I can then get the index of each subModel
@ -180,7 +180,7 @@ def merge_PrivateDicts(top_dicts, vsindex_dict, var_model, fd_map):
# At the moment, no PrivateDict has a vsindex key, but let's support # At the moment, no PrivateDict has a vsindex key, but let's support
# how it should work. See comment at end of # how it should work. See comment at end of
# merge_charstrings() - still need to optimize use of vsindex. # merge_charstrings() - still need to optimize use of vsindex.
sub_model, model_keys = vsindex_dict[vsindex] sub_model, _ = vsindex_dict[vsindex]
master_indices = [] master_indices = []
for loc in sub_model.locations[1:]: for loc in sub_model.locations[1:]:
i = var_model.locations.index(loc) - 1 i = var_model.locations.index(loc) - 1
@ -319,6 +319,19 @@ def _get_cs(charstrings, glyphName):
return None return None
return charstrings[glyphName] return charstrings[glyphName]
def _add_new_vsindex(model, key, masterSupports, vsindex_dict,
vsindex_by_key, varDataList):
varTupleIndexes = []
for support in model.supports[1:]:
if support not in masterSupports:
masterSupports.append(support)
varTupleIndexes.append(masterSupports.index(support))
var_data = varLib.builder.buildVarData(varTupleIndexes, None, False)
vsindex = len(vsindex_dict)
vsindex_by_key[key] = vsindex
vsindex_dict[vsindex] = (model, [key])
varDataList.append(var_data)
return vsindex
def merge_charstrings(glyphOrder, num_masters, top_dicts, masterModel): def merge_charstrings(glyphOrder, num_masters, top_dicts, masterModel):
@ -367,24 +380,24 @@ def merge_charstrings(glyphOrder, num_masters, top_dicts, masterModel):
# If the charstring required a new model, create # If the charstring required a new model, create
# a VarData table to go with, and set vsindex. # a VarData table to go with, and set vsindex.
try:
key = tuple(v is not None for v in all_cs) key = tuple(v is not None for v in all_cs)
try:
vsindex = vsindex_by_key[key] vsindex = vsindex_by_key[key]
except KeyError: except KeyError:
varTupleIndexes = [] vsindex = _add_new_vsindex(model, key, masterSupports, vsindex_dict,
for support in model.supports[1:]: vsindex_by_key, varDataList)
if support not in masterSupports:
masterSupports.append(support)
varTupleIndexes.append(masterSupports.index(support))
var_data = varLib.builder.buildVarData(varTupleIndexes, None, False)
vsindex = len(vsindex_dict)
vsindex_by_key[key] = vsindex
vsindex_dict[vsindex] = (model, [key])
varDataList.append(var_data)
# We do not need to check for an existing new_cs.private.vsindex, # We do not need to check for an existing new_cs.private.vsindex,
# as we know it doesn't exist yet. # as we know it doesn't exist yet.
if vsindex != 0: if vsindex != 0:
new_cs.program[:0] = [vsindex, 'vsindex'] new_cs.program[:0] = [vsindex, 'vsindex']
# If there is no variation in any of the charstrings, then vsindex_dict
# never gets built. This could still be needed if there is variation
# in the PrivatDict, so we will build the default data for vsindex = 0.
if not vsindex_dict:
key = (True,) * num_masters
_add_new_vsindex(model, key, masterSupports, vsindex_dict,
vsindex_by_key, varDataList)
cvData = CVarData(varDataList=varDataList, masterSupports=masterSupports, cvData = CVarData(varDataList=varDataList, masterSupports=masterSupports,
vsindex_dict=vsindex_dict) vsindex_dict=vsindex_dict)
# XXX To do: optimize use of vsindex between the PrivateDicts and # XXX To do: optimize use of vsindex between the PrivateDicts and

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<designspace format="3">
<axes>
<axis default="0.0" maximum="1000.0" minimum="0.0" name="weight" tag="wght" />
</axes>
<sources>
<source filename="master_non_marking_cff2/TestNonMarkingCFF2_ExtraLight.ufo" name="master_0">
<lib copy="1" />
<location>
<dimension name="weight" xvalue="0" />
</location>
</source>
<source filename="master_non_marking_cff2/TestNonMarkingCFF2_Regular.ufo" name="master_1">
<location>
<dimension name="weight" xvalue="1000" />
</location>
</source>
</sources>
<instances>
<instance familyname="Test Non Marking CFF2 Roman" postscriptfontname="TestNonMarkingCFF2-ExtraLight" stylename="ExtraLight">
<location>
<dimension name="weight" xvalue="0" />
</location>
<kerning />
<info />
</instance>
<instance familyname="Test Non Marking CFF2 Roman" postscriptfontname="TestNonMarkingCFF2-Regular" stylename="Regular">
<location>
<dimension name="weight" xvalue="1000" />
</location>
<kerning />
<info />
</instance>
</instances>
</designspace>

View File

@ -0,0 +1,233 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="OTTO" ttLibVersion="3.41">
<GlyphOrder>
<!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
<GlyphID id="0" name=".notdef"/>
<GlyphID id="1" name="A"/>
</GlyphOrder>
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="1.01"/>
<checkSumAdjustment value="0xeb345d38"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00000011"/>
<unitsPerEm value="1000"/>
<created value="Thu Nov 29 14:52:09 2018"/>
<modified value="Thu Nov 29 14:52:09 2018"/>
<xMin value="50"/>
<yMin value="-115"/>
<xMax value="550"/>
<yMax value="762"/>
<macStyle value="00000000 00000000"/>
<lowestRecPPEM value="3"/>
<fontDirectionHint value="2"/>
<indexToLocFormat value="0"/>
<glyphDataFormat value="0"/>
</head>
<hhea>
<tableVersion value="0x00010000"/>
<ascent value="984"/>
<descent value="-273"/>
<lineGap value="0"/>
<advanceWidthMax value="600"/>
<minLeftSideBearing value="50"/>
<minRightSideBearing value="50"/>
<xMaxExtent value="550"/>
<caretSlopeRise value="1"/>
<caretSlopeRun value="0"/>
<caretOffset value="0"/>
<reserved0 value="0"/>
<reserved1 value="0"/>
<reserved2 value="0"/>
<reserved3 value="0"/>
<metricDataFormat value="0"/>
<numberOfHMetrics value="5"/>
</hhea>
<maxp>
<tableVersion value="0x5000"/>
<numGlyphs value="5"/>
</maxp>
<OS_2>
<!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
will be recalculated by the compiler -->
<version value="3"/>
<xAvgCharWidth value="578"/>
<usWeightClass value="200"/>
<usWidthClass value="5"/>
<fsType value="00000000 00000000"/>
<ySubscriptXSize value="650"/>
<ySubscriptYSize value="600"/>
<ySubscriptXOffset value="0"/>
<ySubscriptYOffset value="75"/>
<ySuperscriptXSize value="650"/>
<ySuperscriptYSize value="600"/>
<ySuperscriptXOffset value="0"/>
<ySuperscriptYOffset value="350"/>
<yStrikeoutSize value="50"/>
<yStrikeoutPosition value="286"/>
<sFamilyClass value="0"/>
<panose>
<bFamilyType value="2"/>
<bSerifStyle value="11"/>
<bWeight value="3"/>
<bProportion value="9"/>
<bContrast value="3"/>
<bStrokeVariation value="4"/>
<bArmStyle value="3"/>
<bLetterForm value="2"/>
<bMidline value="2"/>
<bXHeight value="4"/>
</panose>
<ulUnicodeRange1 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
<achVendID value="ADBO"/>
<fsSelection value="00000000 00000000"/>
<usFirstCharIndex value="36"/>
<usLastCharIndex value="84"/>
<sTypoAscender value="750"/>
<sTypoDescender value="-250"/>
<sTypoLineGap value="0"/>
<usWinAscent value="984"/>
<usWinDescent value="273"/>
<ulCodePageRange1 value="00000000 00000000 00000000 00000001"/>
<ulCodePageRange2 value="00000000 00000000 00000000 00000000"/>
<sxHeight value="478"/>
<sCapHeight value="660"/>
<usDefaultChar value="0"/>
<usBreakChar value="32"/>
<usMaxContext value="1"/>
</OS_2>
<name>
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True">
Source Code Variable
</namerecord>
<namerecord nameID="2" platformID="1" platEncID="0" langID="0x0" unicode="True">
Regular
</namerecord>
<namerecord nameID="3" platformID="1" platEncID="0" langID="0x0" unicode="True">
1.010;ADBO;SourceCode_ExtraLight
</namerecord>
<namerecord nameID="4" platformID="1" platEncID="0" langID="0x0" unicode="True">
Source Code Variable
</namerecord>
<namerecord nameID="5" platformID="1" platEncID="0" langID="0x0" unicode="True">
Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
</namerecord>
<namerecord nameID="6" platformID="1" platEncID="0" langID="0x0" unicode="True">
SourceCode_ExtraLight
</namerecord>
<namerecord nameID="17" platformID="1" platEncID="0" langID="0x0" unicode="True">
Roman Master 0
</namerecord>
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
Source Code Variable
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
1.010;ADBO;SourceCode_ExtraLight
</namerecord>
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
Source Code Variable
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
</namerecord>
<namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
SourceCode_ExtraLight
</namerecord>
<namerecord nameID="17" platformID="3" platEncID="1" langID="0x409">
Roman Master 0
</namerecord>
</name>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="0" platEncID="3" language="0">
<map code="0x41" name="A"/><!-- LATIN CAPITAL LETTER A -->
</cmap_format_4>
<cmap_format_6 platformID="1" platEncID="0" language="0">
<map code="0x41" name="A"/>
</cmap_format_6>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x41" name="A"/><!-- LATIN CAPITAL LETTER A -->
</cmap_format_4>
</cmap>
<post>
<formatType value="3.0"/>
<italicAngle value="0.0"/>
<underlinePosition value="-75"/>
<underlineThickness value="50"/>
<isFixedPitch value="1"/>
<minMemType42 value="0"/>
<maxMemType42 value="0"/>
<minMemType1 value="0"/>
<maxMemType1 value="0"/>
</post>
<CFF>
<major value="1"/>
<minor value="0"/>
<CFFFont name="SourceCode_ExtraLight">
<version value="1.0"/>
<Notice value="Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries."/>
<Copyright value="Copyright 2010 - 2012 Adobe Systems Incorporated. All Rights Reserved."/>
<FamilyName value="Source Code"/>
<isFixedPitch value="1"/>
<ItalicAngle value="0"/>
<UnderlinePosition value="-100"/>
<UnderlineThickness value="50"/>
<PaintType value="0"/>
<CharstringType value="2"/>
<FontMatrix value="0.001 0 0 0.001 0 0"/>
<FontBBox value="50 -115 550 762"/>
<StrokeWidth value="0"/>
<!-- charset is dumped separately as the 'GlyphOrder' element -->
<Encoding name="StandardEncoding"/>
<Private>
<BlueValues value="-12 0 478 490 570 582 640 652 660 672 722 734"/>
<OtherBlues value="-234 -222"/>
<BlueScale value="0.0625"/>
<BlueShift value="7"/>
<BlueFuzz value="0"/>
<StdHW value="28"/>
<StdVW value="34"/>
<ForceBold value="0"/>
<LanguageGroup value="0"/>
<ExpansionFactor value="0.06"/>
<initialRandomSeed value="0"/>
<defaultWidthX value="600"/>
<nominalWidthX value="597"/>
</Private>
<CharStrings>
<CharString name=".notdef">
endchar
</CharString>
<CharString name="A">
endchar
</CharString>
= </CharStrings>
</CFFFont>
<GlobalSubrs>
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
</GlobalSubrs>
</CFF>
<hmtx>
<mtx name=".notdef" width="600" lsb="84"/>
<mtx name="A" width="600" lsb="50"/>
</hmtx>
</ttFont>

View File

@ -0,0 +1,233 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="OTTO" ttLibVersion="3.41">
<GlyphOrder>
<!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
<GlyphID id="0" name=".notdef"/>
<GlyphID id="1" name="A"/>
</GlyphOrder>
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="1.01"/>
<checkSumAdjustment value="0x60d07155"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00000011"/>
<unitsPerEm value="1000"/>
<created value="Thu Nov 29 14:52:09 2018"/>
<modified value="Thu Nov 29 14:52:09 2018"/>
<xMin value="31"/>
<yMin value="-115"/>
<xMax value="569"/>
<yMax value="751"/>
<macStyle value="00000000 00000000"/>
<lowestRecPPEM value="3"/>
<fontDirectionHint value="2"/>
<indexToLocFormat value="0"/>
<glyphDataFormat value="0"/>
</head>
<hhea>
<tableVersion value="0x00010000"/>
<ascent value="984"/>
<descent value="-273"/>
<lineGap value="0"/>
<advanceWidthMax value="600"/>
<minLeftSideBearing value="31"/>
<minRightSideBearing value="31"/>
<xMaxExtent value="569"/>
<caretSlopeRise value="1"/>
<caretSlopeRun value="0"/>
<caretOffset value="0"/>
<reserved0 value="0"/>
<reserved1 value="0"/>
<reserved2 value="0"/>
<reserved3 value="0"/>
<metricDataFormat value="0"/>
<numberOfHMetrics value="5"/>
</hhea>
<maxp>
<tableVersion value="0x5000"/>
<numGlyphs value="5"/>
</maxp>
<OS_2>
<!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
will be recalculated by the compiler -->
<version value="3"/>
<xAvgCharWidth value="579"/>
<usWeightClass value="400"/>
<usWidthClass value="5"/>
<fsType value="00000000 00000000"/>
<ySubscriptXSize value="650"/>
<ySubscriptYSize value="600"/>
<ySubscriptXOffset value="0"/>
<ySubscriptYOffset value="75"/>
<ySuperscriptXSize value="650"/>
<ySuperscriptYSize value="600"/>
<ySuperscriptXOffset value="0"/>
<ySuperscriptYOffset value="350"/>
<yStrikeoutSize value="50"/>
<yStrikeoutPosition value="291"/>
<sFamilyClass value="0"/>
<panose>
<bFamilyType value="2"/>
<bSerifStyle value="11"/>
<bWeight value="5"/>
<bProportion value="9"/>
<bContrast value="3"/>
<bStrokeVariation value="4"/>
<bArmStyle value="3"/>
<bLetterForm value="2"/>
<bMidline value="2"/>
<bXHeight value="4"/>
</panose>
<ulUnicodeRange1 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
<achVendID value="ADBO"/>
<fsSelection value="00000000 01000000"/>
<usFirstCharIndex value="36"/>
<usLastCharIndex value="84"/>
<sTypoAscender value="750"/>
<sTypoDescender value="-250"/>
<sTypoLineGap value="0"/>
<usWinAscent value="984"/>
<usWinDescent value="273"/>
<ulCodePageRange1 value="00000000 00000000 00000000 00000001"/>
<ulCodePageRange2 value="00000000 00000000 00000000 00000000"/>
<sxHeight value="486"/>
<sCapHeight value="660"/>
<usDefaultChar value="0"/>
<usBreakChar value="32"/>
<usMaxContext value="1"/>
</OS_2>
<name>
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True">
Source Code Variable
</namerecord>
<namerecord nameID="2" platformID="1" platEncID="0" langID="0x0" unicode="True">
Regular
</namerecord>
<namerecord nameID="3" platformID="1" platEncID="0" langID="0x0" unicode="True">
1.010;ADBO;SourceCodeVariable-Roman
</namerecord>
<namerecord nameID="4" platformID="1" platEncID="0" langID="0x0" unicode="True">
Source Code Variable
</namerecord>
<namerecord nameID="5" platformID="1" platEncID="0" langID="0x0" unicode="True">
Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
</namerecord>
<namerecord nameID="6" platformID="1" platEncID="0" langID="0x0" unicode="True">
SourceCodeVariable-Roman
</namerecord>
<namerecord nameID="17" platformID="1" platEncID="0" langID="0x0" unicode="True">
Roman
</namerecord>
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
Source Code Variable
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
1.010;ADBO;SourceCodeVariable-Roman
</namerecord>
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
Source Code Variable
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Version 1.010;hotconv 1.0.109;makeotfexe 2.5.65596
</namerecord>
<namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
SourceCodeVariable-Roman
</namerecord>
<namerecord nameID="17" platformID="3" platEncID="1" langID="0x409">
Roman
</namerecord>
</name>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="0" platEncID="3" language="0">
<map code="0x41" name="A"/><!-- LATIN CAPITAL LETTER A -->
</cmap_format_4>
<cmap_format_6 platformID="1" platEncID="0" language="0">
<map code="0x41" name="A"/>
</cmap_format_6>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x41" name="A"/><!-- LATIN CAPITAL LETTER A -->
</cmap_format_4>
</cmap>
<post>
<formatType value="3.0"/>
<italicAngle value="0.0"/>
<underlinePosition value="-75"/>
<underlineThickness value="50"/>
<isFixedPitch value="1"/>
<minMemType42 value="0"/>
<maxMemType42 value="0"/>
<minMemType1 value="0"/>
<maxMemType1 value="0"/>
</post>
<CFF>
<major value="1"/>
<minor value="0"/>
<CFFFont name="SourceCodeVariable-Roman">
<version value="1.0"/>
<Notice value="Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries."/>
<Copyright value="Copyright 2010 - 2012 Adobe Systems Incorporated. All Rights Reserved."/>
<FamilyName value="Source Code"/>
<isFixedPitch value="1"/>
<ItalicAngle value="0"/>
<UnderlinePosition value="-100"/>
<UnderlineThickness value="50"/>
<PaintType value="0"/>
<CharstringType value="2"/>
<FontMatrix value="0.001 0 0 0.001 0 0"/>
<FontBBox value="31 -115 569 751"/>
<StrokeWidth value="0"/>
<!-- charset is dumped separately as the 'GlyphOrder' element -->
<Encoding name="StandardEncoding"/>
<Private>
<BlueValues value="-12 0 486 498 574 586 638 650 656 668 712 724"/>
<OtherBlues value="-217 -205"/>
<BlueScale value="0.0625"/>
<BlueShift value="7"/>
<BlueFuzz value="0"/>
<StdHW value="67"/>
<StdVW value="85"/>
<ForceBold value="0"/>
<LanguageGroup value="0"/>
<ExpansionFactor value="0.06"/>
<initialRandomSeed value="0"/>
<defaultWidthX value="600"/>
<nominalWidthX value="604"/>
</Private>
<CharStrings>
<CharString name=".notdef">
endchar
</CharString>
<CharString name="A">
endchar
</CharString>
</CharStrings>
</CFFFont>
<GlobalSubrs>
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
</GlobalSubrs>
</CFF>
<hmtx>
<mtx name=".notdef" width="600" lsb="62"/>
<mtx name="A" width="600" lsb="31"/>
</hmtx>
</ttFont>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="OTTO" ttLibVersion="3.42">
<CFF2>
<major value="2"/>
<minor value="0"/>
<CFFFont name="CFF2Font">
<FontMatrix value="0.001 0 0 0.001 0 0"/>
<FDArray>
<FontDict index="0">
<Private>
<BlueValues>
<blend value="-12 0"/>
<blend value="0 0"/>
<blend value="478 8"/>
<blend value="490 0"/>
<blend value="570 -4"/>
<blend value="582 0"/>
<blend value="640 -6"/>
<blend value="652 0"/>
<blend value="660 -2"/>
<blend value="672 0"/>
<blend value="722 -6"/>
<blend value="734 0"/>
</BlueValues>
<OtherBlues>
<blend value="-234 17"/>
<blend value="-222 0"/>
</OtherBlues>
<BlueScale value="0.0625"/>
<BlueShift value="7"/>
<BlueFuzz value="0"/>
<StdHW>
<blend value="28 39.0"/>
</StdHW>
<StdVW>
<blend value="34 51.0"/>
</StdVW>
</Private>
</FontDict>
</FDArray>
<CharStrings>
<CharString name=".notdef">
</CharString>
<CharString name="A">
</CharString>
</CharStrings>
<VarStore Format="1">
<Format value="1"/>
<VarRegionList>
<!-- RegionAxisCount=1 -->
<!-- RegionCount=1 -->
<Region index="0">
<VarRegionAxis index="0">
<StartCoord value="0.0"/>
<PeakCoord value="1.0"/>
<EndCoord value="1.0"/>
</VarRegionAxis>
</Region>
</VarRegionList>
<!-- VarDataCount=1 -->
<VarData index="0">
<!-- ItemCount=0 -->
<NumShorts value="0"/>
<!-- VarRegionCount=1 -->
<VarRegionIndex index="0" value="0"/>
</VarData>
</VarStore>
</CFFFont>
<GlobalSubrs>
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
</GlobalSubrs>
</CFF2>
</ttFont>

View File

@ -228,6 +228,28 @@ class BuildTest(unittest.TestCase):
expected_ttx_name=test_name expected_ttx_name=test_name
) )
def test_varlib_nonmarking_CFF2(self):
ds_path = self.get_test_input('TestNonMarkingCFF2.designspace')
ttx_dir = self.get_test_input("master_non_marking_cff2")
expected_ttx_path = self.get_test_output("TestNonMarkingCFF2.ttx")
self.temp_dir()
for path in self.get_file_list(ttx_dir, '.ttx', 'TestNonMarkingCFF2_'):
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 = ["CFF2"]
self.expect_ttx(varfont, expected_ttx_path, tables)
def test_varlib_build_CFF2(self): def test_varlib_build_CFF2(self):
ds_path = self.get_test_input('TestCFF2.designspace') ds_path = self.get_test_input('TestCFF2.designspace')
ttx_dir = self.get_test_input("master_cff2") ttx_dir = self.get_test_input("master_cff2")
@ -250,7 +272,6 @@ class BuildTest(unittest.TestCase):
tables = ["fvar", "CFF2"] tables = ["fvar", "CFF2"]
self.expect_ttx(varfont, expected_ttx_path, tables) self.expect_ttx(varfont, expected_ttx_path, tables)
def test_varlib_build_sparse_CFF2(self): def test_varlib_build_sparse_CFF2(self):
ds_path = self.get_test_input('TestSparseCFF2VF.designspace') ds_path = self.get_test_input('TestSparseCFF2VF.designspace')
ttx_dir = self.get_test_input("master_sparse_cff2") ttx_dir = self.get_test_input("master_sparse_cff2")
@ -273,7 +294,6 @@ class BuildTest(unittest.TestCase):
tables = ["fvar", "CFF2"] tables = ["fvar", "CFF2"]
self.expect_ttx(varfont, expected_ttx_path, tables) self.expect_ttx(varfont, expected_ttx_path, tables)
def test_varlib_main_ttf(self): def test_varlib_main_ttf(self):
"""Mostly for testing varLib.main() """Mostly for testing varLib.main()
""" """