don't use an array to translate from a typed array to a string, and always store font data as typed array, never as a stream
This commit is contained in:
parent
5afd963c8a
commit
7bb098dfc7
15
fonts.js
15
fonts.js
@ -154,14 +154,13 @@ Font.prototype = {
|
|||||||
bind: function font_bind() {
|
bind: function font_bind() {
|
||||||
var data = this.font;
|
var data = this.font;
|
||||||
|
|
||||||
// Compute the binary data to base 64
|
// Get the base64 encoding of the binary font data
|
||||||
var str = [];
|
var str = "";
|
||||||
var count = data.length;
|
var length = data.length;
|
||||||
for (var i = 0; i < count; i++)
|
for (var i = 0; i < length; ++i)
|
||||||
str.push(data.getChar ? data.getChar()
|
str += String.fromCharCode(data[i]);
|
||||||
: String.fromCharCode(data[i]));
|
|
||||||
|
|
||||||
var dataBase64 = window.btoa(str.join(""));
|
var dataBase64 = window.btoa(str);
|
||||||
var fontName = this.name;
|
var fontName = this.name;
|
||||||
|
|
||||||
/** Hack begin */
|
/** Hack begin */
|
||||||
@ -752,7 +751,7 @@ var TrueType = function(aFile) {
|
|||||||
} else if (requiredTables.lenght) {
|
} else if (requiredTables.lenght) {
|
||||||
error("Table " + requiredTables[0] + " is missing from the TruType font");
|
error("Table " + requiredTables[0] + " is missing from the TruType font");
|
||||||
} else {
|
} else {
|
||||||
this.data = aFile;
|
this.data = aFile.getBytes();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user