Merge remote-tracking branch 'origin/master' into partial-instancer
This commit is contained in:
commit
11bfc6856d
@ -530,67 +530,6 @@ def deprecateFunction(msg, category=UserWarning):
|
||||
return decorator
|
||||
|
||||
|
||||
class LastResortLogger(logging.Logger):
|
||||
""" Adds support for 'lastResort' handler introduced in Python 3.2.
|
||||
It allows to print messages to sys.stderr even when no explicit handler
|
||||
was configured.
|
||||
To enable it, you can do:
|
||||
|
||||
import logging
|
||||
logging.lastResort = StderrHandler(logging.WARNING)
|
||||
logging.setLoggerClass(LastResortLogger)
|
||||
"""
|
||||
|
||||
def callHandlers(self, record):
|
||||
# this is the same as Python 3.5's logging.Logger.callHandlers
|
||||
c = self
|
||||
found = 0
|
||||
while c:
|
||||
for hdlr in c.handlers:
|
||||
found = found + 1
|
||||
if record.levelno >= hdlr.level:
|
||||
hdlr.handle(record)
|
||||
if not c.propagate:
|
||||
c = None # break out
|
||||
else:
|
||||
c = c.parent
|
||||
if found == 0:
|
||||
if logging.lastResort:
|
||||
if record.levelno >= logging.lastResort.level:
|
||||
logging.lastResort.handle(record)
|
||||
elif (
|
||||
logging.raiseExceptions
|
||||
and not self.manager.emittedNoHandlerWarning
|
||||
):
|
||||
sys.stderr.write(
|
||||
"No handlers could be found for logger"
|
||||
' "%s"\n' % self.name
|
||||
)
|
||||
self.manager.emittedNoHandlerWarning = True
|
||||
|
||||
|
||||
class StderrHandler(logging.StreamHandler):
|
||||
""" This class is like a StreamHandler using sys.stderr, but always uses
|
||||
whateve sys.stderr is currently set to rather than the value of
|
||||
sys.stderr at handler construction time.
|
||||
"""
|
||||
|
||||
def __init__(self, level=logging.NOTSET):
|
||||
"""
|
||||
Initialize the handler.
|
||||
"""
|
||||
logging.Handler.__init__(self, level)
|
||||
|
||||
@property
|
||||
def stream(self):
|
||||
# the try/execept avoids failures during interpreter shutdown, when
|
||||
# globals are set to None
|
||||
try:
|
||||
return sys.stderr
|
||||
except AttributeError:
|
||||
return __import__("sys").stderr
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
sys.exit(doctest.testmod(optionflags=doctest.ELLIPSIS).failed)
|
||||
|
@ -1987,6 +1987,7 @@ def closure_glyphs(self, s):
|
||||
|
||||
@_add_method(ttLib.getTableClass('MATH'))
|
||||
def closure_glyphs(self, s):
|
||||
if self.table.MathVariants:
|
||||
self.table.MathVariants.closure_glyphs(s)
|
||||
|
||||
@_add_method(otTables.MathItalicsCorrectionInfo)
|
||||
@ -2039,7 +2040,9 @@ def subset_glyphs(self, s):
|
||||
@_add_method(ttLib.getTableClass('MATH'))
|
||||
def subset_glyphs(self, s):
|
||||
s.glyphs = s.glyphs_mathed
|
||||
if self.table.MathGlyphInfo:
|
||||
self.table.MathGlyphInfo.subset_glyphs(s)
|
||||
if self.table.MathVariants:
|
||||
self.table.MathVariants.subset_glyphs(s)
|
||||
return True
|
||||
|
||||
|
@ -513,10 +513,9 @@ class BuilderTest(unittest.TestCase):
|
||||
addOpenTypeFeatures(font, tree)
|
||||
assert "GSUB" in font
|
||||
|
||||
@unittest.skipIf(sys.version_info[0:2] < (3, 4),
|
||||
"assertLogs() was introduced in 3.4")
|
||||
def test_unsupported_subtable_break(self):
|
||||
with self.assertLogs(level='WARNING') as logs:
|
||||
logger = logging.getLogger("fontTools.feaLib.builder")
|
||||
with CapturingLogHandler(logger, level='WARNING') as captor:
|
||||
self.build(
|
||||
"feature test {"
|
||||
" pos a 10;"
|
||||
@ -524,9 +523,10 @@ class BuilderTest(unittest.TestCase):
|
||||
" pos b 10;"
|
||||
"} test;"
|
||||
)
|
||||
self.assertEqual(logs.output,
|
||||
['WARNING:fontTools.feaLib.builder:<features>:1:32: '
|
||||
'unsupported "subtable" statement for lookup type'])
|
||||
|
||||
captor.assertRegex(
|
||||
'<features>:1:32: unsupported "subtable" statement for lookup type'
|
||||
)
|
||||
|
||||
def test_skip_featureNames_if_no_name_table(self):
|
||||
features = (
|
||||
|
@ -6,15 +6,11 @@ from fontTools.misc.loggingTools import (
|
||||
configLogger,
|
||||
ChannelsFilter,
|
||||
LogMixin,
|
||||
StderrHandler,
|
||||
LastResortLogger,
|
||||
_resetExistingLoggers,
|
||||
)
|
||||
import logging
|
||||
import textwrap
|
||||
import time
|
||||
import re
|
||||
import sys
|
||||
import pytest
|
||||
|
||||
|
||||
@ -179,32 +175,3 @@ def test_LogMixin():
|
||||
assert isinstance(b.log, logging.Logger)
|
||||
assert a.log.name == "loggingTools_test.A"
|
||||
assert b.log.name == "loggingTools_test.B"
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info[:2] > (2, 7), reason="only for python2.7")
|
||||
@pytest.mark.parametrize(
|
||||
"reset", [True, False], ids=["reset", "no-reset"]
|
||||
)
|
||||
def test_LastResortLogger(reset, capsys, caplog):
|
||||
current = logging.getLoggerClass()
|
||||
msg = "The quick brown fox jumps over the lazy dog"
|
||||
try:
|
||||
if reset:
|
||||
_resetExistingLoggers()
|
||||
else:
|
||||
caplog.set_level(logging.ERROR, logger="myCustomLogger")
|
||||
logging.lastResort = StderrHandler(logging.WARNING)
|
||||
logging.setLoggerClass(LastResortLogger)
|
||||
logger = logging.getLogger("myCustomLogger")
|
||||
logger.error(msg)
|
||||
finally:
|
||||
del logging.lastResort
|
||||
logging.setLoggerClass(current)
|
||||
|
||||
captured = capsys.readouterr()
|
||||
if reset:
|
||||
assert msg in captured.err
|
||||
msg not in caplog.text
|
||||
else:
|
||||
msg in caplog.text
|
||||
msg not in captured.err
|
||||
|
168
Tests/subset/data/expect_math_partial.ttx
Normal file
168
Tests/subset/data/expect_math_partial.ttx
Normal file
@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ttFont sfntVersion="OTTO" ttLibVersion="3.41">
|
||||
|
||||
<MATH>
|
||||
<Version value="0x00010000"/>
|
||||
<MathConstants>
|
||||
<ScriptPercentScaleDown value="75"/>
|
||||
<ScriptScriptPercentScaleDown value="60"/>
|
||||
<DelimitedSubFormulaMinHeight value="1500"/>
|
||||
<DisplayOperatorMinHeight value="1450"/>
|
||||
<MathLeading>
|
||||
<Value value="150"/>
|
||||
</MathLeading>
|
||||
<AxisHeight>
|
||||
<Value value="250"/>
|
||||
</AxisHeight>
|
||||
<AccentBaseHeight>
|
||||
<Value value="450"/>
|
||||
</AccentBaseHeight>
|
||||
<FlattenedAccentBaseHeight>
|
||||
<Value value="662"/>
|
||||
</FlattenedAccentBaseHeight>
|
||||
<SubscriptShiftDown>
|
||||
<Value value="250"/>
|
||||
</SubscriptShiftDown>
|
||||
<SubscriptTopMax>
|
||||
<Value value="400"/>
|
||||
</SubscriptTopMax>
|
||||
<SubscriptBaselineDropMin>
|
||||
<Value value="50"/>
|
||||
</SubscriptBaselineDropMin>
|
||||
<SuperscriptShiftUp>
|
||||
<Value value="400"/>
|
||||
</SuperscriptShiftUp>
|
||||
<SuperscriptShiftUpCramped>
|
||||
<Value value="275"/>
|
||||
</SuperscriptShiftUpCramped>
|
||||
<SuperscriptBottomMin>
|
||||
<Value value="125"/>
|
||||
</SuperscriptBottomMin>
|
||||
<SuperscriptBaselineDropMax>
|
||||
<Value value="375"/>
|
||||
</SuperscriptBaselineDropMax>
|
||||
<SubSuperscriptGapMin>
|
||||
<Value value="264"/>
|
||||
</SubSuperscriptGapMin>
|
||||
<SuperscriptBottomMaxWithSubscript>
|
||||
<Value value="400"/>
|
||||
</SuperscriptBottomMaxWithSubscript>
|
||||
<SpaceAfterScript>
|
||||
<Value value="41"/>
|
||||
</SpaceAfterScript>
|
||||
<UpperLimitGapMin>
|
||||
<Value value="150"/>
|
||||
</UpperLimitGapMin>
|
||||
<UpperLimitBaselineRiseMin>
|
||||
<Value value="300"/>
|
||||
</UpperLimitBaselineRiseMin>
|
||||
<LowerLimitGapMin>
|
||||
<Value value="150"/>
|
||||
</LowerLimitGapMin>
|
||||
<LowerLimitBaselineDropMin>
|
||||
<Value value="600"/>
|
||||
</LowerLimitBaselineDropMin>
|
||||
<StackTopShiftUp>
|
||||
<Value value="480"/>
|
||||
</StackTopShiftUp>
|
||||
<StackTopDisplayStyleShiftUp>
|
||||
<Value value="580"/>
|
||||
</StackTopDisplayStyleShiftUp>
|
||||
<StackBottomShiftDown>
|
||||
<Value value="800"/>
|
||||
</StackBottomShiftDown>
|
||||
<StackBottomDisplayStyleShiftDown>
|
||||
<Value value="900"/>
|
||||
</StackBottomDisplayStyleShiftDown>
|
||||
<StackGapMin>
|
||||
<Value value="198"/>
|
||||
</StackGapMin>
|
||||
<StackDisplayStyleGapMin>
|
||||
<Value value="462"/>
|
||||
</StackDisplayStyleGapMin>
|
||||
<StretchStackTopShiftUp>
|
||||
<Value value="300"/>
|
||||
</StretchStackTopShiftUp>
|
||||
<StretchStackBottomShiftDown>
|
||||
<Value value="600"/>
|
||||
</StretchStackBottomShiftDown>
|
||||
<StretchStackGapAboveMin>
|
||||
<Value value="150"/>
|
||||
</StretchStackGapAboveMin>
|
||||
<StretchStackGapBelowMin>
|
||||
<Value value="150"/>
|
||||
</StretchStackGapBelowMin>
|
||||
<FractionNumeratorShiftUp>
|
||||
<Value value="480"/>
|
||||
</FractionNumeratorShiftUp>
|
||||
<FractionNumeratorDisplayStyleShiftUp>
|
||||
<Value value="580"/>
|
||||
</FractionNumeratorDisplayStyleShiftUp>
|
||||
<FractionDenominatorShiftDown>
|
||||
<Value value="480"/>
|
||||
</FractionDenominatorShiftDown>
|
||||
<FractionDenominatorDisplayStyleShiftDown>
|
||||
<Value value="700"/>
|
||||
</FractionDenominatorDisplayStyleShiftDown>
|
||||
<FractionNumeratorGapMin>
|
||||
<Value value="66"/>
|
||||
</FractionNumeratorGapMin>
|
||||
<FractionNumDisplayStyleGapMin>
|
||||
<Value value="198"/>
|
||||
</FractionNumDisplayStyleGapMin>
|
||||
<FractionRuleThickness>
|
||||
<Value value="66"/>
|
||||
</FractionRuleThickness>
|
||||
<FractionDenominatorGapMin>
|
||||
<Value value="66"/>
|
||||
</FractionDenominatorGapMin>
|
||||
<FractionDenomDisplayStyleGapMin>
|
||||
<Value value="198"/>
|
||||
</FractionDenomDisplayStyleGapMin>
|
||||
<SkewedFractionHorizontalGap>
|
||||
<Value value="300"/>
|
||||
</SkewedFractionHorizontalGap>
|
||||
<SkewedFractionVerticalGap>
|
||||
<Value value="66"/>
|
||||
</SkewedFractionVerticalGap>
|
||||
<OverbarVerticalGap>
|
||||
<Value value="198"/>
|
||||
</OverbarVerticalGap>
|
||||
<OverbarRuleThickness>
|
||||
<Value value="66"/>
|
||||
</OverbarRuleThickness>
|
||||
<OverbarExtraAscender>
|
||||
<Value value="66"/>
|
||||
</OverbarExtraAscender>
|
||||
<UnderbarVerticalGap>
|
||||
<Value value="198"/>
|
||||
</UnderbarVerticalGap>
|
||||
<UnderbarRuleThickness>
|
||||
<Value value="66"/>
|
||||
</UnderbarRuleThickness>
|
||||
<UnderbarExtraDescender>
|
||||
<Value value="66"/>
|
||||
</UnderbarExtraDescender>
|
||||
<RadicalVerticalGap>
|
||||
<Value value="82"/>
|
||||
</RadicalVerticalGap>
|
||||
<RadicalDisplayStyleVerticalGap>
|
||||
<Value value="186"/>
|
||||
</RadicalDisplayStyleVerticalGap>
|
||||
<RadicalRuleThickness>
|
||||
<Value value="66"/>
|
||||
</RadicalRuleThickness>
|
||||
<RadicalExtraAscender>
|
||||
<Value value="66"/>
|
||||
</RadicalExtraAscender>
|
||||
<RadicalKernBeforeDegree>
|
||||
<Value value="277"/>
|
||||
</RadicalKernBeforeDegree>
|
||||
<RadicalKernAfterDegree>
|
||||
<Value value="-555"/>
|
||||
</RadicalKernAfterDegree>
|
||||
<RadicalDegreeBottomRaisePercent value="70"/>
|
||||
</MathConstants>
|
||||
</MATH>
|
||||
|
||||
</ttFont>
|
391
Tests/subset/data/test_math_partial.ttx
Normal file
391
Tests/subset/data/test_math_partial.ttx
Normal file
@ -0,0 +1,391 @@
|
||||
<?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.10799"/>
|
||||
<checkSumAdjustment value="0x266835f6"/>
|
||||
<magicNumber value="0x5f0f3cf5"/>
|
||||
<flags value="00000000 00001011"/>
|
||||
<unitsPerEm value="1000"/>
|
||||
<created value="Sun Jan 10 17:35:12 2016"/>
|
||||
<modified value="Sat Jun 8 23:59:34 2019"/>
|
||||
<xMin value="-761"/>
|
||||
<yMin value="-509"/>
|
||||
<xMax value="3000"/>
|
||||
<yMax value="2566"/>
|
||||
<macStyle value="00000000 00000000"/>
|
||||
<lowestRecPPEM value="8"/>
|
||||
<fontDirectionHint value="2"/>
|
||||
<indexToLocFormat value="0"/>
|
||||
<glyphDataFormat value="0"/>
|
||||
</head>
|
||||
|
||||
<hhea>
|
||||
<tableVersion value="0x00010000"/>
|
||||
<ascent value="750"/>
|
||||
<descent value="-250"/>
|
||||
<lineGap value="0"/>
|
||||
<advanceWidthMax value="3000"/>
|
||||
<minLeftSideBearing value="-761"/>
|
||||
<minRightSideBearing value="-365"/>
|
||||
<xMaxExtent value="3000"/>
|
||||
<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="2"/>
|
||||
</hhea>
|
||||
|
||||
<maxp>
|
||||
<tableVersion value="0x5000"/>
|
||||
<numGlyphs value="2"/>
|
||||
</maxp>
|
||||
|
||||
<OS_2>
|
||||
<!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
|
||||
will be recalculated by the compiler -->
|
||||
<version value="4"/>
|
||||
<xAvgCharWidth value="666"/>
|
||||
<usWeightClass value="400"/>
|
||||
<usWidthClass value="5"/>
|
||||
<fsType value="00000000 00000000"/>
|
||||
<ySubscriptXSize value="500"/>
|
||||
<ySubscriptYSize value="500"/>
|
||||
<ySubscriptXOffset value="0"/>
|
||||
<ySubscriptYOffset value="250"/>
|
||||
<ySuperscriptXSize value="500"/>
|
||||
<ySuperscriptYSize value="500"/>
|
||||
<ySuperscriptXOffset value="0"/>
|
||||
<ySuperscriptYOffset value="500"/>
|
||||
<yStrikeoutSize value="50"/>
|
||||
<yStrikeoutPosition value="306"/>
|
||||
<sFamilyClass value="0"/>
|
||||
<panose>
|
||||
<bFamilyType value="2"/>
|
||||
<bSerifStyle value="0"/>
|
||||
<bWeight value="5"/>
|
||||
<bProportion value="3"/>
|
||||
<bContrast value="0"/>
|
||||
<bStrokeVariation value="0"/>
|
||||
<bArmStyle value="0"/>
|
||||
<bLetterForm value="0"/>
|
||||
<bMidline value="0"/>
|
||||
<bXHeight value="0"/>
|
||||
</panose>
|
||||
<ulUnicodeRange1 value="00000000 00000000 00000000 00000001"/>
|
||||
<ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
|
||||
<ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
|
||||
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
|
||||
<achVendID value="STIX"/>
|
||||
<fsSelection value="00000000 11000000"/>
|
||||
<usFirstCharIndex value="65"/>
|
||||
<usLastCharIndex value="65"/>
|
||||
<sTypoAscender value="750"/>
|
||||
<sTypoDescender value="-250"/>
|
||||
<sTypoLineGap value="0"/>
|
||||
<usWinAscent value="2598"/>
|
||||
<usWinDescent value="918"/>
|
||||
<ulCodePageRange1 value="01100000 00000000 00000000 10011111"/>
|
||||
<ulCodePageRange2 value="11011111 11010111 00000000 00000000"/>
|
||||
<sxHeight value="450"/>
|
||||
<sCapHeight value="662"/>
|
||||
<usDefaultChar value="0"/>
|
||||
<usBreakChar value="32"/>
|
||||
<usMaxContext value="2"/>
|
||||
</OS_2>
|
||||
|
||||
<name>
|
||||
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
|
||||
XITS Math
|
||||
</namerecord>
|
||||
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
|
||||
Regular
|
||||
</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_12 platformID="0" platEncID="4" format="12" reserved="0" length="28" language="0" nGroups="1">
|
||||
<map code="0x41" name="A"/><!-- LATIN CAPITAL LETTER A -->
|
||||
</cmap_format_12>
|
||||
<cmap_format_4 platformID="3" platEncID="1" language="0">
|
||||
<map code="0x41" name="A"/><!-- LATIN CAPITAL LETTER A -->
|
||||
</cmap_format_4>
|
||||
<cmap_format_12 platformID="3" platEncID="10" format="12" reserved="0" length="28" language="0" nGroups="1">
|
||||
<map code="0x41" name="A"/><!-- LATIN CAPITAL LETTER A -->
|
||||
</cmap_format_12>
|
||||
</cmap>
|
||||
|
||||
<post>
|
||||
<formatType value="3.0"/>
|
||||
<italicAngle value="0.0"/>
|
||||
<underlinePosition value="-75"/>
|
||||
<underlineThickness value="50"/>
|
||||
<isFixedPitch value="0"/>
|
||||
<minMemType42 value="0"/>
|
||||
<maxMemType42 value="0"/>
|
||||
<minMemType1 value="0"/>
|
||||
<maxMemType1 value="0"/>
|
||||
</post>
|
||||
|
||||
<CFF>
|
||||
<major value="1"/>
|
||||
<minor value="0"/>
|
||||
<CFFFont name="XITSMath">
|
||||
<version value="1.108"/>
|
||||
<Notice value="Copyright (c) 2001-2011 by the STI Pub Companies, consisting of the American Chemical Society, the American Institute of Physics, the American Mathematical Society, the American Physical Society, Elsevier, Inc., and The Institute of Electrical and Electronic Engineers, Inc. Portions copyright (c) 1998-2003 by MicroPress, Inc. Portions copyright (c) 1990 by Elsevier, Inc. Portions copyright (c) 2009-2012 by Khaled Hosny. All rights reserved. "/>
|
||||
<FullName value="XITS Math"/>
|
||||
<FamilyName value="XITS Math"/>
|
||||
<Weight value="Regular"/>
|
||||
<isFixedPitch value="0"/>
|
||||
<ItalicAngle value="0"/>
|
||||
<UnderlinePosition value="-50"/>
|
||||
<UnderlineThickness value="50"/>
|
||||
<PaintType value="0"/>
|
||||
<CharstringType value="2"/>
|
||||
<FontMatrix value="0.001 0 0 0.001 0 0"/>
|
||||
<FontBBox value="-761 -509 3000 2566"/>
|
||||
<StrokeWidth value="0"/>
|
||||
<!-- charset is dumped separately as the 'GlyphOrder' element -->
|
||||
<Encoding name="StandardEncoding"/>
|
||||
<Private>
|
||||
<BlueValues value="-14 0 450 460 662 676"/>
|
||||
<BlueScale value="0.039625"/>
|
||||
<BlueShift value="6"/>
|
||||
<BlueFuzz value="1"/>
|
||||
<StdHW value="66"/>
|
||||
<StdVW value="66"/>
|
||||
<StemSnapH value="23 28 31 34 38 43 50 54 63 66"/>
|
||||
<StemSnapV value="39 43 48 52 56 59 66 73 79 83"/>
|
||||
<ForceBold value="0"/>
|
||||
<LanguageGroup value="0"/>
|
||||
<ExpansionFactor value="0.06"/>
|
||||
<initialRandomSeed value="0"/>
|
||||
<defaultWidthX value="685"/>
|
||||
<nominalWidthX value="601"/>
|
||||
<Subrs>
|
||||
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
|
||||
<CharString index="0">
|
||||
19 vlineto
|
||||
-52 6 -14 21 -28 65 rrcurveto
|
||||
-246 563 -20 0 -206 -488 rlineto
|
||||
-59 -140 -9 -21 -58 -6 rrcurveto
|
||||
-19 199 19 vlineto
|
||||
-48 -22 10 31 hvcurveto
|
||||
0 12 4 17 5 13 rrcurveto
|
||||
46 114 262 0 41 -94 rlineto
|
||||
12 -28 7 -27 0 -15 0 -9 -6 -11 -8 -4 -12 -7 -7 -2 -36 0 rrcurveto
|
||||
-19 vlineto
|
||||
return
|
||||
</CharString>
|
||||
<CharString index="1">
|
||||
-231 0 115 275 rlineto
|
||||
return
|
||||
</CharString>
|
||||
</Subrs>
|
||||
</Private>
|
||||
<CharStrings>
|
||||
<CharString name=".notdef">
|
||||
-351 endchar
|
||||
</CharString>
|
||||
<CharString name="A">
|
||||
121 0 20 196 41 397 20 hstem
|
||||
707 hmoveto
|
||||
-107 callsubr
|
||||
-5 257 rmoveto
|
||||
-106 callsubr
|
||||
endchar
|
||||
</CharString>
|
||||
</CharStrings>
|
||||
</CFFFont>
|
||||
|
||||
<GlobalSubrs>
|
||||
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
|
||||
</GlobalSubrs>
|
||||
</CFF>
|
||||
|
||||
<MATH>
|
||||
<Version value="0x00010000"/>
|
||||
<MathConstants>
|
||||
<ScriptPercentScaleDown value="75"/>
|
||||
<ScriptScriptPercentScaleDown value="60"/>
|
||||
<DelimitedSubFormulaMinHeight value="1500"/>
|
||||
<DisplayOperatorMinHeight value="1450"/>
|
||||
<MathLeading>
|
||||
<Value value="150"/>
|
||||
</MathLeading>
|
||||
<AxisHeight>
|
||||
<Value value="250"/>
|
||||
</AxisHeight>
|
||||
<AccentBaseHeight>
|
||||
<Value value="450"/>
|
||||
</AccentBaseHeight>
|
||||
<FlattenedAccentBaseHeight>
|
||||
<Value value="662"/>
|
||||
</FlattenedAccentBaseHeight>
|
||||
<SubscriptShiftDown>
|
||||
<Value value="250"/>
|
||||
</SubscriptShiftDown>
|
||||
<SubscriptTopMax>
|
||||
<Value value="400"/>
|
||||
</SubscriptTopMax>
|
||||
<SubscriptBaselineDropMin>
|
||||
<Value value="50"/>
|
||||
</SubscriptBaselineDropMin>
|
||||
<SuperscriptShiftUp>
|
||||
<Value value="400"/>
|
||||
</SuperscriptShiftUp>
|
||||
<SuperscriptShiftUpCramped>
|
||||
<Value value="275"/>
|
||||
</SuperscriptShiftUpCramped>
|
||||
<SuperscriptBottomMin>
|
||||
<Value value="125"/>
|
||||
</SuperscriptBottomMin>
|
||||
<SuperscriptBaselineDropMax>
|
||||
<Value value="375"/>
|
||||
</SuperscriptBaselineDropMax>
|
||||
<SubSuperscriptGapMin>
|
||||
<Value value="264"/>
|
||||
</SubSuperscriptGapMin>
|
||||
<SuperscriptBottomMaxWithSubscript>
|
||||
<Value value="400"/>
|
||||
</SuperscriptBottomMaxWithSubscript>
|
||||
<SpaceAfterScript>
|
||||
<Value value="41"/>
|
||||
</SpaceAfterScript>
|
||||
<UpperLimitGapMin>
|
||||
<Value value="150"/>
|
||||
</UpperLimitGapMin>
|
||||
<UpperLimitBaselineRiseMin>
|
||||
<Value value="300"/>
|
||||
</UpperLimitBaselineRiseMin>
|
||||
<LowerLimitGapMin>
|
||||
<Value value="150"/>
|
||||
</LowerLimitGapMin>
|
||||
<LowerLimitBaselineDropMin>
|
||||
<Value value="600"/>
|
||||
</LowerLimitBaselineDropMin>
|
||||
<StackTopShiftUp>
|
||||
<Value value="480"/>
|
||||
</StackTopShiftUp>
|
||||
<StackTopDisplayStyleShiftUp>
|
||||
<Value value="580"/>
|
||||
</StackTopDisplayStyleShiftUp>
|
||||
<StackBottomShiftDown>
|
||||
<Value value="800"/>
|
||||
</StackBottomShiftDown>
|
||||
<StackBottomDisplayStyleShiftDown>
|
||||
<Value value="900"/>
|
||||
</StackBottomDisplayStyleShiftDown>
|
||||
<StackGapMin>
|
||||
<Value value="198"/>
|
||||
</StackGapMin>
|
||||
<StackDisplayStyleGapMin>
|
||||
<Value value="462"/>
|
||||
</StackDisplayStyleGapMin>
|
||||
<StretchStackTopShiftUp>
|
||||
<Value value="300"/>
|
||||
</StretchStackTopShiftUp>
|
||||
<StretchStackBottomShiftDown>
|
||||
<Value value="600"/>
|
||||
</StretchStackBottomShiftDown>
|
||||
<StretchStackGapAboveMin>
|
||||
<Value value="150"/>
|
||||
</StretchStackGapAboveMin>
|
||||
<StretchStackGapBelowMin>
|
||||
<Value value="150"/>
|
||||
</StretchStackGapBelowMin>
|
||||
<FractionNumeratorShiftUp>
|
||||
<Value value="480"/>
|
||||
</FractionNumeratorShiftUp>
|
||||
<FractionNumeratorDisplayStyleShiftUp>
|
||||
<Value value="580"/>
|
||||
</FractionNumeratorDisplayStyleShiftUp>
|
||||
<FractionDenominatorShiftDown>
|
||||
<Value value="480"/>
|
||||
</FractionDenominatorShiftDown>
|
||||
<FractionDenominatorDisplayStyleShiftDown>
|
||||
<Value value="700"/>
|
||||
</FractionDenominatorDisplayStyleShiftDown>
|
||||
<FractionNumeratorGapMin>
|
||||
<Value value="66"/>
|
||||
</FractionNumeratorGapMin>
|
||||
<FractionNumDisplayStyleGapMin>
|
||||
<Value value="198"/>
|
||||
</FractionNumDisplayStyleGapMin>
|
||||
<FractionRuleThickness>
|
||||
<Value value="66"/>
|
||||
</FractionRuleThickness>
|
||||
<FractionDenominatorGapMin>
|
||||
<Value value="66"/>
|
||||
</FractionDenominatorGapMin>
|
||||
<FractionDenomDisplayStyleGapMin>
|
||||
<Value value="198"/>
|
||||
</FractionDenomDisplayStyleGapMin>
|
||||
<SkewedFractionHorizontalGap>
|
||||
<Value value="300"/>
|
||||
</SkewedFractionHorizontalGap>
|
||||
<SkewedFractionVerticalGap>
|
||||
<Value value="66"/>
|
||||
</SkewedFractionVerticalGap>
|
||||
<OverbarVerticalGap>
|
||||
<Value value="198"/>
|
||||
</OverbarVerticalGap>
|
||||
<OverbarRuleThickness>
|
||||
<Value value="66"/>
|
||||
</OverbarRuleThickness>
|
||||
<OverbarExtraAscender>
|
||||
<Value value="66"/>
|
||||
</OverbarExtraAscender>
|
||||
<UnderbarVerticalGap>
|
||||
<Value value="198"/>
|
||||
</UnderbarVerticalGap>
|
||||
<UnderbarRuleThickness>
|
||||
<Value value="66"/>
|
||||
</UnderbarRuleThickness>
|
||||
<UnderbarExtraDescender>
|
||||
<Value value="66"/>
|
||||
</UnderbarExtraDescender>
|
||||
<RadicalVerticalGap>
|
||||
<Value value="82"/>
|
||||
</RadicalVerticalGap>
|
||||
<RadicalDisplayStyleVerticalGap>
|
||||
<Value value="186"/>
|
||||
</RadicalDisplayStyleVerticalGap>
|
||||
<RadicalRuleThickness>
|
||||
<Value value="66"/>
|
||||
</RadicalRuleThickness>
|
||||
<RadicalExtraAscender>
|
||||
<Value value="66"/>
|
||||
</RadicalExtraAscender>
|
||||
<RadicalKernBeforeDegree>
|
||||
<Value value="277"/>
|
||||
</RadicalKernBeforeDegree>
|
||||
<RadicalKernAfterDegree>
|
||||
<Value value="-555"/>
|
||||
</RadicalKernAfterDegree>
|
||||
<RadicalDegreeBottomRaisePercent value="70"/>
|
||||
</MathConstants>
|
||||
</MATH>
|
||||
|
||||
<hmtx>
|
||||
<mtx name=".notdef" width="250" lsb="0"/>
|
||||
<mtx name="A" width="722" lsb="15"/>
|
||||
</hmtx>
|
||||
|
||||
</ttFont>
|
@ -237,6 +237,13 @@ class SubsetTest(unittest.TestCase):
|
||||
subsetfont = TTFont(subsetpath)
|
||||
self.expect_ttx(subsetfont, self.getpath("expect_keep_math.ttx"), ["GlyphOrder", "CFF ", "MATH", "hmtx"])
|
||||
|
||||
def test_subset_math_partial(self):
|
||||
_, fontpath = self.compile_font(self.getpath("test_math_partial.ttx"), ".ttf")
|
||||
subsetpath = self.temp_path(".ttf")
|
||||
subset.main([fontpath, "--text=A", "--output-file=%s" % subsetpath])
|
||||
subsetfont = TTFont(subsetpath)
|
||||
self.expect_ttx(subsetfont, self.getpath("expect_math_partial.ttx"), ["MATH"])
|
||||
|
||||
def test_subset_opbd_remove(self):
|
||||
# In the test font, only the glyphs 'A' and 'zero' have an entry in
|
||||
# the Optical Bounds table. When subsetting, we do not request any
|
||||
|
@ -145,6 +145,7 @@ class WOFF2ReaderTTFTest(WOFF2ReaderTest):
|
||||
def test_reconstruct_loca(self):
|
||||
woff2Reader = WOFF2Reader(self.file)
|
||||
reconstructedData = woff2Reader['loca']
|
||||
self.font.getTableData("glyf") # 'glyf' needs to be compiled before 'loca'
|
||||
self.assertEqual(self.font.getTableData('loca'), reconstructedData)
|
||||
self.assertTrue(hasattr(woff2Reader.tables['glyf'], 'data'))
|
||||
|
||||
@ -360,7 +361,7 @@ class WOFF2WriterTest(unittest.TestCase):
|
||||
def setUpClass(cls):
|
||||
cls.font = ttLib.TTFont(recalcBBoxes=False, recalcTimestamp=False, flavor="woff2")
|
||||
cls.font.importXML(OTX)
|
||||
cls.tags = [t for t in cls.font.keys() if t != 'GlyphOrder']
|
||||
cls.tags = sorted(t for t in cls.font.keys() if t != 'GlyphOrder')
|
||||
cls.numTables = len(cls.tags)
|
||||
cls.file = BytesIO(CFF_WOFF2.getvalue())
|
||||
cls.file.seek(0, 2)
|
||||
@ -518,7 +519,7 @@ class WOFF2WriterTTFTest(WOFF2WriterTest):
|
||||
def setUpClass(cls):
|
||||
cls.font = ttLib.TTFont(recalcBBoxes=False, recalcTimestamp=False, flavor="woff2")
|
||||
cls.font.importXML(TTX)
|
||||
cls.tags = [t for t in cls.font.keys() if t != 'GlyphOrder']
|
||||
cls.tags = sorted(t for t in cls.font.keys() if t != 'GlyphOrder')
|
||||
cls.numTables = len(cls.tags)
|
||||
cls.file = BytesIO(TT_WOFF2.getvalue())
|
||||
cls.file.seek(0, 2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user