From 4079ef8d01ca0ea1cbe2ccc9affea5f6dddea4b6 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 11 Sep 2024 13:16:01 +0200 Subject: [PATCH] cff: Fix version number [why] The version number written out to a buffer is not the number stored in font.tables.cff.topDict.version. Instead some other human readable string is used even if the cff.topDict.version has been set correctly. The CFF version number needs to be a string representing a number and nothing else; especially it should not contain 'Version'. Documentation [1] says this: version 0 SID This can be derived by copying the OpenType 'head' fsRevision field, and formatting it as a Fixed with three decimal places of precision. The documentation is also valid for CFF1 in this regard. [how] Use the version string in the CFF table, if there is one. If not fall back to the (imho wrong) previous defaulting behavior. [1] https://learn.microsoft.com/en-us/typography/opentype/otspec180/cff2#sectionD3 Signed-off-by: Fini Jastrow --- src/tables/sfnt.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tables/sfnt.mjs b/src/tables/sfnt.mjs index 6e526f64..2ee9ac3f 100644 --- a/src/tables/sfnt.mjs +++ b/src/tables/sfnt.mjs @@ -337,7 +337,7 @@ function fontToSfntTable(font) { const postTable = post.make(font); const cffTable = cff.make(font.glyphs, { - version: font.getEnglishName('version'), + version: font.tables.cff && font.tables.cff.topDict || font.getEnglishName('version'), fullName: englishFullName, familyName: englishFamilyName, weightName: englishStyleName,