|
|
@ -19,6 +19,18 @@ var kPDFGlyphSpaceUnits = 1000; |
|
|
|
// Until hinting is fully supported this constant can be used
|
|
|
|
// Until hinting is fully supported this constant can be used
|
|
|
|
var kHintingEnabled = false; |
|
|
|
var kHintingEnabled = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var FontFlags = { |
|
|
|
|
|
|
|
FixedPitch: 1, |
|
|
|
|
|
|
|
Serif: 2, |
|
|
|
|
|
|
|
Symbolic: 4, |
|
|
|
|
|
|
|
Script: 8, |
|
|
|
|
|
|
|
Nonsymbolic: 32, |
|
|
|
|
|
|
|
Italic: 64, |
|
|
|
|
|
|
|
AllCap: 65536, |
|
|
|
|
|
|
|
SmallCap: 131072, |
|
|
|
|
|
|
|
ForceBold: 262144 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var Encodings = { |
|
|
|
var Encodings = { |
|
|
|
get ExpertEncoding() { |
|
|
|
get ExpertEncoding() { |
|
|
|
return shadow(this, 'ExpertEncoding', ['', '', '', '', '', '', '', '', '', |
|
|
|
return shadow(this, 'ExpertEncoding', ['', '', '', '', '', '', '', '', '', |
|
|
@ -160,19 +172,20 @@ var Encodings = { |
|
|
|
'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', |
|
|
|
'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', |
|
|
|
'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', |
|
|
|
'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', |
|
|
|
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', |
|
|
|
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', |
|
|
|
'braceleft', 'bar', 'braceright', 'asciitilde', '', '', 'exclamdown', |
|
|
|
'braceleft', 'bar', 'braceright', 'asciitilde', '', '', '', '', '', '', |
|
|
|
'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', |
|
|
|
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', |
|
|
|
'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', |
|
|
|
'', '', '', '', '', '', '', '', '', '', 'exclamdown', 'cent', 'sterling', |
|
|
|
'guilsinglright', 'fi', 'fl', '', 'endash', 'dagger', 'daggerdbl', |
|
|
|
'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', |
|
|
|
'periodcentered', '', 'paragraph', 'bullet', 'quotesinglbase', |
|
|
|
'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', |
|
|
|
'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', |
|
|
|
'fl', '', 'endash', 'dagger', 'daggerdbl', 'periodcentered', '', |
|
|
|
'perthousand', '', 'questiondown', '', 'grave', 'acute', 'circumflex', |
|
|
|
'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', |
|
|
|
'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', '', 'ring', |
|
|
|
'guillemotright', 'ellipsis', 'perthousand', '', 'questiondown', '', |
|
|
|
'cedilla', '', 'hungarumlaut', 'ogonek', 'caron', 'emdash', '', '', '', |
|
|
|
'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', |
|
|
|
'', '', '', '', '', '', '', '', '', '', '', '', '', 'AE', '', |
|
|
|
'dieresis', '', 'ring', 'cedilla', '', 'hungarumlaut', 'ogonek', 'caron', |
|
|
|
'ordfeminine', '', '', '', '', 'Lslash', 'Oslash', 'OE', 'ordmasculine', |
|
|
|
'emdash', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', |
|
|
|
'', '', '', '', '', 'ae', '', '', '', 'dotlessi', '', '', 'lslash', |
|
|
|
'AE', '', 'ordfeminine', '', '', '', '', 'Lslash', 'Oslash', 'OE', |
|
|
|
'oslash', 'oe', 'germandbls' |
|
|
|
'ordmasculine', '', '', '', '', '', 'ae', '', '', '', 'dotlessi', '', '', |
|
|
|
|
|
|
|
'lslash', 'oslash', 'oe', 'germandbls' |
|
|
|
]); |
|
|
|
]); |
|
|
|
}, |
|
|
|
}, |
|
|
|
get WinAnsiEncoding() { |
|
|
|
get WinAnsiEncoding() { |
|
|
@ -405,6 +418,19 @@ var symbolsFonts = { |
|
|
|
'Dingbats': true, 'Symbol': true, 'ZapfDingbats': true |
|
|
|
'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 = { |
|
|
|
var FontLoader = { |
|
|
|
listeningForFontLoad: false, |
|
|
|
listeningForFontLoad: false, |
|
|
|
|
|
|
|
|
|
|
@ -761,8 +787,8 @@ var Font = (function FontClosure() { |
|
|
|
var names = name.split('+'); |
|
|
|
var names = name.split('+'); |
|
|
|
names = names.length > 1 ? names[1] : names[0]; |
|
|
|
names = names.length > 1 ? names[1] : names[0]; |
|
|
|
names = names.split(/[-,_]/g)[0]; |
|
|
|
names = names.split(/[-,_]/g)[0]; |
|
|
|
this.isSerifFont = !!(properties.flags & 2); |
|
|
|
this.isSerifFont = !!(properties.flags & FontFlags.Serif); |
|
|
|
this.isSymbolicFont = !!(properties.flags & 4); |
|
|
|
this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); |
|
|
|
|
|
|
|
|
|
|
|
var type = properties.type; |
|
|
|
var type = properties.type; |
|
|
|
this.type = type; |
|
|
|
this.type = type; |
|
|
@ -2186,7 +2212,7 @@ var Font = (function FontClosure() { |
|
|
|
case 'CIDFontType0': |
|
|
|
case 'CIDFontType0': |
|
|
|
if (this.noUnicodeAdaptation) { |
|
|
|
if (this.noUnicodeAdaptation) { |
|
|
|
width = this.widths[this.unicodeToCID[charcode] || charcode]; |
|
|
|
width = this.widths[this.unicodeToCID[charcode] || charcode]; |
|
|
|
unicode = charcode; |
|
|
|
unicode = mapPrivateUseChars(charcode); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
unicode = this.toUnicode[charcode] || charcode; |
|
|
|
unicode = this.toUnicode[charcode] || charcode; |
|
|
@ -2194,7 +2220,7 @@ var Font = (function FontClosure() { |
|
|
|
case 'CIDFontType2': |
|
|
|
case 'CIDFontType2': |
|
|
|
if (this.noUnicodeAdaptation) { |
|
|
|
if (this.noUnicodeAdaptation) { |
|
|
|
width = this.widths[this.unicodeToCID[charcode] || charcode]; |
|
|
|
width = this.widths[this.unicodeToCID[charcode] || charcode]; |
|
|
|
unicode = charcode; |
|
|
|
unicode = mapPrivateUseChars(charcode); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
unicode = this.toUnicode[charcode] || charcode; |
|
|
|
unicode = this.toUnicode[charcode] || charcode; |
|
|
@ -2204,7 +2230,7 @@ var Font = (function FontClosure() { |
|
|
|
if (!isNum(width)) |
|
|
|
if (!isNum(width)) |
|
|
|
width = this.widths[glyphName]; |
|
|
|
width = this.widths[glyphName]; |
|
|
|
if (this.noUnicodeAdaptation) { |
|
|
|
if (this.noUnicodeAdaptation) { |
|
|
|
unicode = GlyphsUnicode[glyphName] || charcode; |
|
|
|
unicode = mapPrivateUseChars(GlyphsUnicode[glyphName] || charcode); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
unicode = this.glyphNameMap[glyphName] || |
|
|
|
unicode = this.glyphNameMap[glyphName] || |
|
|
|