From 63972499c0672536d2c263fad94cd35a5e033fee Mon Sep 17 00:00:00 2001 From: Jakub Valenta Date: Wed, 24 Mar 2021 15:58:14 +0100 Subject: [PATCH] lib/font/embedded: Don't put '@' in font tag Otherwise Adobe Illustrator says "This document uses fonts that are currently not available on your computer". --- lib/font/embedded.js | 4 ++-- tests/unit/font.spec.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/font/embedded.js b/lib/font/embedded.js index 7b9a97f..fe26154 100644 --- a/lib/font/embedded.js +++ b/lib/font/embedded.js @@ -152,9 +152,9 @@ class EmbeddedFont extends PDFFont { flags |= 1 << 6; } - // generate a tag (6 uppercase letters. 16 is the char code offset from '1' to 'A'. 74 will map to 'Z') + // generate a tag (6 uppercase letters. 17 is the char code offset from '0' to 'A'. 73 will map to 'Z') const tag = [1, 2, 3, 4, 5, 6] - .map(i => String.fromCharCode((this.id.charCodeAt(i) || 74) + 16)) + .map(i => String.fromCharCode((this.id.charCodeAt(i) || 73) + 17)) .join(''); const name = tag + '+' + this.font.postscriptName; diff --git a/tests/unit/font.spec.js b/tests/unit/font.spec.js index f8cc94d..6724155 100644 --- a/tests/unit/font.spec.js +++ b/tests/unit/font.spec.js @@ -49,7 +49,7 @@ describe('EmbeddedFont', () => { font.dictionary = dictionary; font.embed(); - expect(dictionary.data.BaseFont).toBe('A@IIZZ+Roboto-Regular'); + expect(dictionary.data.BaseFont).toBe('BAJJZZ+Roboto-Regular'); }); }); });