var constructor = function font_constructor(name, file, properties) {
this.name = name;
this.encoding = properties.encoding;
+ this.glyphs = properties.glyphs;
this.sizes = [];
// If the font is to be ignored, register it like an already loaded font
unicode = charcode;
}
+ // Check if the glyph has already been converted
+ if (!IsNum(unicode))
+ unicode = encoding[charcode] = this.glyphs[unicode];
+
// Handle surrogate pairs
if (unicode > 0xFFFF) {
str += String.fromCharCode(unicode & 0xFFFF);
var index = parseInt(getToken());
var glyph = getToken();
- if (!properties.encoding[index]) {
- var code = GlyphsUnicode[glyph];
- properties.glyphs[glyph] = properties.encoding[index] = code;
+ if ('undefined' == typeof(properties.differences[index])) {
+ properties.encoding[index] = glyph;
+ properties.glyphs[glyph] = GlyphsUnicode[glyph];
}
getToken(); // read the in 'put'
}
glyphsMap[glyph] = encodingMap[i] = GlyphsUnicode[glyph];
}
- if (fontDict.has('ToUnicode') && differences) {
+ if (fontType == 'TrueType' && fontDict.has('ToUnicode') && differences) {
var cmapObj = xref.fetchIfRef(fontDict.get('ToUnicode'));
if (IsName(cmapObj)) {
error('ToUnicode file cmap translation not implemented');
var baseFontName = fontDict.get('BaseFont');
if (!IsName(baseFontName))
return null;
+
// Using base font name as a font name.
baseFontName = baseFontName.name.replace(/[\+,\-]/g, '_');
if (/^Symbol(_?(Bold|Italic))*$/.test(baseFontName)) {