157 Commits

Author SHA1 Message Date
Behdad Esfahbod
776e1ce132 [cffLib.specializer] Fix CFF argument stack overflow
The code was always merging at least two blends, which was causing
stack-overflow with a test font of ours. Move the overflow check
earlier to catch that.

Fixes https://github.com/fonttools/fonttools/issues/3676
2024-11-05 10:38:00 -05:00
Behdad Esfahbod
614d9ebf6b [cffLib.specializer] Minor refactor 2024-11-04 13:52:28 -05:00
Behdad Esfahbod
20b47fc989 [CFF2] Lift uint16 VariationSore.length limitation
Fixes https://github.com/fonttools/fonttools/issues/3673
2024-10-30 09:15:49 -06:00
Behdad Esfahbod
9372554dce [cffLib] Typo 2024-10-29 10:31:42 -07:00
Behdad Esfahbod
7a0062a718 [cffLib.specializer] Add cmdline to specialize a CFF2 font 2024-10-29 08:25:20 -06:00
Behdad Esfahbod
4ad6b0db13 [CFF2ToCFF] Map charset to CIDs
This seems to fix the case of ttx not handling the results.
I *think* this fixes the rest of the issues I've been seeing
with this conversion.
2024-10-23 11:36:26 -06:00
Behdad Esfahbod
c384709c0a [CFF2ToCFF] Convert FD's to CFF1
Makes ftview like the font, but still not ttx.
2024-10-23 11:36:26 -06:00
Behdad Esfahbod
87ae6ba224 [CFF2ToCFF] Remove wrong and unnecessary argument
This had no effect though, since file is None.
2024-10-23 11:36:26 -06:00
Behdad Esfahbod
4360969baa [cffLib.transforms] Handle case of one FD in remove_unused_subrs 2024-10-23 11:36:26 -06:00
Behdad Esfahbod
2225c84a1b [CFFToCFF2] Allow fdIndex==0
Oops.
2024-10-23 11:36:26 -06:00
Nathan Williis
69cecfaa10 Docs: cffLib, minor updates. 2024-09-17 17:23:44 +01:00
Behdad Esfahbod
39093b9b7e [cffLib] Add optional removeUnusedSubrs arg to remove_hints() 2024-05-25 10:15:00 -06:00
Behdad Esfahbod
129e8e34a5 [cffLib] Typo 2024-05-25 10:15:00 -06:00
Behdad Esfahbod
9943a109e8 [CFF2ToCFF] Clean up dicts and privates 2024-05-25 10:15:00 -06:00
Behdad Esfahbod
1076f2c558 [CFF2ToCFF] Remove unused code 2024-05-25 10:15:00 -06:00
Behdad Esfahbod
6a812ce925 [CFFToCFF2] Fix for non-FDArray fonts and subroutines 2024-05-25 10:15:00 -06:00
Behdad Esfahbod
aba4f52dea [CFFToCFF2] Remove unused subroutines if necessary
The transforms.py changes are for them to work with fonts
without font.charset. I'm not sure how we didn't catch these
before.
2024-05-23 12:19:39 -06:00
Behdad Esfahbod
33beeaa1a2 [CFFToCFF2] Keep charset during initial round
See comments.
2024-05-23 12:19:30 -06:00
Behdad Esfahbod
d757bfac8a [cffLib] Add remove_hints() and remove_unused_subroutines() methods
From subset.cff.
2024-05-21 13:42:50 -07:00
Behdad Esfahbod
a851d02519 [cffLib] Move desubroutinize code to new cffLib.transforms module 2024-05-21 13:42:50 -07:00
Behdad Esfahbod
d77077125b [CFFToCFF2] Use a custom exception instead of TypeError 2024-05-17 12:57:17 -07:00
Behdad Esfahbod
56cf131088 [CFFToCFF2] Add comment 2024-05-17 11:50:00 -07:00
Behdad Esfahbod
397a19deb7 [CFF2ToCFF] Don't decompile subroutines
They can't be decompiled standalone. Decompiling glyph programs
already decompiled the used ones.
2024-05-17 11:35:11 -07:00
Behdad Esfahbod
ee1632c584
Update Lib/fontTools/cffLib/CFF2ToCFF.py
Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
2024-05-17 12:31:54 -06:00
Behdad Esfahbod
ade8ff627d [CFFToCFF2] Process charstrings before TopDict
Otherwise it fails for charset fonts.
2024-05-17 08:22:41 -07:00
Behdad Esfahbod
d684952b6c [CFFToCFF2] Upconvert subroutines and charstrings
Also drop explicit width. See comments.
2024-05-16 18:04:59 -07:00
Behdad Esfahbod
53e141fc41 [cffLib.CFF2ToCFF] Update post table version if needed 2024-05-16 16:34:24 -07:00
Behdad Esfahbod
0a7433f847 [cffLib] Add CFF<->CFF2 convertors that work on otFont 2024-05-16 16:29:22 -07:00
Behdad Esfahbod
b009b614f3 [cffLib.CFF2ToCFF] Fixup 2024-05-16 16:16:14 -07:00
Behdad Esfahbod
1d1b7eb2f2 [cffLib] Add --verbose / --quiet to convertors
As well as actually save!
2024-05-16 16:07:03 -07:00
Behdad Esfahbod
ec36fe74d5 [cffLib / varLib] Merge two impls of convertCFFToCFF2
Fixes https://github.com/fonttools/fonttools/issues/1835
2024-05-16 15:57:31 -07:00
Behdad Esfahbod
4384eef42e [cffLib] Comment 2024-05-16 15:33:22 -07:00
Behdad Esfahbod
39ec4e6c0c [cffLib] Add CFFToCFF2 and CFF2ToCFF cmdline and module
The CFF2ToCFF module is rather solid, at least IMO.

