Garret Rieger
086799357a
Enable sharing across subtables of extension for harfbuzz packing.
...
Harfbuzz repacker can handle subtables shared across extension lookups so there's no need to disallow such sharing. Add a parameter to _doneWriting to allow sharing to be enabled when preparing the object graph for passing to harfbuzz.
2022-05-25 23:55:43 +00:00
Cosimo Lupo
350f893e17
[otBase] demote repacker ERROR to WARNING, only 1 per loop; don't exit at firstfail
...
Fixes https://github.com/fonttools/fonttools/issues/2594
2022-04-22 19:05:54 +01:00
Cosimo Lupo
f68ce14d7a
[otBase] log the name of uharfbuzz exception
2022-04-22 15:31:34 +01:00
Cosimo Lupo
af6804bed5
make USE_HARFBUZZ_REPACKER a 3-state option, defaults to auto
...
if explicitly enabled, it will raise ImportError if uharfbuzz is not found, and will propagate the uharfbuzz error instead of silently falling back to the pure-python serializer
2022-04-21 18:11:20 +01:00
Cosimo Lupo
c204537073
[otBase] check USE_HARFBUZZ_REPACKER in TTFont.cfg, add more logging
2022-04-21 15:46:12 +01:00
Qunxin Liu
fe196bf88e
Use Harfbuzz Repacker for packing GSUB/GPOS tables
2022-04-14 10:42:50 -07:00
Cosimo Lupo
25746a3600
add clarifying comment as per review
2022-03-18 09:23:07 +00:00
Cosimo Lupo
ab8fc321a7
otBase: also return name and index from iterSubTables
...
makes it more useful for constructing generic traversals of trees of otTables
2022-03-17 17:47:41 +00:00
Cosimo Lupo
43d2ee2822
Revert "return self so one can do font=TTFont(file).ensureDecompiled()"
...
This reverts commit 61e7b294483cbe729b1437804406b4571ae57cfb.
2022-03-17 15:55:20 +00:00
Cosimo Lupo
61e7b29448
return self so one can do font=TTFont(file).ensureDecompiled()
2022-03-17 15:44:02 +00:00
Cosimo Lupo
ee27b73d7c
BaseTTXConverter: add ensureDecompiled method
...
to unlazify a whole tree of otTables, recursively
2022-03-17 12:54:22 +00:00
Cosimo Lupo
64dc37fc01
otBase: add iterSubTables method to iterate over all BaseTables
...
can be useful to traverse a tree of otTables
2022-03-17 12:53:06 +00:00
Simon Cozens
c04639af70
Add comment to demystify deduplication
2021-12-06 11:15:12 +00:00
Simon Cozens
00f37ea6b6
[docs] Split table docs into individual pages ( #2444 )
2021-11-18 09:01:27 +00:00
Khaled Hosny
232b2ccbc4
Move the rest of py23 module to textTools
...
Change all imports to use textTools module, except the test_py23.py test
which is kept until we decide to remove the module (if ever).
2021-08-20 01:29:45 +02:00
Behdad Esfahbod
7af43123d4
[otBase] Tiniest cleanup
2021-05-24 14:52:34 -06:00
Behdad Esfahbod
f21091b6ff
[otBase] Assert array.array('i').itemsize
2021-05-07 15:52:35 -06:00
Behdad Esfahbod
b8963256fd
[otBase/otConverters] Add back array index to exception in writeArray()
...
db6171df14 (r628543432)
2021-05-07 15:31:53 -06:00
justvanrossum
747f9f49b7
fix struct vs array mismatch: for array 'l' is 8 bytes, not 4. I'm not 100% sure this is correct for all platforms.
2021-05-04 18:54:26 +02:00
Behdad Esfahbod
db6171df14
[otBase] Actually call conv.writeArray()
...
Huh. Somehow the writeArray() was never wired up. We lose the failing
array index in the exception, but is fine to me.
2021-04-30 16:28:28 -06:00
Behdad Esfahbod
81ca053039
[otBase] Add array reader/writer for UInt24
2021-04-30 16:28:08 -06:00
Behdad Esfahbod
36dd271cd5
[otBase/otConverters] Add array-writers for int types
2021-04-30 15:58:45 -06:00
Behdad Esfahbod
1fd2a44bbf
[otBase] fix array-reader to return list, not array.array
...
Was not noticed because it was for the most part unused.
2021-04-30 15:57:53 -06:00
Behdad Esfahbod
df0d6bbadf
[otBase] Add array version of various int readers
2021-04-30 15:26:32 -06:00
Behdad Esfahbod
9959916c64
Merge pull request #2275 from fonttools/subset-device
...
[subset] Fix hint-dropping
2021-04-22 12:37:48 -06:00
Behdad Esfahbod
830cff6253
[ttLib] Add Value.getEffectiveFormat()
...
This ignores 0/None values that don't need to be encoded.
2021-04-21 14:10:27 -06:00
Garret Rieger
e0f1c15ad0
Include record size adjustment.
2021-04-21 12:15:29 -07:00
Just van Rossum
5fc65d7168
Misc py23 cleanups ( #2243 )
...
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
2021-03-29 11:45:58 +02:00
Behdad Esfahbod
6243a24a09
[otBase] Delete .Format if was introduced by .preWrite()
...
https://github.com/fonttools/fonttools/pull/2238#issuecomment-805192631
2021-03-23 18:13:07 -07:00
Cosimo Lupo
c7e3a692e1
otBase: support FormatSwitchingBaseTable with uint8 Format type
2020-10-08 12:39:56 +01:00
Cosimo Lupo
d60d84d3fc
otBase/otConverters: add support for 3-byte offsets
2020-10-08 12:39:54 +01:00
Cosimo Lupo
690080b14d
use 32-bit GlyphIDs in COLRv1 baseGlyphs and layers
...
For forward-compatibility, see https://github.com/googlefonts/colr-gradients-spec/issues/8
2020-07-01 19:50:48 +01:00
Cosimo Lupo
b32a1072b5
otBase: propagate pre-initialized CountReferences so nested subtable see them
2020-02-04 17:14:12 +00: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
Nikolaus Waxweiler
01328213c7
Remove __future__ imports
2019-08-09 12:20:13 +01:00
Cosimo Lupo
71812bbb29
otBase: call populateDefaults() in BaseTTXConverter.fromXML
...
https://github.com/fonttools/fonttools/issues/1584
This will initialise to None all the missing fields for top-level OT tables like GPOS or GSUB after importing fromXML
2019-04-20 17:44:47 +01:00
justvanrossum
723e7a1d3c
updated inline github issue URLs
2019-03-06 16:01:28 +01:00
Behdad Esfahbod
349cd94d17
[graphite] Fix for big-endian
...
Make all "if sys.byteorder..." and "byteswap" be on the same line for
earsier grep verification.
Fixes https://github.com/fonttools/fonttools/issues/1311
2018-09-05 21:12:53 -07:00
Behdad Esfahbod
05f95f0f58
[otBase] Try ExtensionLookup if other offset-overflow methods fail
...
If offset overflow happens other than between Lookup and SubTable, or
within SubTable, then we don't know how to fix it currently. Now we
try to put that lookup in an Extension lookup anyway, since that will
isolate it and sharing with other lookups won't happen, hopefully
avoiding the overflow.
This is really a bandaid... What we want is the 99proof branch to
be finished and replace our current packing algorithm.
Fixes https://github.com/fonttools/fonttools/issues/1296
2018-07-25 11:06:44 -07:00
Behdad Esfahbod
642cb03296
Remove unused line of code
2018-07-25 11:06:44 -07:00
Behdad Esfahbod
795f2f95fb
[otBase] Fix sharing of tables referred to by different offset sizes
...
When an offset refers to a table, we keep the size of the offset to
the referred-to table. When sharing tables, we were ignoring this,
which could result in a long offset being written out as a short, or
vice versa. Fix it by not sharing such tables. This is not optimal
but fixes the bug.
Bug has been there forever.
2018-04-25 20:57:19 -07:00
Behdad Esfahbod
95838bd4df
[otBase] If decoding tables fails, append breadcrumb to exception
2018-04-25 15:53:43 -07:00
Behdad Esfahbod
d3a6a4e9e4
Don't fail during ValueRecord copy if src has more items
...
We drop hinting by simply changing ValueFormat, without cleaning
up the actual ValueRecords. This was causing failure at this assert
if font was subsetted without hinting and then passed to mutator.
2018-03-26 12:54:57 -07:00
Behdad Esfahbod
073227bbb0
[varLib.varStore] Start implementing a VarStore optimizer
...
Commandline takes varfont and optimizes its GDEF VarStore.
2018-02-20 20:58:18 -08:00
Behdad Esfahbod
1aafae816d
Allow decompiling fonts with bad Coverage format number
2017-12-14 19:03:54 -08:00
Sascha Brawer
f5793401ce
[AAT] Implement bsln
baseline table
...
The AAT baseline table uses arrays whose length is constant instead of
getting encoded in the data. Extended otBase to support such arrays.
2017-08-25 03:55:06 -07:00
Sascha Brawer
d05617b4bd
[AAT] Support prop
table with glyph properties
2017-08-17 11:09:53 -07:00
Behdad Esfahbod
8b4f0bb1e4
[morx] Write StructLength properly
...
Code looks like a hack, but is solid.
2017-08-14 12:34:56 -07:00