146 Commits

Author SHA1 Message Date
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
Behdad Esfahbod
2963fa503a [cffLib.widths] Fix off-by-one in values
Was wrong; didn't match the code block above it.
2022-08-09 21:44:08 -06:00
Khaled Hosny
4bb0e776a7
Merge pull request #2570 from fonttools/cff-TopDictIndex
[cffLib] Fix calls to TopDictIndex()
2022-04-01 00:24:17 +02:00
Behdad Esfahbod
c7781ec423 [cffLib] Remove leftover GlobalState
Fixes https://github.com/fonttools/fonttools/issues/1848
2022-03-31 15:34:11 -06:00
Behdad Esfahbod
64fc028eee [cffLib] Fix calls to TopDictIndex()
Fixes https://github.com/fonttools/fonttools/issues/1847
2022-03-31 15:33:05 -06:00
Khaled Hosny
8e9ab24c11 [cffLib] Move desubroutinize from subset module to CFFFontSet
This way we can use it from both subset and merge modules.
2021-11-17 21:03:49 +02: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
Zachary Scheuren
41da60f130 Add missing dict operators to CFF2 2021-03-30 21:24:14 +09: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
Simon Cozens
8d32a24710
[docs] Source documentation for cffLib (#1935)
* [docs] Source documentation for cffLib

* Address feedback
2020-05-14 17:04:34 +01:00
Simon Cozens
089f24da6b
Ensure all fonttools CLI tools have help documentation (#1948)
Note UI change : `fonttools varLib.models` now takes prefixed options `-d` or `-l` instead of guessing the intended feature from the number of arguments.

We have a number of command line tools which are somewhat opaque. (varLib.models in particular was very confusing.) This ensures that they all use argparse to have a consistent interface, and all have --help documentation which at least details their parameters, and hopefully therefore gives more of a clue about what they do. Those which use logging have had a command-line logging parameter added.
2020-05-12 15:11:30 +01:00