From 5415fed14d13a117438efef12a2ea616479785c1 Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Fri, 27 Jan 2012 20:36:27 -0600 Subject: [PATCH] Mapping well-known chars to the similar equivalents in the normal characters range --- src/fonts.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/fonts.js b/src/fonts.js index bb91d7969..3f618b82a 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -418,6 +418,19 @@ var symbolsFonts = { 'Dingbats': true, 'Symbol': true, 'ZapfDingbats': true }; +// Some characters, e.g. copyrightserif, mapped to the private use area and +// might not be displayed using standard fonts. Mapping/hacking well-known chars +// to the similar equivalents in the normal characters range. +function mapPrivateUseChars(code) { + switch (code) { + case 0xF8E9: // copyrightsans + case 0xF6D9: // copyrightserif + return 0x00A9; // copyright + default: + return code; + } +} + var FontLoader = { listeningForFontLoad: false, @@ -2199,7 +2212,7 @@ var Font = (function FontClosure() { case 'CIDFontType0': if (this.noUnicodeAdaptation) { width = this.widths[this.unicodeToCID[charcode] || charcode]; - unicode = charcode; + unicode = mapPrivateUseChars(charcode); break; } unicode = this.toUnicode[charcode] || charcode; @@ -2207,7 +2220,7 @@ var Font = (function FontClosure() { case 'CIDFontType2': if (this.noUnicodeAdaptation) { width = this.widths[this.unicodeToCID[charcode] || charcode]; - unicode = charcode; + unicode = mapPrivateUseChars(charcode); break; } unicode = this.toUnicode[charcode] || charcode; @@ -2217,7 +2230,7 @@ var Font = (function FontClosure() { if (!isNum(width)) width = this.widths[glyphName]; if (this.noUnicodeAdaptation) { - unicode = GlyphsUnicode[glyphName] || charcode; + unicode = mapPrivateUseChars(GlyphsUnicode[glyphName] || charcode); break; } unicode = this.glyphNameMap[glyphName] ||