mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Add Objects.clear() and fallback for testStr in FontMeasure
This commit is contained in:
parent
fa9f9e0a7a
commit
9e84dd35b6
3 changed files with 30 additions and 13 deletions
14
fonts.js
14
fonts.js
|
@ -224,11 +224,15 @@ var FontLoader = {
|
|||
console.log("load font", objId);
|
||||
var encoding = fontObj.encoding;
|
||||
var testStr = "";
|
||||
for (var enc in encoding) {
|
||||
testStr += String.fromCharCode(encoding[enc].unicode);
|
||||
if (testStr.length == 10) {
|
||||
break;
|
||||
}
|
||||
// If the font has a encoding defined. If, use the characters of the
|
||||
// encoding, otherwise use some dump string for testing.
|
||||
if (Object.keys(encoding).length != 0) {
|
||||
for (var enc in encoding) {
|
||||
testStr += String.fromCharCode(encoding[enc].unicode);
|
||||
}
|
||||
} else {
|
||||
console.log("empty font.encoding");
|
||||
testStr = "abcdefghiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-+='!";
|
||||
}
|
||||
|
||||
var before = this.measure(fontObj, testStr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue