85 Commits

Author SHA1 Message Date
Nathan Williis
d05cdcf21f Docs: black 2024-09-11 15:48:09 +01:00
Nathan Williis
7d93689aca Docs: workaround doctest-vs-Sphinx syntax highlighting. 2024-09-11 15:45:46 +01:00
Nathan Williis
21d04842f8 Docs: fix code-example blocks in ttLib. 2024-09-03 17:55:02 +01:00
Behdad Esfahbod
e22953e807 Black 2024-05-22 18:45:27 -06:00
Behdad Esfahbod
0e52857ffe [VARC] Start drawing VARC glyphs 2024-05-22 18:45:27 -06:00
Behdad Esfahbod
4e57e36c8b Typo 2024-05-16 18:17:40 -07:00
Behdad Esfahbod
bf6ff3b514 [avar] Add support for mapping avar2
Untested.
2024-04-02 10:23:09 -06:00
Behdad Esfahbod
781dda70de [ttFont] Move some code into fvar and avar modules 2024-04-02 10:23:09 -06:00
Behdad Esfahbod
2c9d97652d [ttFont] Add reorderGlyphs
Fixes https://github.com/fonttools/fonttools/issues/2060
2024-03-30 17:22:38 -06:00
Khaled Hosny
cf08265cd5 Black 2024-02-06 15:47:35 +02:00
Behdad Esfahbod
772dc549f3
[ttGlyphSet] Add option to not recalculate glyf bounds (#3348)
Avoids unnecessary work in the interpolator.
2023-11-21 12:06:57 -07:00
Cosimo Lupo
335a1e56ec re-run black v23.10 on all .py files 2023-11-03 10:25:15 +00:00
Tim Maffett
61ca53ab10 fix ttx split tables option to work on source files which have been url encoded and contain the '%' character 2023-04-28 17:07:44 -07:00
Cosimo Lupo
4543910367
[ttFont] fail when input is not seekable and lazy=True
the SFNTReader expects the input file to be seekable, and it already rewinds the file with file.seek(0) to get to the sfnt table directory. Thus, if TTFont is loaded with an unseekable file object and lazy=True, we raise a TTLibError requiring one to either pass a seekable input file, or to not set lazy=True (in which case the input is loaded in a seekable BytesIO)

Fixes https://github.com/fonttools/fonttools/issues/3052
2023-03-21 18:15:01 +00:00
Cosimo Lupo
b137fd9616
ttFont: raise KeyError from getGlyphID instead of returning None
Fixes #3030
2023-03-10 11:38:55 +00:00
Cosimo Lupo
15b450e4a6
[ttx] support reading font/xml file from standard input as '-'
Fixes https://github.com/fonttools/fonttools/issues/3019
2023-03-03 14:13:06 +00:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Miguel Sousa
96c9250cf8 Update warning message [skip ci] 2022-08-31 08:52:17 -07:00
Miguel Sousa
a2efac012c Add warning log 2022-08-30 23:56:03 -07:00
Miguel Sousa
0e9c48e6ab Don't crash when post format 1 is improperly used
Fixes #2736
2022-08-30 09:14:03 -07:00
Just van Rossum
6ec0177f1f tweak getGlyphSet() doct string, using backticks, and fixing a typo 2022-08-30 08:49:36 +02:00
Just van Rossum
6d2a9904c4 Add TTFont.normalizeLocation() as a public method. 2022-08-30 08:49:36 +02:00
Just van Rossum
cca0faae74 oops, look at 'normalized' flag again 2022-08-30 08:49:36 +02:00
Just van Rossum
0c68a5621a move normalization of location to TTFont 2022-08-30 08:49:36 +02:00
Just van Rossum
7aa4c0fb29 Avoid glyphSetClass variable; reads a little bit better 2022-08-30 08:49:36 +02:00
Just van Rossum
8fb071a403 remove redundant initializer 2022-08-30 08:49:36 +02:00
Just van Rossum
b45d9b014a simplify class selection logic 2022-08-30 08:49:36 +02:00
Just van Rossum
65814c3ccd inline haveCFF condition 2022-08-30 08:49:36 +02:00
Just van Rossum
b818e1494f Refactor ttGlyphSet.py
- only differentiate between glyf and CFF/CFF2 implementations, not var vs non-var
- use collections.abc.Mapping to get a more consistent dict-like object with less code
- prefer HVAR metrics over gvar metrics
- move some responsibilities from the _TTGlyphSet objects to the _TTGlyph objects
- adjust some tests to the changes
2022-08-30 08:49:36 +02:00
Behdad Esfahbod
9fe1f8c73e [ttVarGlyphSet-cff] Handle non-variable fonts 2022-08-26 21:20:56 -06:00
Behdad Esfahbod
a7cda37fbb [ttVarGlyphSet] Support CFF 2022-08-26 20:52:18 -06:00
Behdad Esfahbod
376caff386
Merge pull request #2718 from fonttools/visitor
Add fontTools.misc.visitor, fontTools.ttLib.ttVisitor, ttLib.scaleUpem, Snippets/print-json.py
2022-08-18 06:12:19 -06:00
Behdad Esfahbod
9b0d0e7b56 [visitor] ensureDecompiled(recurse=False) 2022-08-15 12:09:26 -06:00
Behdad Esfahbod
dc99ab6b3f [ttGlyphSet] Address review comments 2022-08-15 11:06:51 -06:00
Behdad Esfahbod
87deecebe2 [ttFont] Add "recurse" argument to ensureDecompiled() 2022-08-14 14:42:21 -06:00
Behdad Esfahbod
3ae5a673bc [ttFont/ttGlyphSet] Add option to pass normalized locations 2022-08-14 12:08:12 -06:00
Behdad Esfahbod
c148dc76e6 [ttFont/ttGlyphSet] Add API for drawing variable fonts
Fixes https://github.com/fonttools/fonttools/issues/1021
2022-08-14 12:08:12 -06:00
Behdad Esfahbod
0d1550febe [ttFont] Split TTGlyphSet code into ttGlyphSet.py 2022-08-14 12:08:12 -06:00
Jany Belluz
abc0441957 [config] Add new config module and use it for GPOS compression level 2022-04-14 15:23:02 +01:00
justvanrossum
c6cd6cf421 [TTFont] sync doc string with the one in _c_m_a_p.py (see also #1367) 2022-04-09 08:31:03 +02: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
46f33357cb TTFont: don't load all tables upon opening even with lazy=False
one has to call TTFont.ensureDecompiled to load everything
2022-03-17 13:48:40 +00:00
Cosimo Lupo
795bccd966 TTFont: load all on open w/ lazy=False; add ensureDecompiled
Make lazy=False actually do what it says, 'load everything eagerly'. It feels weird that one has to, not only say, open with lazy=False, but also have to load each tables individually... Didn't I say don't be lazy?!

Also it can be useful to get to a eager, non-lazy font whether or not it was originally loaded lazily, so I added an ensureDecompiled method that decompiles all the tables and calls ensureDecompiled for those (e.g. cmap, glyf and otData-driven tables like GSUB, GPOS, etc.) that respect the lazy attribute.
2022-03-17 13:01:22 +00:00
Cosimo Lupo
3529a44f75 Update glyf's glyphOrder when calling TTFont.setGlyphOrder()
https://github.com/fonttools/fonttools/issues/2060#issuecomment-1063932428
2022-03-10 11:29:17 +00:00
Simon Cozens
0f03e6529a
[docs] Fix sphinx warnings (#2453)
* Add default auto doc options

* Ensure all references are unique

* Use anonymous links to avoid duplicate references

* Remove default options, fix wrong module name

* Don’t index repeated class

* Remove repeated classes included through automodule

* Fix warnings

* We don’t use our own static directory

* Correctly format XML in docs

* Fix indentation

* Fix overline

* Bring TOC to top

* Fix definition list

* Offset definition lists and examples

* Fix erroneous markup

* Fix markup

* Already included in automodule

* Fix args markup

* Correct markup for example

* Don’t reindex repeated module

* Correct XML code block markup

* Fix markup errors, change example to doctest

* Correct list markup

* Make ttx docstring both valid RST and valid help output

* Various other boring markup fixes

* Fix example indenting

* Make docstring valid RST and valid help output

* Mock import for reportlab

* It’s ok if manual links don’t appear in toctrees

* Oops typo, I guess doctests are useful
2021-12-02 15:31:49 +00:00
Simon Cozens
e0dc30aa2d
[docs] Improve documentation for fontTools.ttLib.ttFont (#2442) 2021-11-18 13:06:02 +00:00
Behdad Esfahbod
3eef446efe [ttFont] Address review comments 2021-08-23 16:06:18 -06:00
Behdad Esfahbod
ca06c9530c [ttFont] Assume GlyphOrder is never modified after setting
See https://github.com/fonttools/fonttools/pull/2398#discussion_r694271551
2021-08-23 14:59:11 -06:00
Behdad Esfahbod
d5de11d805 [ttFont] Make setGlyphOrder() clear reverseGlyphOrderMap
Part of https://github.com/fonttools/fonttools/pull/2398
2021-08-23 14:01:26 -06:00