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".
This commit is contained in:
Jakub Valenta 2021-03-24 15:58:14 +01:00 committed by Luiz Américo
parent 393734cf18
commit 63972499c0
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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');
});
});
});