-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Convert illegal html unicode without glyph to space or zero-width space. #493
base: incoming
Are you sure you want to change the base?
Conversation
<< ' ' << CSS::WHITESPACE_CN << wid << "\">" << (target > (threshold - EPS) ? " " : "") << "</span>"; | ||
<< ' ' << CSS::WHITESPACE_CN << wid << "\">"; | ||
if (target > (threshold - EPS)) | ||
dump_unicode(out, ' '); |
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.
I think that the space character will bring extra width after the span
, which could be unintended?
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.
The space is in that span, not after it. This change doesn't change previous behavior, just updates last_output_unicode
.
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.
Ah I see, sorry for the mistake.
Thanks for the patch! Maybe we can enabled it also for One thing I don't quite like is that touching I feel that this patch adds too many states/variables, making the renderer even more messy. Of course this is due to the ugly design of the HTMLRenderer currently. I wonder if we may delay this until the overhual is finished, such that this feature may be implemented as a separated self-enclosing pass. Finally, could you also add a test case for this (maybe after we have no issues left for the code). Other possible methods I was thinking of
|
Then we can copy necessary codes from
Yeah, I also plan to simplify it a little in following days, especially in
The sample file in #477 was used to test this patch. Unforturnately I found a problem in browsers, FF and webkit disagree with whether add letter-spacing around ZWSP: |
Further, it seems that this is better done in |
OK, I agree. |
After some thought, I think most (if not all) "illegal html unicode without glyph" should be converted to a
In order to accomplish this,
Type of
Some notes:
|
This patch convert space-like char (usually illegal in html) in PDF to space/ZWSP in html, rather than private unicodes. Now sample in #477 can be converted perfectly.
This patch depends on
CairoFontEngine
so ENABLE_SVG should be on (if set off, will not convert at all).There are minor modifications to
CairoFontEngine.h|cc
which should be merged in furture update.