-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect spacing of vertial japanese text #11526
Comments
Possibly a duplicate of #7687. |
The cause is that diff --git a/src/display/canvas.js b/src/display/canvas.js
index eaec1a1d..60af1309 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -1719,7 +1719,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
}
}
- var charWidth = width * widthAdvanceScale + spacing * fontDirection;
+ var charWidth = width * widthAdvanceScale - spacing * spacingDir;
x += charWidth;
if (restoreNeeded) { I hope this would help your development. |
Did it pass all existing PDF.js tests too? |
No, it didn't. Only OS: macOS High Sierra 10.13.6 [
{
"name": "Firefox",
"path": "/Applications/Firefox.app/Contents/MacOS/firefox",
"headless": true
}
] Run
|
The following patch passes all the tests. diff --git a/src/display/canvas.js b/src/display/canvas.js
index eaec1a1d..a8213171 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -1719,7 +1719,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
}
}
- var charWidth = width * widthAdvanceScale + spacing * fontDirection;
+ var charWidth = width * widthAdvanceScale - spacing * spacingDir * fontDirection;
x += charWidth;
if (restoreNeeded) {
|
Because the direction of the y-axis is reversed between on the user space coordinate and the canvas coordinate, we have to reverse the sign.
@tamuratak Its purpose is to support negative font sizes in operator Lines 1427 to 1434 in 474fe17
I think you have the correct approach in your pull request when you reverse the sign of To summarize (like you have already debugged), the operator |
When the writing mode is vertical, we have to reverse the sign of spacing since we are subtracting it from current.y. We have to add it to current.y. See https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G7.1852045
When the writing mode is vertical, we have to reverse the sign of spacing since we are subtracting it from current.y. We have to add it to current.y. See 9.4.4 Text Space Details, https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G8.1694762
Fixed by #11540. |
Attach (recommended) or Link to PDF file here:
https://www.nta.go.jp/taxes/tetsuzuki/shinsei/shinkoku/zoyo/yoshiki2019/pdf/006.pdf
Configuration:
Steps to reproduce the problem:
What is the expected behavior? (add screenshot)

By Acrobat Reader, open above link:
What went wrong? (add screenshot)

The text was updated successfully, but these errors were encountered: