190 Commits

Author SHA1 Message Date
n8willis
63611d4474
Merge pull request #3627 from n8willis/docs-cleanup
Docs: clean up various code blocks in docstrings, to enable correct syntax highlighting in HTML / RTD output.
2024-09-16 10:40:05 +01:00
Harry Dalton
07351d12e6 Fix visual artefacts with partial L2 instancing
Closes #3634

To produce inferred deltas that will be correct given OpenType's gvar
semantics, fontTool's IUP optimisation module checks the equality of
some points. However, this happens before the points are rounded,
whereas the point comparison that happens at runtime will occur after
the points are rounded (as is necessary to serialise glyf), which leads
to diverging semantics and so diverging and incorrect implied deltas.

This leads to significant visual artefacts, e.g. where large deltas that
should be inferred based on previous values are instead interpreted as 0
at runtime.

I suspect this has gone undetected as the subsetter normally works with
rounded points; in the rarer case that partial VF instancing is
occurring with a different default position, however, varLib.instancer
will calculate and apply the relevant deltas to the font's original
coordinates to effect the new default position, which leads to unrounded
points in memory. This commit ensures that we round directly before
optimising (but still after calculating `glyf` metrics, for backward
compatibility).
2024-09-15 12:10:29 -07:00
Nathan Williis
7d93689aca Docs: workaround doctest-vs-Sphinx syntax highlighting. 2024-09-11 15:45:46 +01:00
Nathan Williis
1fc9bc2dca Docs: fix code-example blocks in varLib/instancer. 2024-09-03 17:54:29 +01:00
Behdad Esfahbod
f916971913 [instancer] Fix output filename decision-making
All limits are tuples now when not None. The old logic was
broken and for the following command:

$ fonttools varLib.instancer  AdobeVFPrototype.otf CNTR=50:80 wght=900

it was saving the output with the name suffix `-instance`, whereas
it's clearly a partial instantiation. This fixes that.
2024-05-30 11:48:12 -06:00
Simon Cozens
a5a1573012 Revert "[instancer] Fix name decision-making"
This reverts commit 969d09dcafd3669753e30060ccca7e5fd4c356cd.
2024-05-30 14:36:45 +01:00
Behdad Esfahbod
6c93fc6289 [instancer] Remove not about CFF2 not being supported 2024-05-27 14:16:57 -06:00
Behdad Esfahbod
a1641d91b2 Newer black 2024-05-22 18:46:07 -06:00
Behdad Esfahbod
e88e47f8ff [VARC] Take a stab at instancing 2024-05-22 18:46:07 -06:00
Behdad Esfahbod
902b2a194e [VARC] Fix scaleUpem
Instancing left.
2024-05-22 18:46:07 -06:00
Behdad Esfahbod
c91984ef77 [VARC] Use sparse-regions in MultiVarStore
Might revert as the savings are small.
https://github.com/harfbuzz/boring-expansion-spec/issues/103#issuecomment-1861531669
2024-05-22 18:46:06 -06:00
Behdad Esfahbod
2ca627dc5b [VARC/instancer] Fix 2024-05-22 18:46:06 -06:00
Behdad Esfahbod
57dd288d1b [VARC/instancer] Comment 2024-05-22 18:46:06 -06:00
Behdad Esfahbod
27e5182677 [VARC/instancer] Implement 2024-05-22 18:46:01 -06:00
Behdad Esfahbod
bcd5e4c216 Rip out glyf1 VarComposites
In favor of separate VARC table.

ttGlyphSet does NOT yet know how to draw VARC table though.

