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
Apply Patterns, if necessary, when rendering text #6820
Apply Patterns, if necessary, when rendering text #6820
Conversation
I suspect that the two files that are not completely fixed by this PR have a solid color because they use a horizontal gradient instead of a vertical gradient in the two fixed files. Therefore I think that the horizontal gradient is now drawn vertically (also because the text has the color of the leftmost part of the gradient). You might need to specify the direction of the gradient somehow, but that can be done in a follow-up patch; I justed wanted to mention my observation. |
@@ -1421,6 +1421,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { | |||
ctx.transform.apply(ctx, current.textMatrix); | |||
ctx.translate(current.x, current.y + current.textRise); | |||
|
|||
if (current.patternFill) { | |||
// TODO: Some shading patterns are not applied correctly to text. |
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.
Could you list the issue numbers here too for reference? Otherwise I'm afraid it will be hard to find those later.
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.
Sure, fixed now.
I'd actually be surprised if it's that simple, since there appears to be more issues at play here. Look at the PDF files in #6234 (comment); the first one is included as a test-case in this patch. |
Currently we're not applying Patterns for text, but only for graphics. This patch is unfortunately not a complete solution, but rather a step on the way, since there are still some PDF files where the Patterns look more like a solid colour, rather than the intended gradient. I've been unable to fix these issues completely, and I've not managed to determine if the remaining issues are caused either by the pattern code, the canvas code, or perhaps both. However, given that even this simple patch improves the current situation quite a bit, I figured that it couldn't hurt to submit it as-is. - Fixes 5804. - Fixes 6130. - Improves 3988 a lot, since the text is now visible. However, it looks like the text is *one* solid colour, instead of the correct gradient. - Improves 5432, since the text is no longer gray. (This file also suffers from the same problem as the previous one.)
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/f6931be12cacab9/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/f6931be12cacab9/output.txt Total script time: 0.85 mins Published |
IRC log:
Checking it is the same test /botio-linux test |
I tried out issue6286.pdf through x11 and it seems to load fine. It does take awhile, but I think that's just x11 being slow. |
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/b83386fa0b72163/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/59a60032097219c/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/59a60032097219c/output.txt Total script time: 20.98 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/b83386fa0b72163/output.txt Total script time: 21.61 mins
|
/botio makeref |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/82479ca587299e9/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/4e8c41fffda4135/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/4e8c41fffda4135/output.txt Total script time: 20.79 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/82479ca587299e9/output.txt Total script time: 21.11 mins
|
Apply Patterns, if necessary, when rendering text
Thank you! |
Currently we're not applying Patterns for text, but only for graphics.
This patch is unfortunately not a complete solution, but rather a step on the way, since there are still some PDF files where the Patterns look more like a solid colour, rather than the intended gradient.
I've been unable to fix these issues completely, and I've not managed to determine if the remaining issues are caused either by the pattern code, the canvas code, or perhaps both.
However, given that even this simple patch improves the current situation quite a bit, I figured that it couldn't hurt to submit it as-is.