diff options
author | Haibo Huang <hhb@google.com> | 2020-12-16 21:00:36 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-12-16 21:00:36 +0000 |
commit | 214df0141ad5088a2e31e304f47fa74be46c6e34 (patch) | |
tree | 7748c27dcca3bb937a8021cbb94b159cc025e130 | |
parent | d6972fc7262f57ccda2102214b62089e85a18f99 (diff) | |
parent | c89ead6a8ade30772e8c0ff7f55c04fa69214774 (diff) | |
download | fonttools-214df0141ad5088a2e31e304f47fa74be46c6e34.tar.gz |
Upgrade fonttools to 4.18.2 am: c89ead6a8a
Original change: https://android-review.googlesource.com/c/platform/external/fonttools/+/1531918
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I45f56e1c0569a92bded398975fb80ae9ecd64401
-rw-r--r-- | .github/workflows/test.yml | 5 | ||||
-rw-r--r-- | Lib/fontTools/__init__.py | 2 | ||||
-rw-r--r-- | Lib/fontTools/colorLib/builder.py | 10 | ||||
-rw-r--r-- | Lib/fontTools/otlLib/builder.py | 5 | ||||
-rwxr-xr-x | Lib/fontTools/ttLib/tables/otData.py | 17 | ||||
-rw-r--r-- | Lib/fontTools/ttLib/tables/otTables.py | 7 | ||||
-rw-r--r-- | Lib/fontTools/varLib/cff.py | 2 | ||||
-rw-r--r-- | MANIFEST.in | 3 | ||||
-rw-r--r-- | METADATA | 6 | ||||
-rw-r--r-- | NEWS.rst | 8 | ||||
-rw-r--r-- | README.rst | 8 | ||||
-rw-r--r-- | Tests/colorLib/builder_test.py | 20 | ||||
-rw-r--r-- | Tests/ttLib/tables/C_O_L_R_test.py | 51 | ||||
-rw-r--r-- | setup.cfg | 2 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rw-r--r-- | tox.ini | 2 |
16 files changed, 104 insertions, 46 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c302587..837fb8c4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,8 @@ on: jobs: lint: runs-on: ubuntu-latest + # https://github.community/t/github-actions-does-not-respect-skip-ci/17325/8 + if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" steps: - uses: actions/checkout@v2 - name: Set up Python 3.x @@ -22,6 +24,7 @@ jobs: test: runs-on: ${{ matrix.platform }} + if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" strategy: matrix: python-version: [3.6, 3.7, 3.8, 3.9] @@ -61,6 +64,7 @@ jobs: test-cython: runs-on: ubuntu-latest + if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" steps: - uses: actions/checkout@v2 - name: Set up Python 3.x @@ -74,6 +78,7 @@ jobs: test-pypy3: runs-on: ubuntu-latest + if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" steps: - uses: actions/checkout@v2 - name: Set up Python pypy3 diff --git a/Lib/fontTools/__init__.py b/Lib/fontTools/__init__.py index 00b962cd..09dce766 100644 --- a/Lib/fontTools/__init__.py +++ b/Lib/fontTools/__init__.py @@ -4,6 +4,6 @@ from fontTools.misc.loggingTools import configLogger log = logging.getLogger(__name__) -version = __version__ = "4.18.1" +version = __version__ = "4.18.2" __all__ = ["version", "log", "configLogger"] diff --git a/Lib/fontTools/colorLib/builder.py b/Lib/fontTools/colorLib/builder.py index 74abb8af..724136ab 100644 --- a/Lib/fontTools/colorLib/builder.py +++ b/Lib/fontTools/colorLib/builder.py @@ -557,6 +557,16 @@ class LayerV1ListBuilder: ot_paint.Paint = self.buildPaint(paint) return ot_paint + def buildPaintTranslate( + self, paint: _PaintInput, dx: _ScalarInput, dy: _ScalarInput + ): + ot_paint = ot.Paint() + ot_paint.Format = int(ot.Paint.Format.PaintTranslate) + ot_paint.Paint = self.buildPaint(paint) + ot_paint.dx = _to_variable_f16dot16_float(dx) + ot_paint.dy = _to_variable_f16dot16_float(dy) + return ot_paint + def buildPaintRotate( self, paint: _PaintInput, diff --git a/Lib/fontTools/otlLib/builder.py b/Lib/fontTools/otlLib/builder.py index 1ba63c35..7e144451 100644 --- a/Lib/fontTools/otlLib/builder.py +++ b/Lib/fontTools/otlLib/builder.py @@ -314,9 +314,10 @@ class ChainContextualRuleset: classdefbuilder = ClassDefBuilder(useClass0=False) for position in context: for glyphset in position: - if not classdefbuilder.canAdd(glyphset): + glyphs = set(glyphset) + if not classdefbuilder.canAdd(glyphs): return None - classdefbuilder.add(glyphset) + classdefbuilder.add(glyphs) return classdefbuilder diff --git a/Lib/fontTools/ttLib/tables/otData.py b/Lib/fontTools/ttLib/tables/otData.py index 776cf75b..a6f9619e 100755 --- a/Lib/fontTools/ttLib/tables/otData.py +++ b/Lib/fontTools/ttLib/tables/otData.py @@ -1665,23 +1665,30 @@ otData = [ ('PaintFormat8', [ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 8'), + ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintTranslate table) to Paint subtable.'), + ('VarFixed', 'dx', None, None, 'Translation in x direction.'), + ('VarFixed', 'dy', None, None, 'Translation in y direction.'), + ]), + + ('PaintFormat9', [ + ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 9'), ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintRotate table) to Paint subtable.'), ('VarFixed', 'angle', None, None, ''), ('VarFixed', 'centerX', None, None, ''), ('VarFixed', 'centerY', None, None, ''), ]), - ('PaintFormat9', [ - ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 9'), - ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintRotate table) to Paint subtable.'), + ('PaintFormat10', [ + ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 10'), + ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintSkew table) to Paint subtable.'), ('VarFixed', 'xSkewAngle', None, None, ''), ('VarFixed', 'ySkewAngle', None, None, ''), ('VarFixed', 'centerX', None, None, ''), ('VarFixed', 'centerY', None, None, ''), ]), - ('PaintFormat10', [ - ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 8'), + ('PaintFormat11', [ + ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 11'), ('LOffset24To(Paint)', 'SourcePaint', None, None, 'Offset (from beginning of PaintComposite table) to source Paint subtable.'), ('CompositeMode', 'CompositeMode', None, None, 'A CompositeMode enumeration value.'), ('LOffset24To(Paint)', 'BackdropPaint', None, None, 'Offset (from beginning of PaintComposite table) to backdrop Paint subtable.'), diff --git a/Lib/fontTools/ttLib/tables/otTables.py b/Lib/fontTools/ttLib/tables/otTables.py index c4208a55..7f42921d 100644 --- a/Lib/fontTools/ttLib/tables/otTables.py +++ b/Lib/fontTools/ttLib/tables/otTables.py @@ -1334,9 +1334,10 @@ class Paint(getFormatSwitchingBaseTableClass("uint8")): PaintGlyph = 5 PaintColrGlyph = 6 PaintTransform = 7 - PaintRotate = 8 - PaintSkew = 9 - PaintComposite = 10 + PaintTranslate = 8 + PaintRotate = 9 + PaintSkew = 10 + PaintComposite = 11 def getFormatName(self): try: diff --git a/Lib/fontTools/varLib/cff.py b/Lib/fontTools/varLib/cff.py index 4e2672b3..0a6ba220 100644 --- a/Lib/fontTools/varLib/cff.py +++ b/Lib/fontTools/varLib/cff.py @@ -413,7 +413,7 @@ def merge_charstrings(glyphOrder, num_masters, top_dicts, masterModel): # 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, + _add_new_vsindex(masterModel, key, masterSupports, vsindex_dict, vsindex_by_key, varDataList) cvData = CVarData(varDataList=varDataList, masterSupports=masterSupports, vsindex_dict=vsindex_dict) diff --git a/MANIFEST.in b/MANIFEST.in index 5c4d1274..31a9c256 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -11,6 +11,7 @@ include Lib/fontTools/ttLib/tables/table_API_readme.txt include *requirements.txt include tox.ini +include mypy.ini include run-tests.sh recursive-include Lib/fontTools py.typed @@ -39,3 +40,5 @@ recursive-include Tests *.txt README recursive-include Tests *.lwfn *.pfa *.pfb recursive-include Tests *.xml *.designspace *.bin recursive-include Tests *.afm +recursive-include Tests *.json +recursive-include Tests *.ufoz @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://github.com/fonttools/fonttools/archive/4.18.1.zip" + value: "https://github.com/fonttools/fonttools/archive/4.18.2.zip" } - version: "4.18.1" + version: "4.18.2" license_type: NOTICE last_upgrade_date { year: 2020 month: 12 - day: 9 + day: 16 } } @@ -1,3 +1,11 @@ +4.18.2 (released 2020-12-16) +---------------------------- + +- [COLRv1] Implemented ``PaintTranslate`` paint format (#2129). +- [varLib.cff] Fixed unbound local variable error (#1787). +- [otlLib] Don't crash when creating OpenType class definitions if some glyphs + occur more than once (#2125). + 4.18.1 (released 2020-12-09) ---------------------------- @@ -1,4 +1,4 @@ -|Travis Build Status| |Appveyor Build status| |Coverage Status| |PyPI| |Gitter Chat| +|CI Build Status| |Coverage Status| |PyPI| |Gitter Chat| What is this? ~~~~~~~~~~~~~ @@ -240,10 +240,8 @@ Rights Reserved. Have fun! -.. |Travis Build Status| image:: https://travis-ci.org/fonttools/fonttools.svg - :target: https://travis-ci.org/fonttools/fonttools -.. |Appveyor Build status| image:: https://ci.appveyor.com/api/projects/status/0f7fmee9as744sl7/branch/master?svg=true - :target: https://ci.appveyor.com/project/fonttools/fonttools/branch/master +.. |CI Build Status| image:: https://github.com/fonttools/fonttools/workflows/Test/badge.svg + :target: https://github.com/fonttools/fonttools/actions?query=workflow%3ATest .. |Coverage Status| image:: https://codecov.io/gh/fonttools/fonttools/branch/master/graph/badge.svg :target: https://codecov.io/gh/fonttools/fonttools .. |PyPI| image:: https://img.shields.io/pypi/v/fonttools.svg diff --git a/Tests/colorLib/builder_test.py b/Tests/colorLib/builder_test.py index 152e16e0..d1e94df9 100644 --- a/Tests/colorLib/builder_test.py +++ b/Tests/colorLib/builder_test.py @@ -544,7 +544,7 @@ def test_buildPaintComposite(): composite = layerBuilder.buildPaintComposite( mode=ot.CompositeMode.SRC_OVER, source={ - "format": 10, + "format": 11, "mode": "src_over", "source": {"format": 5, "glyph": "c", "paint": 2}, "backdrop": {"format": 5, "glyph": "b", "paint": 1}, @@ -574,6 +574,22 @@ def test_buildPaintComposite(): assert composite.BackdropPaint.Paint.Color.PaletteIndex == 0 +def test_buildPaintTranslate(): + layerBuilder = LayerV1ListBuilder() + paint = layerBuilder.buildPaintTranslate( + paint=layerBuilder.buildPaintGlyph( + "a", layerBuilder.buildPaintSolid(paletteIndex=0, alpha=1.0) + ), + dx=123, + dy=-345, + ) + + assert paint.Format == ot.Paint.Format.PaintTranslate + assert paint.Paint.Format == ot.Paint.Format.PaintGlyph + assert paint.dx.value == 123 + assert paint.dy.value == -345 + + def test_buildPaintRotate(): layerBuilder = LayerV1ListBuilder() paint = layerBuilder.buildPaintRotate( @@ -592,7 +608,7 @@ def test_buildPaintRotate(): assert paint.centerY.value == 129 -def test_buildPaintRotate(): +def test_buildPaintSkew(): layerBuilder = LayerV1ListBuilder() paint = layerBuilder.buildPaintSkew( paint=layerBuilder.buildPaintGlyph( diff --git a/Tests/ttLib/tables/C_O_L_R_test.py b/Tests/ttLib/tables/C_O_L_R_test.py index 76e9e61a..7f3f71ea 100644 --- a/Tests/ttLib/tables/C_O_L_R_test.py +++ b/Tests/ttLib/tables/C_O_L_R_test.py @@ -131,7 +131,7 @@ COLR_V1_SAMPLE = ( (b"\x01", "BaseGlyphV1Record[0].Paint.Format (1)"), (b"\x04", "BaseGlyphV1Record[0].Paint.NumLayers (4)"), (b"\x00\x00\x00\x00", "BaseGlyphV1Record[0].Paint.FirstLayerIndex (0)"), - (b"\x0A", "BaseGlyphV1Record[1].Paint.Format (10)"), + (b"\x0B", "BaseGlyphV1Record[1].Paint.Format (11)"), (b"\x00\x00<", "Offset to SourcePaint from beginning of PaintComposite (60)"), (b"\x03", "BaseGlyphV1Record[1].Paint.CompositeMode [SRC_OVER] (3)"), (b"\x00\x00\x08", "Offset to BackdropPaint from beginning of PaintComposite (8)"), @@ -164,7 +164,7 @@ COLR_V1_SAMPLE = ( ), # PaintGlyph glyph00011 (b"\x05", "LayerV1List.Paint[0].Format (5)"), - (b"\x00\x01\x28", "Offset24 to Paint subtable from beginning of PaintGlyph (296)"), + (b"\x00\x01<", "Offset24 to Paint subtable from beginning of PaintGlyph (316)"), (b"\x00\x0b", "LayerV1List.Paint[0].Glyph (glyph00011)"), # PaintGlyph glyph00012 (b"\x05", "LayerV1List.Paint[1].Format (5)"), @@ -229,14 +229,19 @@ COLR_V1_SAMPLE = ( (b"@\x00\x00\x00\x00\x00", "ColorLine.ColorStop[1].StopOffset.value (1.0)"), (b"\x00\x07", "ColorLine.ColorStop[1].Color.PaletteIndex (7)"), (b"\x19\x9a\x00\x00\x00\x00", "ColorLine.ColorStop[1].Color.Alpha.value (0.4)"), - # PaintRotate + # PaintTranslate (b"\x08", "LayerV1List.Paint[3].Format (8)"), + (b"\x00\x00\x14", "Offset to Paint subtable from beginning of PaintTranslate (20)"), + (b"\x01\x01\x00\x00\x00\x00\x00\x00", "dx.value (257)"), + (b"\x01\x02\x00\x00\x00\x00\x00\x00", "dy.value (258)"), + # PaintRotate + (b"\x09", "LayerV1List.Paint[3].Paint.Format (9)"), (b"\x00\x00\x1c", "Offset to Paint subtable from beginning of PaintRotate (28)"), (b"\x00\x2d\x00\x00\x00\x00\x00\x00", "angle.value (45)"), (b"\x00\xff\x00\x00\x00\x00\x00\x00", "centerX.value (255)"), (b"\x01\x00\x00\x00\x00\x00\x00\x00", "centerY.value (256)"), # PaintSkew - (b"\x09", "LayerV1List.Paint[3].Format (9)"), + (b"\x0a", "LayerV1List.Paint[3].Paint.Paint.Format (10)"), (b"\x00\x00\x24", "Offset to Paint subtable from beginning of PaintSkew (36)"), (b"\xff\xf5\x00\x00\x00\x00\x00\x00", "xSkewAngle (-11)"), (b"\x00\x05\x00\x00\x00\x00\x00\x00", "ySkewAngle (5)"), @@ -291,7 +296,7 @@ COLR_V1_XML = [ " </BaseGlyphV1Record>", ' <BaseGlyphV1Record index="1">', ' <BaseGlyph value="glyph00014"/>', - ' <Paint Format="10"><!-- PaintComposite -->', + ' <Paint Format="11"><!-- PaintComposite -->', ' <SourcePaint Format="6"><!-- PaintColrGlyph -->', ' <Glyph value="glyph00010"/>', " </SourcePaint>", @@ -398,25 +403,29 @@ COLR_V1_XML = [ " </Paint>", ' <Glyph value="glyph00013"/>', " </Paint>", - ' <Paint index="3" Format="8"><!-- PaintRotate -->', - ' <Paint Format="9"><!-- PaintSkew -->', - ' <Paint Format="5"><!-- PaintGlyph -->', - ' <Paint Format="2"><!-- PaintSolid -->', - " <Color>", - ' <PaletteIndex value="2"/>', - ' <Alpha value="0.5"/>', - " </Color>", + ' <Paint index="3" Format="8"><!-- PaintTranslate -->', + ' <Paint Format="9"><!-- PaintRotate -->', + ' <Paint Format="10"><!-- PaintSkew -->', + ' <Paint Format="5"><!-- PaintGlyph -->', + ' <Paint Format="2"><!-- PaintSolid -->', + " <Color>", + ' <PaletteIndex value="2"/>', + ' <Alpha value="0.5"/>', + " </Color>", + " </Paint>", + ' <Glyph value="glyph00011"/>', " </Paint>", - ' <Glyph value="glyph00011"/>', + ' <xSkewAngle value="-11.0"/>', + ' <ySkewAngle value="5.0"/>', + ' <centerX value="253.0"/>', + ' <centerY value="254.0"/>', " </Paint>", - ' <xSkewAngle value="-11.0"/>', - ' <ySkewAngle value="5.0"/>', - ' <centerX value="253.0"/>', - ' <centerY value="254.0"/>', + ' <angle value="45.0"/>', + ' <centerX value="255.0"/>', + ' <centerY value="256.0"/>', " </Paint>", - ' <angle value="45.0"/>', - ' <centerX value="255.0"/>', - ' <centerY value="256.0"/>', + ' <dx value="257.0"/>', + ' <dy value="258.0"/>', " </Paint>", "</LayerV1List>", ] @@ -1,5 +1,5 @@ [bumpversion] -current_version = 4.18.1 +current_version = 4.18.2 commit = True tag = False tag_name = {new_version} @@ -441,7 +441,7 @@ if ext_modules: setup_params = dict( name="fonttools", - version="4.18.1", + version="4.18.2", description="Tools to manipulate font files", author="Just van Rossum", author_email="just@letterror.com", @@ -1,6 +1,6 @@ [tox] minversion = 3.0 -envlist = mypy, py3{6,7,8}-cov, htmlcov +envlist = mypy, py3{6,7,8,9}-cov, htmlcov skip_missing_interpreters=true [testenv] |