Fixing cap1 statement

This commit is contained in:
notmasteryet 2012-02-29 18:31:03 -06:00
parent 42a428af88
commit 2cc89735ae

View File

@ -1863,6 +1863,13 @@ var Font = (function FontClosure() {
var hasShortCmap = !!cmapTable.hasShortCmap;
var toFontChar = this.toFontChar;
if (hasShortCmap && ids.length == numGlyphs) {
// Fixes the short cmap tables -- some generators use incorrect
// glyph id.
for (var i = 0, ii = ids.length; i < ii; i++)
ids[i] = i;
}
if (toFontChar && toFontChar.length > 0) {
// checking if cmap is just identity map
var isIdentity = true;
@ -1906,11 +1913,14 @@ var Font = (function FontClosure() {
// copying all characters to private use area, all mapping all known
// glyphs to the unicodes. The glyphs and ids arrays will grow.
var usedUnicodes = [];
var glyphNames = properties.glyphNames || [];
for (var i = 0, ii = glyphs.length; i < ii; i++) {
var code = glyphs[i].unicode;
var gid = ids[i];
glyphs[i].unicode += kCmapGlyphOffset;
toFontChar[code] = glyphs[i].unicode;
var glyphName = properties.baseEncoding[code];
var glyphName = glyphNames[gid] || properties.baseEncoding[code];
if (glyphName in GlyphsUnicode) {
var unicode = GlyphsUnicode[glyphName];
if (unicode in usedUnicodes)
@ -1921,9 +1931,11 @@ var Font = (function FontClosure() {
unicode: unicode,
code: glyphs[i].code
});
ids.push(ids[i]);
ids.push(gid);
toFontChar[code] = unicode;
}
}
this.useToFontChar = true;
}
// Moving all symbolic font glyphs into 0xF000 - 0xF0FF range.