Skip to content

Fix empty CFF subset charset range#384

Open
omochi wants to merge 1 commit into
foliojs:masterfrom
omochi:upstream-pr/empty-cff-subset-charset
Open

Fix empty CFF subset charset range#384
omochi wants to merge 1 commit into
foliojs:masterfrom
omochi:upstream-pr/empty-cff-subset-charset

Conversation

@omochi

@omochi omochi commented Jul 4, 2026

Copy link
Copy Markdown

Summary

This fixes CFF subset generation when the subset only contains .notdef.

In that case, this.charstrings.length is 1, so the existing code creates a charset range with nLeft: -1. That produces an invalid unsigned value during encoding.

This change emits no charset ranges when there are no glyphs after .notdef.

Change

ranges: this.charstrings.length > 1
  ? [{ first: 1, nLeft: this.charstrings.length - 2 }]
  : []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant