Remove unnecessary in checks of Arrays, when building the charCodeToGlyphId for TrueType fonts

Note that all standard Encodings have the same length (i.e. `256` elements) and that missing entries are always represented by empty strings, hence why a separate exists-check isn't necessary in the `baseEncoding` case.
This commit is contained in:
Jonas Jenwald 2021-05-18 09:04:14 +02:00
parent edc38de37a
commit 7190bc23a8

View File

@ -2550,12 +2550,9 @@ class Font {
const glyphsUnicodeMap = getGlyphsUnicode();
for (let charCode = 0; charCode < 256; charCode++) {
let glyphName;
if (this.differences && charCode in this.differences) {
if (this.differences[charCode] !== undefined) {
glyphName = this.differences[charCode];
} else if (
charCode in baseEncoding &&
baseEncoding[charCode] !== ""
) {
} else if (baseEncoding[charCode] !== "") {
glyphName = baseEncoding[charCode];
} else {
glyphName = StandardEncoding[charCode];