1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Re-enable TrueType and add a TODO about translating the ToUnicode entry (note TrueType still fails on cmap)

This commit is contained in:
Vivien Nicolas 2011-06-19 04:35:25 +02:00
parent c766954ddf
commit b0cde50e21
2 changed files with 13 additions and 17 deletions

View file

@ -100,18 +100,6 @@ var Font = function(aName, aFile, aProperties) {
break;
case "TrueType":
// TrueType is disabled for the moment since the sanitizer prevent it
// from loading because of an overdated cmap table
return Fonts[aName] = {
data: null,
properties: {
encoding: {},
charset: null
},
loading: false,
cache: Object.create(null)
};
this.mimetype = "font/opentype";
var ttf = new TrueType(aFile);
this.font = ttf.data;
@ -184,7 +172,7 @@ Font.prototype = {
document.body.appendChild(canvas);
// Retrieve font charset
var charset = Fonts[fontName].charset || [];
var charset = Fonts[fontName].properties.charset || [];
// if the charset is too small make it repeat a few times
var count = 30;
while (count-- && charset.length <= 30)
@ -205,7 +193,7 @@ Font.prototype = {
}
}
ctx.font = "bold italic 20px " + fontName + ", Symbol, Arial";
var textWidth = ctx.measureText(testString);
var textWidth = ctx.measureText(testString).width;
if (debug)
ctx.fillText(testString, 20, 20);
@ -220,7 +208,7 @@ Font.prototype = {
window.clearInterval(interval);
Fonts[fontName].loading = false;
warn("Is " + fontName + " for charset: " + charset + " loaded?");
} else if (textWidth != ctx.measureText(testString)) {
} else if (textWidth != ctx.measureText(testString).width) {
window.clearInterval(interval);
Fonts[fontName].loading = false;
}