mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-13 00:34:04 +02:00
Merge pull request #20933 from calixteman/issue20930
Fix charSpacing in vertical mode
This commit is contained in:
commit
a90215da48
@ -2948,9 +2948,12 @@ class PartialEvaluator {
|
||||
}
|
||||
|
||||
const font = textState.font;
|
||||
const baseCharSpacing = font.vertical
|
||||
? -textState.charSpacing
|
||||
: textState.charSpacing;
|
||||
if (!chars) {
|
||||
// Just move according to the space we have.
|
||||
const charSpacing = textState.charSpacing + extraSpacing;
|
||||
const charSpacing = baseCharSpacing + extraSpacing;
|
||||
if (charSpacing) {
|
||||
if (!font.vertical) {
|
||||
textState.translateTextMatrix(
|
||||
@ -2979,8 +2982,7 @@ class PartialEvaluator {
|
||||
if (category.isInvisibleFormatMark) {
|
||||
continue;
|
||||
}
|
||||
let charSpacing =
|
||||
textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
|
||||
let charSpacing = baseCharSpacing + (i + 1 === ii ? extraSpacing : 0);
|
||||
|
||||
let glyphWidth = glyph.width;
|
||||
if (font.vertical) {
|
||||
|
||||
@ -3407,7 +3407,7 @@ class Font {
|
||||
if (typeof width !== "number") {
|
||||
width = this.defaultWidth;
|
||||
}
|
||||
const vmetric = this.vmetrics?.[widthCode];
|
||||
const vmetric = this.vmetrics?.[widthCode] || this.defaultVMetrics;
|
||||
|
||||
let unicode = this.toUnicode.get(charcode) || charcode;
|
||||
if (typeof unicode === "number") {
|
||||
|
||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -889,3 +889,4 @@
|
||||
!mesh_shading_empty.pdf
|
||||
!acroform_calculation_order.pdf
|
||||
!extractPages_null_in_array.pdf
|
||||
!issue20930.pdf
|
||||
|
||||
BIN
test/pdfs/issue20930.pdf
Normal file
BIN
test/pdfs/issue20930.pdf
Normal file
Binary file not shown.
@ -14005,5 +14005,12 @@
|
||||
"md5": "5a1bf9cb73010d84b47d91bb66bae27d",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue20930-text",
|
||||
"file": "pdfs/issue20930.pdf",
|
||||
"md5": "321f0901af604a6052baa7b2855a7e3e",
|
||||
"rounds": 1,
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user