mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58: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:
parent
bf870bd2ac
commit
8540b4cc76
2 changed files with 9 additions and 6 deletions
|
@ -1326,7 +1326,7 @@ class WidgetAnnotation extends Annotation {
|
|||
|
||||
_computeFontSize(font, fontName, fontSize, height) {
|
||||
if (fontSize === null || fontSize === 0) {
|
||||
const em = font.charsToGlyphs("M", true)[0].width / 1000;
|
||||
const em = font.charsToGlyphs("M")[0].width / 1000;
|
||||
// According to https://en.wikipedia.org/wiki/Em_(typography)
|
||||
// an average cap height should be 70% of 1em
|
||||
const capHeight = 0.7 * em;
|
||||
|
@ -1597,7 +1597,7 @@ class TextWidgetAnnotation extends WidgetAnnotation {
|
|||
}
|
||||
|
||||
const scale = fontSize / 1000;
|
||||
const whitespace = font.charsToGlyphs(" ", true)[0].width * scale;
|
||||
const whitespace = font.charsToGlyphs(" ")[0].width * scale;
|
||||
const chunks = [];
|
||||
|
||||
let lastSpacePos = -1,
|
||||
|
@ -1618,7 +1618,7 @@ class TextWidgetAnnotation extends WidgetAnnotation {
|
|||
lastSpacePos = i;
|
||||
}
|
||||
} else {
|
||||
const charWidth = font.charsToGlyphs(character, false)[0].width * scale;
|
||||
const charWidth = font.charsToGlyphs(character)[0].width * scale;
|
||||
if (currentWidth + charWidth > width) {
|
||||
// We must break to the last white position (if available)
|
||||
if (lastSpacePos !== -1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue