Use "standard" shadowing in the Font.spaceWidth
method
With `Font.exportData` now only exporting white-listed properties, there should no longer be any reason to not use standard shadowing in the `Font.spaceWidth` method. Furthermore, considering the amount of other changes to the code-base over the years it's not even clear to me that the special-case was necessary any more (regardless of the preceding patches).
This commit is contained in:
parent
a5e4cccf13
commit
c5e1fd3fde
@ -3158,10 +3158,6 @@ var Font = (function FontClosure() {
|
||||
},
|
||||
|
||||
get spaceWidth() {
|
||||
if ("_shadowWidth" in this) {
|
||||
return this._shadowWidth;
|
||||
}
|
||||
|
||||
// trying to estimate space character width
|
||||
var possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
|
||||
var width;
|
||||
@ -3176,10 +3172,8 @@ var Font = (function FontClosure() {
|
||||
var glyphUnicode = glyphsUnicodeMap[glyphName];
|
||||
// finding the charcode via unicodeToCID map
|
||||
var charcode = 0;
|
||||
if (this.composite) {
|
||||
if (this.cMap.contains(glyphUnicode)) {
|
||||
charcode = this.cMap.lookup(glyphUnicode);
|
||||
}
|
||||
if (this.composite && this.cMap.contains(glyphUnicode)) {
|
||||
charcode = this.cMap.lookup(glyphUnicode);
|
||||
}
|
||||
// ... via toUnicode map
|
||||
if (!charcode && this.toUnicode) {
|
||||
@ -3196,10 +3190,7 @@ var Font = (function FontClosure() {
|
||||
}
|
||||
}
|
||||
width = width || this.defaultWidth;
|
||||
// Do not shadow the property here. See discussion:
|
||||
// https://github.com/mozilla/pdf.js/pull/2127#discussion_r1662280
|
||||
this._shadowWidth = width;
|
||||
return width;
|
||||
return shadow(this, "spaceWidth", width);
|
||||
},
|
||||
|
||||
charToGlyph: function Font_charToGlyph(charcode, isSpace) {
|
||||
|
Loading…
Reference in New Issue
Block a user