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

Stop calling Font.charsToGlyphs, in src/core/annotation.js, with unused arguments

As can be seen in `src/core/fonts.js`, this method only accepts *one* parameter, hence it's somewhat difficult to understand what the Annotation-code is actually attempting to do here.
The only possible explanation that I can imagine, is that the intention was initially to call `Font.charToGlyph` *directly* instead. However, note that that'd would not actually have been correct, since that'd ignore one level of font-caching (see `this.charsCache`). Hence the unused arguments are removed, in `src/core/annotation.js`, and the `Font.charToGlyph` method is now marked as "private" as intended.
This commit is contained in:
Jonas Jenwald 2020-10-29 14:05:42 +01:00
parent bf870bd2ac
commit 8540b4cc76
2 changed files with 9 additions and 6 deletions

View file

@ -3208,7 +3208,10 @@ var Font = (function FontClosure() {
return shadow(this, "spaceWidth", width);
},
charToGlyph: function Font_charToGlyph(charcode, isSpace) {
/**
* @private
*/
_charToGlyph(charcode, isSpace = false) {
var fontCharCode, width, operatorListId;
var widthCode = charcode;
@ -3332,13 +3335,13 @@ var Font = (function FontClosure() {
i += length;
// Space is char with code 0x20 and length 1 in multiple-byte codes.
var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
glyph = this.charToGlyph(charcode, isSpace);
glyph = this._charToGlyph(charcode, isSpace);
glyphs.push(glyph);
}
} else {
for (i = 0, ii = chars.length; i < ii; ++i) {
charcode = chars.charCodeAt(i);
glyph = this.charToGlyph(charcode, charcode === 0x20);
glyph = this._charToGlyph(charcode, charcode === 0x20);
glyphs.push(glyph);
}
}