You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Start of line CJK right-aligned punctuation and non-zero tracking causes left overhang #8959
location: typst-layout/src/inline line.rs/adjust_cj_at_line_start shrinks the first right-aligned cjk punctuation glyph on the left through shrink_left.
The shrink amount is calculated in shaping.rs/calculate_adjustability which calls base_adjustability.
Currently, this sets the shrink left to amount for cjk right aligned punctuation to glyph.x_advance/2.0. Since track_and_space is executed before calculate_adjustability which increments x_advance by tracking...
right aligned CJK punctuation at the start of a line will be offest by an additionaltracking/2.0 to the left.
changed the title [-]Start of line CJK right-aligned punctuationand non-zero tracking causes left overhang[/-][+]Start of line CJK right-aligned punctuation and non-zero tracking causes left overhang[/+]on Oct 16, 2026
Although this issue has been (and should be) closed after #8985, I want to mention that the result of this case is probably still problematic.
A member of the W3C's Chinese Layout Task Force once posted an image in w3c/clreq#454, implying that tracking should not affect the distance between the brackets and the texts inside the brackets, or at least the distance should be much shorter than tracking. Personally, I also think that would look nicer.
The following image illustrates the difference between Typst v0.15.1, Typst main and that approach:
Code
#settext(
lang: "zh",
font: "Noto Serif CJK SC",
top-edge: "ascender",
bottom-edge: "descender",
)
#setpage(width: auto, height: auto, margin: 2em)
#setraw(lang: "typc")
#show: block.with(stroke: (left: green))
= Default result for v0.15.1
「一」文钱「十」个
= Use `0.75em` tracking with v0.15.1#text(tracking: 0.75em)[「一」文钱「十」个]
= Use `0.75em` tracking after \#8985// This part should be compiled with `main` (64c5e8c0).#text(tracking: 0.75em)[「一」文钱「十」个]
= Ideal result#{
lettracking= 0.75emletw= 0.4em// The width of `」`, with visual effects compensatedshow".": h(calc.max(0em, tracking-1em+w))
[「一」.文#h(tracking)钱.「十」.个]
}
However, it is quite uncommon to use punctuations with nonzero tracking in Chinese documents. It seems that even CLReq has not seriously discussed about it yet. Therefore, I think we can leave it like this for now. Before CLReq updates, I don't think creating a separate issue would be of any use either.
Activity
[-]Start of line CJK right-aligned punctuationand non-zero tracking causes left overhang[/-][+]Start of line CJK right-aligned punctuation and non-zero tracking causes left overhang[/+]YDX-2147483647 commentedon Oct 27, 2026
Although this issue has been (and should be) closed after #8985, I want to mention that the result of this case is probably still problematic.
A member of the W3C's Chinese Layout Task Force once posted an image in w3c/clreq#454, implying that tracking should not affect the distance between the brackets and the texts inside the brackets, or at least the distance should be much shorter than tracking. Personally, I also think that would look nicer.
The following image illustrates the difference between Typst v0.15.1, Typst
mainand that approach:Code
However, it is quite uncommon to use punctuations with nonzero tracking in Chinese documents. It seems that even CLReq has not seriously discussed about it yet. Therefore, I think we can leave it like this for now. Before CLReq updates, I don't think creating a separate issue would be of any use either.