From 38372ee2f215191c88c1fc538835942e59be8c0c Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Sat, 29 Oct 2011 08:45:29 -0500 Subject: [PATCH] TrueType encoding for files without font data --- src/fonts.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/fonts.js b/src/fonts.js index 202481449..6202b3279 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -766,6 +766,7 @@ var Font = (function Font() { this.defaultWidth = properties.defaultWidth; this.composite = properties.composite; this.toUnicode = properties.toUnicode; + this.hasEncoding = properties.hasEncoding; this.fontMatrix = properties.fontMatrix; if (properties.type == 'Type3') @@ -827,7 +828,6 @@ var Font = (function Font() { this.fontMatrix = properties.fontMatrix; this.encoding = properties.baseEncoding; this.hasShortCmap = properties.hasShortCmap; - this.hasEncoding = properties.hasEncoding; this.loadedName = getUniqueName(); this.loading = true; }; @@ -2006,10 +2006,14 @@ var Font = (function Font() { var glyphName = this.differences[charcode] || this.encoding[charcode]; if (!glyphName) glyphName = Encodings.StandardEncoding[charcode]; + if (!isNum(width)) + width = this.widths[glyphName]; + if (this.noUnicodeAdaptation) { + unicode = GlyphsUnicode[glyphName] || charcode; + break; + } if (!this.hasEncoding) { - width = this.widths[charcode] || this.widths[glyphName]; - unicode = this.noUnicodeAdaptation ? - charcode : adaptUnicode(charcode); + unicode = adaptUnicode(charcode); break; } if (this.hasShortCmap) {