|
|
@ -386,6 +386,10 @@ var serifFonts = { |
|
|
|
'Wide Latin': true, 'Windsor': true, 'XITS': true |
|
|
|
'Wide Latin': true, 'Windsor': true, 'XITS': true |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var symbolsFonts = { |
|
|
|
|
|
|
|
'Dingbats': true, 'Symbol': true, 'ZapfDingbats': true |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var FontLoader = { |
|
|
|
var FontLoader = { |
|
|
|
listeningForFontLoad: false, |
|
|
|
listeningForFontLoad: false, |
|
|
|
|
|
|
|
|
|
|
@ -742,7 +746,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.serif = serifFonts[names] || (name.search(/serif/gi) != -1); |
|
|
|
this.isSerifFont = !!(properties.flags & 2); |
|
|
|
|
|
|
|
this.isSymbolicFont = !!(properties.flags & 4); |
|
|
|
|
|
|
|
|
|
|
|
var type = properties.type; |
|
|
|
var type = properties.type; |
|
|
|
this.type = type; |
|
|
|
this.type = type; |
|
|
@ -750,7 +755,7 @@ var Font = (function FontClosure() { |
|
|
|
// If the font is to be ignored, register it like an already loaded font
|
|
|
|
// If the font is to be ignored, register it like an already loaded font
|
|
|
|
// to avoid the cost of waiting for it be be loaded by the platform.
|
|
|
|
// to avoid the cost of waiting for it be be loaded by the platform.
|
|
|
|
if (properties.ignore) { |
|
|
|
if (properties.ignore) { |
|
|
|
this.loadedName = this.serif ? 'serif' : 'sans-serif'; |
|
|
|
this.loadedName = this.isSerifFont ? 'serif' : 'sans-serif'; |
|
|
|
this.loading = false; |
|
|
|
this.loading = false; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -830,7 +835,6 @@ var Font = (function FontClosure() { |
|
|
|
this.widthMultiplier = !properties.fontMatrix ? 1.0 : |
|
|
|
this.widthMultiplier = !properties.fontMatrix ? 1.0 : |
|
|
|
1.0 / properties.fontMatrix[0]; |
|
|
|
1.0 / properties.fontMatrix[0]; |
|
|
|
this.encoding = properties.baseEncoding; |
|
|
|
this.encoding = properties.baseEncoding; |
|
|
|
this.hasShortCmap = properties.hasShortCmap; |
|
|
|
|
|
|
|
this.loadedName = getUniqueName(); |
|
|
|
this.loadedName = getUniqueName(); |
|
|
|
this.loading = true; |
|
|
|
this.loading = true; |
|
|
|
}; |
|
|
|
}; |
|
|
@ -1800,7 +1804,32 @@ var Font = (function FontClosure() { |
|
|
|
this.useToUnicode = true; |
|
|
|
this.useToUnicode = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
properties.hasShortCmap = hasShortCmap; |
|
|
|
|
|
|
|
|
|
|
|
if (hasShortCmap && this.hasEncoding && !this.isSymbolicFont) { |
|
|
|
|
|
|
|
// Re-encode short map encoding to unicode -- that simplifies the
|
|
|
|
|
|
|
|
// resolution of MacRoman encoded glyphs logic for TrueType fonts:
|
|
|
|
|
|
|
|
// copying all characters to private use area, all mapping all known
|
|
|
|
|
|
|
|
// glyphs to the unicodes. The glyphs and ids arrays will grow.
|
|
|
|
|
|
|
|
var usedUnicodes = []; |
|
|
|
|
|
|
|
for (var i = 0, ii = glyphs.length; i < ii; i++) { |
|
|
|
|
|
|
|
var code = glyphs[i].unicode; |
|
|
|
|
|
|
|
glyphs[i].unicode += kCmapGlyphOffset; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var glyphName = properties.baseEncoding[code]; |
|
|
|
|
|
|
|
if (glyphName in GlyphsUnicode) { |
|
|
|
|
|
|
|
var unicode = GlyphsUnicode[glyphName]; |
|
|
|
|
|
|
|
if (unicode in usedUnicodes) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
usedUnicodes[unicode] = true; |
|
|
|
|
|
|
|
glyphs.push({ |
|
|
|
|
|
|
|
unicode: unicode, |
|
|
|
|
|
|
|
code: glyphs[i].code |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
ids.push(ids[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// remove glyph references outside range of avaialable glyphs
|
|
|
|
// remove glyph references outside range of avaialable glyphs
|
|
|
|
for (var i = 0, ii = ids.length; i < ii; i++) { |
|
|
|
for (var i = 0, ii = ids.length; i < ii; i++) { |
|
|
@ -2184,19 +2213,15 @@ var Font = (function FontClosure() { |
|
|
|
unicode = GlyphsUnicode[glyphName] || charcode; |
|
|
|
unicode = GlyphsUnicode[glyphName] || charcode; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!this.hasEncoding) { |
|
|
|
if (!this.hasEncoding || this.isSymbolicFont) { |
|
|
|
unicode = this.useToUnicode ? this.toUnicode[charcode] : charcode; |
|
|
|
unicode = this.useToUnicode ? this.toUnicode[charcode] : charcode; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.hasShortCmap && false) { |
|
|
|
|
|
|
|
var j = Encodings.MacRomanEncoding.indexOf(glyphName); |
|
|
|
// MacRoman encoding address by re-encoding the cmap table
|
|
|
|
unicode = j >= 0 ? j : |
|
|
|
unicode = glyphName in GlyphsUnicode ? |
|
|
|
this.glyphNameMap[glyphName]; |
|
|
|
GlyphsUnicode[glyphName] : |
|
|
|
} else { |
|
|
|
this.glyphNameMap[glyphName]; |
|
|
|
unicode = glyphName in GlyphsUnicode ? |
|
|
|
|
|
|
|
GlyphsUnicode[glyphName] : |
|
|
|
|
|
|
|
this.glyphNameMap[glyphName]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
warn('Unsupported font type: ' + this.type); |
|
|
|
warn('Unsupported font type: ' + this.type); |
|
|
|