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

Text-decoration-line overhangs at open punctuation trimmed by text-spacing-trim #1435

Open
MurakamiShinyu opened this issue Dec 26, 2024 · 1 comment
Labels

Comments

@MurakamiShinyu
Copy link
Member

MurakamiShinyu commented Dec 26, 2024

text-spacing-trimによって半角幅に詰められた開き括弧類にかかる下線が、詰められたはずのアキの部分にまで引かれるために、行頭に下線がはみ出して表示される問題があります。

From #1061 (comment)

Test with Vivliostyle Viewer (v2.30.7):
https://vivliostyle.github.io/viewer/v2.30.7/#src=https://raw.githack.com/vivliostyle/vivliostyle.js/master/packages/core/test/files/text-spacing/text-spacing-ja.html&style=data:,/*%3Cviewer%3E*/%0A/*%3C/viewer%3E*/%0Ap%20%7B%0A%20%20text-decoration:%20underline;%0A%7D

Screenshot 2024-12-26 10 49 32

  • text-spacing:auto(trim-bothと同じ)の場合、行頭の開き括弧("〈")の下線が行頭にはみでている
@MurakamiShinyu MurakamiShinyu changed the title Text-decoration-line overhangs at open punctuation trimmed at line-start by text-spacing-trim Text-decoration-line overhangs at open punctuation trimmed by text-spacing-trim Dec 26, 2024
@MurakamiShinyu
Copy link
Member Author

MurakamiShinyu commented Dec 26, 2024

試してみた修正方法(出力されるPDFで問題あり)

assets.ts の export const VivliostylePolyfillCss = に次のCSSルールを追加する:

[style*=text-decoration] viv-ts-open:is(.viv-ts-trim, .viv-ts-auto) {
  clip-path: content-box;
}

これで、行頭の開き括弧("〈")の下線が行頭にはみでなくなる。しかし、これで出力したPDFからテキストをコピーすると、このルールが適用された開き括弧が抜け落ちてページの最後までコピーすると最後にまとめてそれらの開き括弧がコピーされているというものになる。

例:(ローカルの開発環境で、上記の修正をして yarn dev でテスト)
http://localhost:3000/viewer/lib/vivliostyle-viewer-dev.html#src=https://raw.githack.com/vivliostyle/vivliostyle.js/master/packages/core/test/files/text-spacing/text-spacing-ja.html&style=data:,/*%3Cviewer%3E*/%0A/*%3C/viewer%3E*/%0Ap%20%7B%0A%20%20text-decoration:%20underline;%0A%7D

これでPDFを出力
text-spacingテスト.pdf
VSCodeのPDFビューアで開いて、1ページ目の最初から最後まで選択してコピーした結果:

文字組版用CSSプロパティ、「text-spacing」
テスト
default
〈約物〉は、句点〉・読点〉括弧(類)」、他! 英(数)》字 ABC-123 とか。」約物〉は、
〈句点〉・読点〉括弧(類)」、他! 英(数)》字 ABC-123 とか。」
text-spacing: none
〈約物〉は、〈句点〉・〈読点〉「括弧(類)」、他! 「《英(数)》字ABC-123とか。」〈約物〉は、〈句点〉・〈読点〉「括弧(類)」、他! 「《英(数)》字ABC-123とか。」
text-spacing: normal
〈約物〉は、句点〉・読点〉括弧(類)」、他! 英(数)》字 ABC-123 とか。」約物〉は、
〈句点〉・読点〉括弧(類)」、他! 英(数)》字 ABC-123 とか。」
text-spacing: auto
約物〉は、句点〉・読点〉括弧(類)」、他! 英(数)》字 ABC-123 とか。」約物〉は、
句点〉・読点〉括弧(類)」、他! 英(数)》字 ABC-123 とか。」
〈〈「「《〈
〈「「《
〈〈「「《〈
〈「「《
〈〈〈「「《〈
〈〈「「《

これでは困るので、この修正方法は採用できない。

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

1 participant