Cosimo Lupo
5128715565
Merge pull request #1929 from simoncozens/woff2-repeated-init
...
Use inheritance to avoid repeated code in WOFF2FlavorData initializer
2020-05-11 11:12:52 +01:00
Cosimo Lupo
07e3cf7ef6
Merge pull request #1928 from simoncozens/unused-loop-variable
...
Use _ to denoted unused loop variable
2020-05-11 11:10:57 +01:00
Simon Cozens
253de13377
Use inheritance to avoid repeated code in WOFF2FlavorData initializer
2020-05-07 21:04:52 +01:00
Simon Cozens
46c8f90da8
Use _ to denoted unused loop variable
2020-05-07 21:00:28 +01:00
Just van Rossum
4febf38be2
[ttLib.name] Add nameTable.findMultilingualName() method ( #1921 )
...
* add nameTable.findMultilingualName(), to find an existing multilingual name
* Make addMultilingualName() reuse nameIDs if possible when asking for a new nameID, by calling findMultilingualName()
2020-05-07 11:06:51 +02:00
justvanrossum
b4c5b07741
sort XML output by glyph name
2020-04-29 16:31:54 +02:00
Cosimo Lupo
3110944745
Merge remote-tracking branch 'origin/master' into otdata-colr
2020-03-23 13:09:33 +00:00
Jan Sindler
15aa8dce79
hex above repr
2020-03-23 12:43:42 +01:00
Jan Sindler
13b2455675
init removed, back to inhereted namedtuple
2020-03-23 12:22:02 +01:00
Jan Sindler
08cd70e222
fixed spaces
2020-03-23 12:02:13 +01:00
Jan Sindler
0a33dbdc99
CPAL/Color, fromRGBA, added __init__, moved dunder repr to the dunder part of the Color class
2020-03-23 12:00:08 +01:00
Cosimo Lupo
d2bbfdb610
Merge remote-tracking branch 'origin/master' into otdata-colr
2020-03-12 17:42:56 +00:00
Simon Cozens
681ca4ae0c
Test the flags, not the value
...
Avoids an empty comment when reserved values are used.
2020-03-12 11:51:36 +00:00
Cosimo Lupo
49d504d970
otData: fix Offset decriptions for COLRv1 subtables
2020-03-11 19:01:26 +00:00
Cosimo Lupo
8b32b79e8d
C_O_L_R_: remove unused lines
...
name attribute is always a glyph name (str), never an int
2020-03-11 19:01:25 +00:00
Simon Cozens
8fac69b0ea
Also output mark attachment class
2020-03-11 13:59:05 +00:00
Simon Cozens
ab075a9957
Annotate LookupFlag ttx dump
2020-03-10 21:42:28 +00:00
Cosimo Lupo
b2a0d62295
otConverters: in _NamedTupleConverter only dump to XML non-default values
...
so we don't see varIdx='0' dumped all the time, even when there are no variations in font
2020-03-09 16:15:33 +00:00
Cosimo Lupo
e57f8b59d7
make ttLib.C_O_L_R_ a hybrid that keeps old API for v0, uses otTables for COLRv1
2020-03-06 18:39:14 +00:00
Cosimo Lupo
c42c4162c2
add otConverter for namedtuples and use it for Variable{Scalar,Position,Distance}
...
in COLRv1 all scalar values have associated varIdx to support variations. I want to load them as
immutable namedtuples, and also I want to dump them as simple XML tags with 'value' and 'varIdx'
attributes, instead of normal otTables (i.e. with nested Value and VarIdx sub-elements) as
that would make them too verbose in the XML dump.
So I made a custom _NamedTupleConverter, as a base class for VariableScalar, etc.; sub-classes
must provide a tupleClass and a list of converterClasses for each namedtuple field.
The ExtendMode enum has also a custom converter to dump it as string in the XML, and load it
as IntEnum.
fixup
2020-03-06 18:35:32 +00:00
Cosimo Lupo
4e6eec964c
COLR: remove ability to get/set by glyphID as incoherent with rest of ttLib classes
2020-03-02 13:10:47 +00:00
Cosimo Lupo
d659e055b2
Merge remote-tracking branch 'origin/master' into otdata-colr
2020-03-02 10:59:55 +00:00
Cosimo Lupo
be147e965d
woff2: don't attempt to normalize glyf/loca if missing (e.g. CBDT/CBLC fonts like NotoColorEmoji.ttf)
2020-02-26 18:14:31 +00:00
Cosimo Lupo
f60bcc2c5a
[CPAL] the absence of a color palette label nameID is 0xFFFF, not 0
2020-02-17 17:03:37 +00:00
Cosimo Lupo
7c023c42af
[glyf] if comp uses anchors compute firstPt-secondPt offset after applying transform
...
Fixes https://github.com/fonttools/fonttools/issues/1556
When a component uses firstPt/secondPt reference anchor points instead of XY offsets,
and the component also has a transform, fonttools is incorrectly computing its bounding box.
This is because we are computing the translation offset between firstPt and secondPt before
applying the 2x2 scale/rotation/shear transform. By the time we do the translation, the
offset is now incorrect.
We need to compute the translation offset after we have applied the 2x2 transform.
2020-02-13 18:07:57 +00:00
Cosimo Lupo
9c7ceadc0e
[glyf] compile empty table as 1 null byte to make OTS and Windows happy
...
Fixes #899
See https://github.com/khaledhosny/ots/issues/52#issuecomment-289369267
2020-02-12 14:25:25 +00:00
Cosimo Lupo
16bff17483
head: when checking for extra padding at end of table, must compare bytes, not str
2020-02-12 12:53:09 +00:00
Cosimo Lupo
d2026bd651
WIP: otData: define draft COLRv1 structures
...
https://docs.google.com/document/d/1EPndWsdMK_M135FOIxQZ--dHpH727rXEBvLZqgIzZvs/edit#
2020-02-11 16:33:38 +00:00
Cosimo Lupo
29422a49f3
C_O_L_R_: further simplify decompile
2020-02-11 13:46:45 +00:00
Cosimo Lupo
fb92f228af
C_O_L_R_: simplify toXML
2020-02-11 13:30:20 +00:00
Cosimo Lupo
67c97f214a
C_O_L_R_: use OTTableReader and Writer instead of struct to decompile/compile
...
But keep the existing C_O_L_R_ table interface for backward compatibility.
2020-02-10 13:45:44 +00:00
Cosimo Lupo
8e48c57a00
otTables: initialize a CountReference for LayerRecordCount in COLR.preWrite
2020-02-04 17:14:52 +00:00
Cosimo Lupo
b32a1072b5
otBase: propagate pre-initialized CountReferences so nested subtable see them
2020-02-04 17:14:12 +00:00
Cosimo Lupo
145bcd62bd
otTables: add COLR subclass to decompile LayerRecordCount before the rest
2020-02-04 17:03:40 +00:00
Cosimo Lupo
e56c0ee1a4
otConverters: BaseGlyphRecordCount and LayerRecordCount are 'propagated' counts
...
ie. they count things inside nested sub-tables
2020-02-04 17:01:31 +00:00
Cosimo Lupo
73b715732a
otData: define COLRv0 structures
2020-02-04 17:00:20 +00:00
Khaled Hosny
b9bc128f2c
Merge pull request #1816 from khaledhosny/varlib-cff2-source
...
[varLib] Allow using CFF2 table as source
2020-02-03 17:17:02 +02:00
Khaled Hosny
09174b9129
[CFF2] Make recalcBBoxes work with CFF2 table
...
Add checks for CFF2 table next to CFF checks as applicable.
2020-01-31 23:39:47 +02:00
Cosimo Lupo
c5dfbab521
EBLC: fix padding length calculation for Format 3 IndexSubTable
...
Fixes #1817
2020-01-31 17:30:12 +00:00
Cosimo Lupo
504450e053
otTables: update MarkRecord.Class in splitMarkBasePos
...
Fixes https://github.com/googlefonts/noto-source/issues/145
2020-01-07 13:24:40 +00:00
Antony Lee
4fa68d1989
Get rid of SyntaxWarning with py3.8.
...
On a clean clone (make sure there are no pycs present yet),
```
python -c 'import fontTools.ttLib.tables._c_m_a_p'
```
results in
```
.../fontTools/ttLib/tables/_c_m_a_p.py:21: SyntaxWarning: "is" with a literal. Did you mean "=="?
if gid is 0:
```
Fix that.
2020-01-06 11:30:30 +01:00
Just van Rossum
cf0e43d6e5
[ttLib.glyf] make glyph.draw() skip redundant final lineTo() ( #1775 )
...
* [ttLib.glyf] make glyph.draw() skip redundant final lineTo()
This ensures that g.draw(pen) and g.drawPoints(PointToSegmentPen(pen)) are now 100% equivalent.
2019-12-12 13:44:10 +01:00
Just van Rossum
e2c60e3dcb
[ttLib.glyf] Fix flag bug in glyph.drawPoints() ( #1774 )
...
This was the same problem as glyph.draw() had, as reported in #1771 .
2019-12-08 21:55:30 +01:00
Just van Rossum
46a06cabf2
[ttLib.glyf] Make sure to use the flagOnCurve mask in glyph.draw() ( #1772 )
...
* When drawing glyf outlines to a pen, make sure to use the flagOnCurve mask, so we don't trip over the overlap flag, that is set when instantiating variable fonts to indicate that overlaps are ok.
Fixes #1771 .
2019-12-06 10:27:31 +01:00
Behdad Esfahbod
9df78f303b
[otData] Support BASE table version 1.1
2019-10-31 11:45:49 -07:00
Cosimo Lupo
ebadcd96e6
set pre-initialized CountReference in VarRegionList.preWrite with fvar.axisCount
...
so we can reuse CountReference class, as suggested in https://github.com/fonttools/fonttools/pull/1752#issuecomment-547113944
The patch is no shorter though.
2019-10-29 12:52:42 +00:00
Cosimo Lupo
e8f5bbcc6a
renamed LiteralCount to StaticCount
...
makes it clearer what it is
2019-10-24 15:42:09 +01:00
Cosimo Lupo
adc5b2997e
[otBase|otTables] enforce VarStore RegionAxisCount == fvar.AxisCount
...
even when there are no Regions and thus we can't take the length of VarRegionAxis array.
This is to appease older versions of OTS which blindly enforce this rule and
reject a VF that has, e.g., an empty HVAR table with no regions if the
HVAR.VarStore.VarRegionList.RegionAxisCount != fvar.AxisCount.
Fixes https://github.com/fonttools/fonttools/issues/1670
Related:
https://github.com/fonttools/fonttools/pull/1671
https://github.com/googlefonts/fontmake/issues/565
https://github.com/khaledhosny/ots/pull/192
2019-10-24 12:54:16 +01:00
msoxzw
fcbbce5ca2
Add with statement context manager like ttFont
2019-10-21 07:03:45 +00:00
Nikolaus Waxweiler
969df8303b
Remove some Python 2 era import gaming
2019-10-11 22:36:33 +01:00