|
|
@ -31,7 +31,7 @@ var fontCount = 0; |
|
|
|
var Fonts = { |
|
|
|
var Fonts = { |
|
|
|
_active: null, |
|
|
|
_active: null, |
|
|
|
get active() { |
|
|
|
get active() { |
|
|
|
return this._active; |
|
|
|
return this._active || { encoding: {} }; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
set active(aFontName) { |
|
|
|
set active(aFontName) { |
|
|
@ -39,12 +39,7 @@ var Fonts = { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
unicodeFromCode: function fonts_unicodeFromCode(aCode) { |
|
|
|
unicodeFromCode: function fonts_unicodeFromCode(aCode) { |
|
|
|
var active = this._active; |
|
|
|
var unicode = GlyphsUnicode[this.active.encoding[aCode]]; |
|
|
|
if (!active || !active.encoding) |
|
|
|
|
|
|
|
return aCode; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var difference = active.encoding[aCode]; |
|
|
|
|
|
|
|
var unicode = GlyphsUnicode[difference]; |
|
|
|
|
|
|
|
return unicode ? "0x" + unicode : aCode; |
|
|
|
return unicode ? "0x" + unicode : aCode; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -84,6 +79,15 @@ var Font = function(aName, aFile, aEncoding, aCharset, aBBox, aType) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case "TrueType": |
|
|
|
case "TrueType": |
|
|
|
|
|
|
|
return Fonts[aName] = { |
|
|
|
|
|
|
|
data: null, |
|
|
|
|
|
|
|
encoding: {}, |
|
|
|
|
|
|
|
charset: null, |
|
|
|
|
|
|
|
loading: false |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TrueType is disabled for the moment since the sanitizer prevent it
|
|
|
|
|
|
|
|
// from loading
|
|
|
|
this.mimetype = "font/ttf"; |
|
|
|
this.mimetype = "font/ttf"; |
|
|
|
var ttf = new TrueType(aFile); |
|
|
|
var ttf = new TrueType(aFile); |
|
|
|
this.font = ttf.data; |
|
|
|
this.font = ttf.data; |
|
|
@ -1140,9 +1144,7 @@ var Type1Parser = function() { |
|
|
|
* chapter 8. |
|
|
|
* chapter 8. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
this.flattenCharstring = function(aCharstring, aSubrs) { |
|
|
|
this.flattenCharstring = function(aCharstring, aSubrs) { |
|
|
|
var operandStackIndex = 0; |
|
|
|
|
|
|
|
operandStack.clear(); |
|
|
|
operandStack.clear(); |
|
|
|
|
|
|
|
|
|
|
|
executionStack.clear(); |
|
|
|
executionStack.clear(); |
|
|
|
executionStack.push(aCharstring.slice()); |
|
|
|
executionStack.push(aCharstring.slice()); |
|
|
|
|
|
|
|
|
|
|
@ -1434,8 +1436,7 @@ CFF.prototype = { |
|
|
|
log("Glyph " + i + " has a wrong value: " + c + " in charstring: " + data); |
|
|
|
log("Glyph " + i + " has a wrong value: " + c + " in charstring: " + data); |
|
|
|
log("the default value is glyph " + charstrings[i].glyph + " and is supposed to be: " + charstrings[i].charstring); |
|
|
|
log("the default value is glyph " + charstrings[i].glyph + " and is supposed to be: " + charstrings[i].charstring); |
|
|
|
} |
|
|
|
} |
|
|
|
for (var k = 0; k < bytes.length; k++) |
|
|
|
charstring = charstring.concat(bytes); |
|
|
|
charstring.push(bytes[k]); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
r.push(charstring); |
|
|
|
r.push(charstring); |
|
|
@ -1503,7 +1504,7 @@ CFF.prototype = { |
|
|
|
var defaultWidth = this.encodeNumber(0); |
|
|
|
var defaultWidth = this.encodeNumber(0); |
|
|
|
var privateData = [].concat( |
|
|
|
var privateData = [].concat( |
|
|
|
defaultWidth, [20], |
|
|
|
defaultWidth, [20], |
|
|
|
defaultWidth, [21], |
|
|
|
[139, 21], // nominalWidth
|
|
|
|
[ |
|
|
|
[ |
|
|
|
119, 159, 248, 97, 159, 247, 87, 159, 6, |
|
|
|
119, 159, 248, 97, 159, 247, 87, 159, 6, |
|
|
|
30, 10, 3, 150, 37, 255, 12, 9, |
|
|
|
30, 10, 3, 150, 37, 255, 12, 9, |
|
|
|