The 9 failing tests are all VarComposite-related and need
to be updated with VARC equivalents eventually when we
add VARC support to subsetter and instancer.
2024-05-22 18:45:27 -06:00
Behdad Esfahbod
5dca3c5a50 [instancer] Warn about missing VORG support 2024-05-17 12:44:29 -07:00
Behdad Esfahbod
4b62d5efe9 [instancer] Set VarDataCount 2024-05-17 12:25:20 -07:00
Behdad Esfahbod
15af3425e9 [instancer] Add --downgrade-cff2 2024-05-17 11:45:35 -07:00
Behdad Esfahbod
9ffcabd360 [instancer] Remove resolved TODO 2024-05-17 11:41:06 -07:00
Behdad Esfahbod
0a7433f847 [cffLib] Add CFF<->CFF2 convertors that work on otFont 2024-05-16 16:29: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
c06e8ba1e8 [instancer/CFF2] Comment 2024-05-14 18:26:35 -06:00
Behdad Esfahbod
3d2df43a67 [instancer/CFF2] Comment 2024-05-14 17:13:21 -06:00
Behdad Esfahbod
b3dc48a967 [instancer/CFF2] Micro-optimize commands 2024-05-14 13:39:09 -06:00
Behdad Esfahbod
1011d7e996 [instancer/CFF2] Add another test 2024-05-14 13:34:20 -06:00
Behdad Esfahbod
6d915fc816 [instancer/CFF2] Add test 2024-05-14 12:28:00 -06:00
Behdad Esfahbod
1891a7220d [instancer/CFF2] Fixups 2024-05-14 11:11:39 -06:00
Behdad Esfahbod
385c2cb979 [instancer/CFF2] Instantiate private-dict values 2024-05-14 11:11:25 -06:00
Behdad Esfahbod
bdd42f14fc [instancer/CFF2] Fixups with used-vsindex handing
vsindex 0 is implied.

Also, add Unimplemented code for private-dict variable
values. I couldn't find any fonts using them, so for
now they remain unimplemented.
2024-05-14 01:15:04 -06:00
Behdad Esfahbod
68f87dd850 [instancer/CFF2] Fix tests
gvar is removed by the time we get to hmtx/vmtx subsetting.
2024-05-14 00:47:39 -06:00
Behdad Esfahbod
21fb882e67 [instancer/CFF2] Prune ununsed data 2024-05-14 00:35:09 -06:00
Behdad Esfahbod
6f85ebb02c [instancer/CFF2] Full-instancing 2024-05-14 00:11:29 -06:00
Behdad Esfahbod
ae18197f6f [instancer/CFF2] Instantiate hmtx/vmtx 2024-05-14 00:11:29 -06:00
Behdad Esfahbod
c9ed0d1348 [instancer/CFF2] Minor sanity check 2024-05-14 00:11:29 -06:00
Behdad Esfahbod
f6c72eabf9 [instancer/CFF2] Add specialize and generalize arguments 2024-05-14 00:11:29 -06:00
Behdad Esfahbod
bb9a23702b [instancer] Instantiate CFF2! 2024-05-14 00:11:29 -06:00
Behdad Esfahbod
969d09dcaf [instancer] Fix name decision-making
All limits are tuple these days.
2024-05-14 00:10:50 -06:00
Behdad Esfahbod
e724acd41e [instancer] Raise NotImplementedError if avar2 VarStore present 2024-04-15 08:21:14 -06:00
Cosimo Lupo
345d6b2f81 [instancer] drop explicit no-op axes from tuplevariations
Fixes #3453
2024-03-04 15:25:48 +00:00
Khaled Hosny
cf08265cd5 Black 2024-02-06 15:47:35 +02:00
Qunxin Liu
3e548ff29c fix bug in instancer iup optimization
pass in correct value to tolerance
2024-01-25 16:18:24 -08:00
Just van Rossum
4826f9b016
Fix help string for AXIS=LOC 2023-12-11 15:59:30 +01:00
Behdad Esfahbod
8728789c05 [instancer] Don't produce triples outside <-1,0,+1>
Fixes https://github.com/fonttools/fonttools/issues/3350
2023-12-06 10:22:11 -05:00
Cosimo Lupo
69636098bd
[instancer] Ensure hhea vertical metrics stay in sync with OS/2 ones after instancing
Fixes https://github.com/fonttools/fonttools/issues/3297
2023-11-15 14:05:44 +00:00
Cosimo Lupo
74da89beeb
Merge pull request #3317 from fonttools/instantiate-avgcharwidth
Recalc avgcharwidth after instancing
2023-11-03 10:12:07 +00:00
Behdad Esfahbod
ae69e9e8be
[instancer] Allow relaxed limits syntax (#3323)
* [instancer] Allow relaxed limits syntax

Fixes https://github.com/fonttools/fonttools/issues/3322

Co-authored-by: Cosimo Lupo <clupo@google.com>
2023-11-02 10:22:23 -06:00
Behdad Esfahbod
2d9b80acd1 [instancer] Remove unused import 2023-11-01 15:11:56 -06:00
Simon Cozens
49570c3599
[instancer] Check if an axis has values before requiring it to be found (#3319)
* Check if an axis has values before requiring it to be found

* Add test
2023-10-31 08:21:34 +00:00
Simon Cozens
3573cd906b Recalc avgcharwidth after instancing 2023-10-30 10:11:31 +00:00