Skip to content

Fix empty public.postscriptNames dict incorrectly triggering uniXXXX derivation#980

Merged
anthrotype merged 1 commit into
mainfrom
fix-empty-postscriptNames
May 14, 2026
Merged

Fix empty public.postscriptNames dict incorrectly triggering uniXXXX derivation#980
anthrotype merged 1 commit into
mainfrom
fix-empty-postscriptNames

Conversation

@anthrotype
Copy link
Copy Markdown
Member

@anthrotype anthrotype commented May 14, 2026

When a UFO's lib.plist contains public.postscriptNames as an empty dict (<dict/>), ufo2ft incorrectly derives uniXXXX/uXXXXX production names for all glyphs. But an empty mapping should mean "no glyphs are renamed," same as if it were absent.

The Georama family has <key>public.postscriptNames</key><dict/> in all 7 masters. fontmake renames every glyph to uniXXXX; fontc correctly keeps the source names.

The problem is the is not None check in process_glyph_names(): an empty dict {} passes that check, so useProductionNames is set to True. Then in _build_production_name(), the truthiness guard if self._postscriptNames: skips the (empty) mapping and incorrectly falls through to unicode-based derivation.

The fix changes is not None to a truthiness check so empty and absent are treated the same, matching the documented semantics from commit 2f800cb:

If the mapping is not present, no glyph names are renamed.

There is already a way to explicitly opt into uniXXXX renaming by setting the com.github.googlei18n.ufo2ft.useProductionNames lib key to true (or by passing --production-names to fontmake CLI in absence of an explicit public.postscriptNames dict in the lib):

<key>com.github.googlei18n.ufo2ft.useProductionNames</key>
<true/>

An empty public.postscriptNames dict was never supposed to implicitly trigger the same behavior.

An empty dict passed the `is not None` check, causing all glyphs to be
renamed to uniXXXX production names. Treat empty the same as absent.
@anthrotype
Copy link
Copy Markdown
Member Author

Note: the v2.4.0 release notes (https://github.com/googlefonts/ufo2ft/releases/tag/v2.4.0) already documented this as the intended behavior:

if a public.postscriptNames mapping is not provided in the UFO lib, then do not do any glyph renaming.

The empty-dict case was an oversight in the implementation.

@anthrotype anthrotype merged commit 023a7d8 into main May 14, 2026
10 checks passed
@anthrotype anthrotype deleted the fix-empty-postscriptNames branch May 14, 2026 13:40
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