- From: Garret Rieger <grieger@google.com>
- Date: Tue, 14 Nov 2023 13:05:47 -0700
- To: "w3c-webfonts-wg (public-webfonts-wg@w3.org)" <public-webfonts-wg@w3.org>
- Message-ID: <CAM=OCWaSrCPkjWxvaikh1ak3VWm6EWjb4-e_0gTpbfHhYxk4vg@mail.gmail.com>
Demo https://garretrieger.github.io/ift-demo/
What the demo does:
-
Loads Roboto and Noto Sans SC fonts using the new static IFT.
-
Roboto is loaded using only shared brotli patches.
-
The Noto Sans SC font is loaded using a mix of IFTB and per-table shared
brotli patches.
-
The non-outline tables are augmented using per table shared brotli
patches.
-
While the outline tables (glyf + loca) are augmented using
independent IFTB patches.
-
Which demonstrates the successful mixing of the two patching types.
In order to make this work I had to introduce some new
behaviour/requirements on the client and encoder:
-
I added the option to have an additional mapping table (tag ‘IFTX’) in
addition to the existing mapping table (tag ‘IFT ‘). The entries from the
two tables are unioned together for processing. The IFTB and shared brotli
mapping entries are kept in separate tables. This allows us to avoid having
the shared brotli and IFTB patches modifying the same table. Not the only
way to solve this problem, but was the simplest for the demo.
-
I made changes to how the client selects and resolves patches, the new
algorithm is:
1.
Scan the mapping tables and find all entries which intersect the set
of new codepoints.
2.
Shared brotli patches have higher priority and are applied first. If
more than one shared brotli patch matched in step a, then select only one
and apply it.
3.
If a shared brotli patch was applied in b, go back to a.
4.
Apply all remaining IFTB patches.
-
At a high level, this requires all of the shared brotli patches to be
fully resolved before attempting to apply IFTB patches (downloads can still
happen in parallel). This ensures that tables such as maxp are in a good
state before IFTB patches are applied.
-
Retain gids must be used to ensure that the gids used by IFTB patches
are not invalidated.
-
IFTB table ordering is enforced after application of per table patches.
-
The current IFTB patching implementation doesn’t support changing loca
size, so I had to force the loca in the initial subset to be the full
length (and use long offsets).
What I’ve implemented so far:
-
An encoder which takes an IFTB font and a partitioning as an input and
produces a mixed mode IFT font which incorporates the IFTB patches.
-
Client library (implementing patch selection and application) and wasm
js client wrapper that drives the demo.
Lastly, me and Skef chatted earlier and came up with some additional ideas
for future exploration:
-
In the IFT mapping table have an old to new gid map. This allows
relaxing the retain gids requirement and could allow for a more compact
encoding.
-
Supporting variable axis augmentation alongside IFTB patches. This could
potentially be done by having a shared brotli patch which replaces the
mapping entries for the IFTB patches to point to new patch URLs which
contain data for the modified design space (eg. updated gvar deltas). The
list of patches loaded so far would be reset, so the client would
redownload IFTB patches for any previously loaded codepoints, which will
make the font correct for the updated design space.
Received on Tuesday, 14 November 2023 20:06:10 UTC