Behdad Esfahbod
b63b8ceb8b
[GlyphCoordinates] Remove internal dual representation
...
Always store coordinates as float. Convert to int in __getitem__() if is whole.
This changes observed values. But we never made any guarantees so that's fine.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
acc56bdf72
[GlyphCoordinates] Faster .zeros()
...
Using .frombytes() since bytes() constructor can make zeros fast.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
7ef101ccb1
[GlyphCoordinates] Speed up .zeros()
...
Such a pain that this is a speedup...
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
f6e8577476
[GlyphCoordinates] Revert back from double to float
...
We do proper rounding these days, so revert this back.
https://github.com/fonttools/fonttools/pull/964#issuecomment-814511128
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
e9acd9634f
[GlyphCoordinates] Store int data as 4byte, not 2byte
...
The memory increase is negligible, but means that we don't have to
worry about integer overflows anymore.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
8be2f49b84
[GlyphCoordinates] Speed up __imul__()
...
Like the recent change to __isub__/__iadd__().
This, as well as the other, change do not handle overflows.
Going to fix that now.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
96690de9a9
[varLib] Optimize out multiplication by 1 when computing deltas
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
77abdad0f7
[GlyphCoordinates] Move identity check to scale() / translate()
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
45e94ff2bd
[GlyphCoordinates] Speed up __isub__() and __iadd__()
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
3892ece50c
[GlyphCoordinates] Remove Jython workaround
2021-04-08 09:41:45 -06:00
Cosimo Lupo
2136aac0f0
subset: fix pruning unused CPAL palettes when 0xFFFF is present
...
FIxes https://github.com/fonttools/fonttools/issues/2257
2021-04-06 19:43:45 +01:00
Nikolaus Waxweiler
256018953a
Bump version: 4.22.0 → 4.22.1.dev0
2021-04-01 11:18:27 +01:00
Nikolaus Waxweiler
c71275720c
Release 4.22.0
2021-04-01 11:18:26 +01:00
Cosimo Lupo
59e4e88d2e
Merge pull request #2249 from fonttools/CFF2fix
...
Add missing CFF2 dict operators
2021-04-01 11:08:24 +01:00
Just van Rossum
bf1b480064
Merge pull request #2251 from justvanrossum/improve-ttfont-getitem
...
[ttLib] Refactored TTFont.__getitem__ somewhat
2021-04-01 12:04:44 +02:00
justvanrossum
c7e736790f
TTFont.save: create file on disk only after compilation to tmp stream succeeded. This fixes #536
2021-03-31 15:38:39 +02:00
justvanrossum
6ff4444c41
refactored TTFont.__getitem__ somewhat: don't do major work in an exception handler; factor reading table from file into separate function
2021-03-30 21:26:54 +02:00
Zachary Scheuren
41da60f130
Add missing dict operators to CFF2
2021-03-30 21:24:14 +09:00
Behdad Esfahbod
8c59d4be0c
[subset] Improve PairPosFormat2 subsetting
...
This does two things:
1. Intersect subsetter glyphset with the table's Coverage before
passing to ClassDef1 for subsetting. Anything that doesn't
get past Coverage wouldn't ever get to ClassDef1,
2. Never reuse class0 of ClassDef2. There's unspoken assumption
that ClassDef2's class0 is never used for actual kerning, since
that's the unbounded "every other glyph" class. Previously our
ClassDef subsetter was reusing class0 if "every other glyph"
happened to become empty because of the subset glyphset. Don't
do that for PairPos's ClassDef2. As a result of this assumption,
don't keep a PairPosClass2 subtable if only ClassDef2's class0
survived subsetting.
Would be good to add tests for both.
Related to https://github.com/harfbuzz/harfbuzz/issues/2703
2021-03-29 16:17:27 +01: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
Chris Simpkins
7abf2e4c75
transition basestring
to str
...
https://github.com/fonttools/fonttools/issues/2232
2021-03-27 10:23:29 -04:00
Behdad Esfahbod
1e83650db8
[otlLib] Ensure built SinglePos ValueRecords are padded with 0s
...
Like when they are decompiled.
Part of https://github.com/fonttools/fonttools/pull/2237
2021-03-24 09:26:26 -07:00
Behdad Esfahbod
d961ef5e52
[otlLib] Ensure built PairPos2 ValueRecords are padded with 0s
...
Like when they are decompiled.
Part of https://github.com/fonttools/fonttools/pull/2237
2021-03-24 09:26:26 -07:00
Cosimo Lupo
b1ca16738c
[otlLib] Ensure built PairPos1 ValueRecords are padded with 0s
...
Like when decompiled.
See 2089d05126 (r48578120)
Part of https://github.com/fonttools/fonttools/pull/2237
2021-03-24 09:25:42 -07:00
Behdad Esfahbod
d0aaf1bceb
[feaLib] Set RangeStart/RangeEnd as float
...
Fixes the one failing test after previous commit.
2021-03-24 08:04:14 -07: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
Behdad Esfahbod
03d0a62078
Remove .Format from MultipleSubst as well
2021-03-23 18:01:06 -07:00
Behdad Esfahbod
8f79235d00
[Tests] Remove hack after Coverage .Format removal
2021-03-23 11:44:13 -07:00
Behdad Esfahbod
3d578dd1de
[varLib.merger] Adjust for removal of Coverage / ClassDef .Format
2021-03-23 11:05:00 -07:00
Behdad Esfahbod
69918d2945
Revert "[varLib.merge] Fix tests"
...
This reverts commit fb0c60cd2ce68df546ea2887946bc7f97bbb6921.
2021-03-23 11:02:41 -07:00
Behdad Esfahbod
10fe1c2636
Don't write Format for Coverage, ClassDef, Single/Alternate/LigatureSubst
...
The format values for those are automatically handled in
postRead/preWrite to choose optimal format. As such, don't write them
in XML. Reduces noise.
https://github.com/fonttools/fonttools/pull/2236#issuecomment-804523961
2021-03-23 11:01:53 -07:00
Nikolaus Waxweiler
2089d05126
Merge pull request #2229 from fonttools/varLib-otlLib-noreload
...
[varLib/otlLib] Allow merging into VariationFont without first saving GPOS PairPos2
2021-03-22 16:42:45 +00:00
Chris Simpkins
3e252d8c87
[py23] change deprecation warning from "next release" to "future release"
2021-03-20 11:52:12 -04:00
Behdad Esfahbod
0faf01d5f1
[otlLib] Generate Value1 / Value2 if respective formats are non-zero
...
Previously otlLib was generating None if the values themselves were
empty even if the value format was non-empty. This happened to work
for compiling to binary since the compiler handles Value=None.
But this was confusing varLib.merger module (as in when building
variable fonts from such otlLib-built master GSUB/GPOS tables, without
roundtripping to OTF/TTF binary first), because in varLib.merger,
a None means "this master doesn't provide that info; skip it"; whereas
in a PairPos table a None as generated by otlLib simply meant "all
values are zero", which is different from "this master doesn't
provide this value".
This fixes that, such that ufo2ft can build variable-font without
saving masters to binary.
Part of https://github.com/googlefonts/ufo2ft/pull/486
2021-03-19 13:59:27 -06:00
Simon Cozens
0aeb7f4895
Merge pull request #2226 from simoncozens/fix-merger-errors
...
(Even) better merger errors
2021-03-19 11:28:18 +00:00
Simon Cozens
baf6c5d1e1
Remove pass if we have a docstring
2021-03-19 10:48:58 +00:00
Simon Cozens
5d7c826b0b
Make CFF merge errors inherit differently
2021-03-19 10:40:02 +00:00
Simon Cozens
bfe4bad37b
Use kwargs and explicit stack
2021-03-19 10:38:15 +00:00
Simon Cozens
8ba31b0a43
Improve error message
2021-03-18 21:23:40 +00:00
Simon Cozens
956087eb81
super doesn’t magically call its own methods
2021-03-18 21:23:34 +00:00
Simon Cozens
3e0a87a146
Shorten exception names
2021-03-18 20:58:11 +00:00
Simon Cozens
6c547864b6
Use individual exception classes instead of enum
2021-03-18 15:49:49 +00:00
Simon Cozens
02ebcf8077
Redundant computation
2021-03-17 14:59:36 +00:00
Simon Cozens
bfc4ac9524
Compare enums by identity
2021-03-17 14:59:11 +00:00
Simon Cozens
b26728d3cb
Specifically catch VarLibMergeError
2021-03-17 11:56:02 +00:00
Simon Cozens
539b3cd71d
Special case must actually be special-cased
2021-03-17 11:52:50 +00:00
Simon Cozens
939962f858
Check we can actually get a name
2021-03-17 11:52:35 +00:00
Simon Cozens
2687c12c2e
Merge pull request #2225 from simoncozens/otllib-doc-nit
...
Correct otlLib documentation
2021-03-16 11:25:12 +00:00
Simon Cozens
f2f8a6a42a
Fix docstring too
2021-03-15 13:47:44 +00:00
Simon Cozens
1bf3cccead
Provide additional information for a common failure
2021-03-15 12:51:02 +00:00