-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Implement vertical writing for CJK text #2686
Conversation
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @jviereck received. Current queue size: 0 Live output at: http://107.22.172.223:8877/536e9ba863d7cc6/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @jviereck received. Current queue size: 0 Live output at: http://107.21.233.14:8877/c6c9cdbd3c02957/output.txt |
switch (textRenderingMode) { | ||
default: // other unsupported rendering modes | ||
case TextRenderingMode.FILL: | ||
case TextRenderingMode.FILL_ADD_TO_PATH: | ||
ctx.fillText(character, scaledX, 0); | ||
if (vertical) { | ||
ctx.fillText(character, 0 + vx, scaled + vy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What the reason for the extra 0 +
here and the following lines?
Thanks a lot for this patch! The code for the rendering part looks good to me, but I don't know anything about fonts, so someone else has to do a review on that part. |
Copy over image from https://bugzilla.mozilla.org/show_bug.cgi?id=770409 as reference: |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/536e9ba863d7cc6/output.txt Total script time: 19.77 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/c6c9cdbd3c02957/output.txt Total script time: 21.67 mins
|
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @jviereck received. Current queue size: 0 Live output at: http://107.21.233.14:8877/1c3c0545e1a1422/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/1c3c0545e1a1422/output.txt Total script time: 0.20 mins Published |
@vyv03354 the rendering looks good but the textLayer/selection is broken. The div is placed horizontal and not vertically. What's the correct behavior here? Should the div containing the letters have a new line-break after each letter or should the div be rotated by 90 degrees? |
Obviously "writing-mode: vertical-rl" would be the correct choice. But Firefox is unlikely to support writing-mode in near future, so I'll rotate the div at the moment. Individual rotated glyphs would not be a problem because textLayer texts are invisible anyway. |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @mduan received. Current queue size: 1 Live output at: http://107.22.172.223:8877/cd21954d23be9ba/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @mduan received. Current queue size: 1 Live output at: http://107.21.233.14:8877/3ad38673ed08ad7/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/cd21954d23be9ba/output.txt Total script time: 19.67 mins
|
Infra error? |
I think so /botio-linux test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/359ea46350a5552/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/359ea46350a5552/output.txt Total script time: 21.55 mins
|
What do I have to do to merge this? Just waiting for a review? |
You should never merge anything yourself, even if you are allowed to. Let someone else review the code and decide. In this case, someone from the dev team (from Mozilla) may merge it if they like the PR after a review. |
I did not mean to say "merge it myself". I should have said "to be merged". |
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @jviereck received. Current queue size: 0 Live output at: http://107.21.233.14:8877/14401a07bd060a9/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/14401a07bd060a9/output.txt Total script time: 0.16 mins Published |
Yes --- and if it takes too long for you taste (> 1 week?) poke someone kindly :) |
(... as mentioned at https://github.com/mozilla/pdf.js/wiki/Contributing item 7) |
Do you know if there is a bug on file for this already? Would you mind to open one if it is not? Sometimes magic things happens once a bug is filed and things get implemented faster then expected. |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://107.22.172.223:8877/916604a032a632e/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://107.21.233.14:8877/30e234c279c3dff/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/916604a032a632e/output.txt Total script time: 19.74 mins
Image differences available at: http://107.22.172.223:8877/916604a032a632e/reftest-analyzer.xhtml#web=eq.log |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/30e234c279c3dff/output.txt Total script time: 21.68 mins
|
I was unable to reproduce the reftest failure locally. |
The failure may be an intermittent issue unrelated to your changes. There's still a few of those, I think. |
The changes look like they're from the FF19 update. I'll open a pr to update them and re-run here. |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/01a58d3201b5515/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/dd74c3e5c16861e/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/01a58d3201b5515/output.txt Total script time: 19.61 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/dd74c3e5c16861e/output.txt Total script time: 19.64 mins
|
/botio makeref |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @brendandahl received. Current queue size: 0 Live output at: http://107.21.233.14:8877/dc2aad9de6abfb8/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @brendandahl received. Current queue size: 0 Live output at: http://107.22.172.223:8877/18d48e6b1a3c10d/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/18d48e6b1a3c10d/output.txt Total script time: 19.82 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/dc2aad9de6abfb8/output.txt Total script time: 25.41 mins
|
Implement vertical writing
Thanks for implementing this. |
For reference, linking 2 bugzilla issues related to this: |
As explained in #2817, this has not fixed the issue of displaying the vertical text for latin fonts (the hidden layer text, rendering itself is OK). BidiResult does not get "vertical" flag set. Examples are arXiv PDFs: http://arxiv.org/pdf/0707.3023.pdf |
Uh, even the PDF which was used for testing in #2686 does have a bug and does not display text layer correctly. |
#2817 is a different problem from this bug. Latin vertical text is rendered by a different method from CJK one even if they are mixed (like http://blogs.adobe.com/CCJKType/files/2012/07/TaroUTR50SortedList112.pdf ). |
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=770409 .