diff --git a/src/core/cff_parser.js b/src/core/cff_parser.js index cdb662240..00db63f97 100644 --- a/src/core/cff_parser.js +++ b/src/core/cff_parser.js @@ -1769,12 +1769,16 @@ class CFFCompiler { if (isCIDFont) { // In a CID font, the charset is a mapping of CIDs not SIDs so just // create an identity mapping. + // nLeft: Glyphs left in range (excluding first) (see the CFF specs). + // Having a wrong value for nLeft induces a print issue on MacOS (see + // https://bugzilla.mozilla.org/1961423). + const nLeft = numGlyphsLessNotDef - 1; out = new Uint8Array([ 2, // format 0, // first CID upper byte 0, // first CID lower byte - (numGlyphsLessNotDef >> 8) & 0xff, - numGlyphsLessNotDef & 0xff, + (nLeft >> 8) & 0xff, + nLeft & 0xff, ]); } else { const length = 1 + numGlyphsLessNotDef * 2; diff --git a/test/unit/cff_parser_spec.js b/test/unit/cff_parser_spec.js index e7b7410a5..c15e4acf5 100644 --- a/test/unit/cff_parser_spec.js +++ b/test/unit/cff_parser_spec.js @@ -481,7 +481,7 @@ describe("CFFCompiler", function () { 0, // cid (high) 0, // cid (low) 0, // nLeft (high) - numGlyphs - 1, // nLeft (low) + numGlyphs - 2, // nLeft (low) ]); });