Repository navigation
Name a registered font's /BaseFont by its PostScript name - #102
Merged
Merged
Conversation
A registered font's /BaseFont was the family it was registered under, spaces removed, so every weight of a family was written under one name: Noto Sans Hebrew Regular and Bold were both NotoSansHebrew. ISO 32000-2 9.6.3 and 9.7.4 make /BaseFont the font's PostScript name, which every other writer gives each weight (Acrobat's MinionPro-Regular, Word's Calibri-Bold, Chrome's Inter-SemiBold). Readers that name fonts by it saw one font for two: Acrobat's Document Properties listed one NotoSansHebrew for both weights, and the engine's font list merged them into one 400 entry, so a bold box read back under the regular font's name where the font isn't registered. The name is now the program's own: its PostScript name, else Family,Style as a TrueType without one is named. The family stays the descriptor's /FontFamily, which is what reopening resolves a registered font by, so finding it again doesn't change. EPDFFont_GetPostScriptName() reports the same name. A variable font is instanced at registration and keeps its name table, whose name 6 is the default instance's: a bold instance of Roboto was named Roboto-Regular. An instance is now named as Adobe Technical Note #5902 names instances: the named instance's own PostScript name (RobotoRoman-Bold); else the family prefix and the instance's style (NotoSans-Bold); else the prefix and the weight (NotoSans_450wght). The subset tag hashed only the glyphs a subset holds, and two weights number their glyphs alike, so they also shared a tag. It now hashes the program too, so different subsets in one file get different tags (9.6.4). Tests: TwoWeightsOfOneFamilyAreTwoFontsByName (Arimo Regular and Bold under one family: two names, two tags, one /FontFamily), VariableFontInstanceWithoutItsOwnName, and the instance names in VariableFontIsInstancedAtRegistration; NoSubsettingFontEmbedsWholeProgram and RegisteredCffFontEmitsCidFontType0 now expect the PostScript name. Three mutations (the family name back, instances keeping name 6, a tag of the glyphs alone) each fail their tests. Full macOS embedder suite: 1750 pass, the same 12 render and golden failures as embedpdf/main. Layer mode: the new writing test is in the writers list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A registered font's
/BaseFontwas the family it was registered under, with the spaces removed, so every weight of a family was written under one name: Noto Sans Hebrew Regular and Bold were bothNotoSansHebrew. ISO 32000-2 9.6.3 and 9.7.4 make/BaseFontthe font's PostScript name, and every other writer gives each weight its own (Acrobat'sMinionPro-Regular, Word'sCalibri-Bold, Chrome'sInter-SemiBold, WeasyPrint, pdfTeX, Quartz, PDFTron).Readers that name fonts by it saw one font for two:
NotoSansHebrew (Embedded Subset)for a file with both weights; with the bold one renamed, it lists both.The drawing was never wrong: each box points at its own embedded program.
What changes
/BaseFontis the program's own name: its PostScript name, elseFamily,Styleas a TrueType font without one is named. The family stays the descriptor's/FontFamily, which is what reopening resolves a registered font by, so finding it again doesn't change.EPDFFont_GetPostScriptName()reports the same name, as its header already promised.Roboto-Regular. Following Adobe Technical Note #5902, an instance takes its named instance's own PostScript name (RobotoRoman-Bold); else the family prefix and the instance's style (NotoSans-Bold); else the prefix and the weight (NotoSans_450wght).Files written before this keep their names until a box is edited and its appearance rewritten; nothing that finds fonts depends on the old names.
Tests
TwoWeightsOfOneFamilyAreTwoFontsByName: Arimo Regular and Bold registered under one family give two names, two tags and one/FontFamily.VariableFontInstanceWithoutItsOwnName: a Noto Sans instance at 700 isNotoSans-Bold, one at 450NotoSans_450wght.VariableFontIsInstancedAtRegistrationchecks the instance names;NoSubsettingFontEmbedsWholeProgramandRegisteredCffFontEmitsCidFontType0now expect the PostScript name rather than the registered family.embedpdf/main.check-fork-tags --strictpasses (the fork's own files).With #101 merged in locally, both engines pass the font and mixed-script suites, and a file reopened without the fonts reads the bold box as
NotoSansHebrew-Boldand lists two fonts. Meant to be released together with #101, so embedpdf pins once.