Skip to content
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

Style issues #1329

Closed
jiang0112 opened this issue May 13, 2024 · 3 comments
Closed

Style issues #1329

jiang0112 opened this issue May 13, 2024 · 3 comments
Labels

Comments

@jiang0112
Copy link

When applying the CSS styles with double underscores, specifically text-decoration-line: underline;, text-decoration-style: double;, and text-decoration-style: under;, the two lines appear to merge into one.The documentation indeed supports these properties.

bug

code.txt
image
image

@jiang0112 jiang0112 added the bug label May 13, 2024
@depth42
Copy link

depth42 commented May 13, 2024

Just some thoughts: The mentioned problem does only seem to occur with Chrome not with Safari. However, I have been using Vivliostyle in a WKWebView on iOS, which is basically a Safari view inside an app. With it, I have been paginating HTML documents and converted them to PDFs. In this process, there are a lot of rounding / pixel-snapping errors with text underlines similar to the reported issue. The only way I could find to work around them is to blow up the scaling in Vivliostyle to 400% and to then scale the PDFs back down. It seems like the Chrome and Safari engines don't have a very precise model for underlines.

@MurakamiShinyu
Copy link
Member

I investigated this issue and found that the problem is caused by Chrome (Chromium)'s rendering of text-decoration-style: double where the distance of the two lines depends on the device pixel size (= 1px / window.devicePixelRatio) which is equal to the minimum border line width. Current Vivliostyle.js implementation uses a hack emulating very high pixel ratio to enable very thin border width on PDF output. See:

The output pixel ratio is configurable by setting pixelRatio=<number> in Vivliostyle Viewer options, or in the CoreViewerOptions. The default setting is pixelRatio=8, which means that the minimum border width is 1/8 px = 0.125px (about 0.09pt, or 0.033mm).

As a result, the distance of the two lines of double underline becomes 1/8 px = 0.125px, which is too small and the gap is almost invisible.

Possible workarounds will be:

  • specify pixelRatio=0 to disable the high pixel ratio emulation and use the default browser rendering
  • or, use border-bottom-style: double instead of text-decoration-style: double

@jiang0112
Copy link
Author

Thanks for your reply, the problem is solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants