w3c / w3c/ift-encoder

Remove the "last gid" hack from encoder implementation

Open
#108 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
13
Forks
8
Avg merge
3h 57m
Merged PRs (30d)
7

Description

Context: https://github.com/w3c/ift-encoder/blob/main/ift/encoder/encoder.cc#L219

When producing mixed encodings we need to ensure at each level of invalidating extension the loca/gvar/CFF/CFF2 offset arrays are large enough to accomadate any glyphs that may be added by any reachable glyph patches. This is currently handled using a crude hack of including the last gid of the original font in the initial subset (so that loca/gvar/CFF/CFF2 offset arrays are always at their maximum size).

As currently implemented this is sub optimal and will also conflict with producing a true desiccated font (#104). Instead at each level of invalidating extension we should determine what the maximum reachable glyph id is and ensure the loca/gvar/CFF/CFF2 offsets arrays are large enough to accomadate.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ift/encoder/encoder.cc#L219 and trace how mixed encodings build each level of invalidating extension and reachable glyph patches. Replace the initial last-gid inclusion with per-level maximum reachable glyph-id handling, ensuring the loca/gvar/CFF/CFF2 offset arrays can accommodate those glyphs and no longer depend on the hack.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.