This takes convertCFFToCFF2 from cffLib. Apparently there's a more
complete one in varLib.cff:

https://github.com/fonttools/fonttools/issues/1835

Should merge the two and finish them.
2024-05-16 10:47:24 -07:00
Behdad Esfahbod
60e30fe008 [cffLib] Add a simple (and quite possibly incomplete) convertCFF2ToCFF() 2024-05-15 17:33:00 -07:00
Behdad Esfahbod
c22f7d5af4 [cffLib.specializer] Simplify vsindex protocol 2024-05-14 18:13:51 -06:00
Behdad Esfahbod
cbec49c72c [cffLib] A couple of fixups
In particular, I don't know why we were appending a 'return'
at the end of CFF2 desubroutinized charstrings!
2024-05-14 11:56:15 -06:00
Behdad Esfahbod
1891a7220d [instancer/CFF2] Fixups 2024-05-14 11:11:39 -06:00
Behdad Esfahbod
21fb882e67 [instancer/CFF2] Prune ununsed data 2024-05-14 00:35:09 -06:00
Behdad Esfahbod
9f51fac512 [cffLib] Make sure we compile VarStore
Ouch. Took me a while to find this bug. If data is set,
it will be reused and no compilation happens.
2024-05-13 22:47:22 -06:00
Behdad Esfahbod
ce78d2c88f Typo 2024-05-13 17:17:30 -06:00
Khaled Hosny
cf08265cd5 Black 2024-02-06 15:47:35 +02:00
Cosimo Lupo
53e71f9eb7
Merge pull request #3309 from fonttools/pyup-scheduled-update-2023-10-23
Scheduled weekly dependency update for week 43
2023-11-03 10:33:00 +00:00
Cosimo Lupo
335a1e56ec re-run black v23.10 on all .py files 2023-11-03 10:25:15 +00:00
Khaled Hosny
48da520472 Fix SyntaxWarning in Python 3.12
Fixes https://github.com/fonttools/fonttools/issues/3311
2023-10-25 14:34:27 +03:00
Cosimo Lupo
4b73a17e0c
[cff.specializer] Fix SyntaxWarning: invalid escape sequence
Fixes #3322
2023-10-25 10:33:31 +01:00
Cosimo Lupo
a8bd0ef1b0
CFF: use latin1 so we can roundtrip non-ascii in FullName|FontName|FamilyName
Fixes #2898

use Latin1Converter for all name strings, and not just for Notice and Copyright. Then at least we can round-trip binary=>TTF=>binary, even if the TTX will not show the intended string.

Given that any non-ASCII in FullName can be considered broken, this at least this would let us round-trip without error.
2023-07-10 18:12:49 +01:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
4650b8d293 [cff] Store varStore in CharStrings 2022-08-26 21:00:37 -06:00
Behdad Esfahbod
d4d8c4ac5b [scaleUpem] Support CFF/CFF2 2022-08-19 11:03:23 -06:00
Behdad Esfahbod
61160fe5db [cffLib.specializer] Fix generalizer blend
Fixes https://github.com/fonttools/fonttools/issues/1975
2022-08-17 11:13:42 -06:00