var constructor = function font_constructor(name, file, properties) {
this.name = name;
this.encoding = properties.encoding;
- this.glyphs = properties.glyphs;
this.sizes = [];
- var names = name.split("+");
+ var names = name.split('+');
names = names.length > 1 ? names[1] : names[0];
names = names.split(/[-,_]/g)[0];
- this.serif = serifFonts[names] || (name.indexOf('Serif') != -1);
+ this.serif = serifFonts[names] || (name.search(/serif/gi) != -1);
// 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.
if (index) {
deltas.push(index);
- var code = encoding[index];
- for (var glyph in properties.glyphs) {
- if (properties.glyphs[glyph] == code)
- break;
- }
-
var unicode = j + kCmapGlyphOffset;
- properties.glyphs[glyph] = encoding[j] = unicode;
- glyphs.push({ glyph: glyph, unicode: unicode });
+ var mapping = encoding[j] || {};
+ mapping.unicode = unicode;
+ encoding[j] = mapping;
+ glyphs.push({ unicode: unicode });
}
}
-
+
return cmap.data = createCMapTable(glyphs, deltas);
} else if (format == 6) {
// Format 6 is a 2-bytes dense mapping, which means the font data