Chinese punctuation spacing: colon before `quote`'s opening mark isn't compressed
Description
Hi Typst team,
I've noticed a spacing issue with Chinese punctuation when a colon (:) appears right before an opening quotation mark (“) generated by the quote function.
Problem Description:
In standard Chinese typography, when a colon (:) is followed by an opening quotation mark (“), the space between them is typically compressed.^1 This usually means they take up less space than two full-width characters, making the text look more compact and natural.
However, with quote, the space between the preceding colon and its opening quotation mark doesn't seem to get compressed. This results in a wider gap than what's typical in Chinese typesetting.
I'm not sure if this is the intended behavior (maybe to visually separate quoted content more clearly?) or if it's a rendering quirk. Either way, it doesn't quite align with common Chinese typographic rules for consecutive punctuation.
Minimal Reproducible Example:
#set text(lang: "zh", region: "cn", font: "Source Han Serif SC")
// This is how it should look
正确示例:“引用内容”。
// This is what happens with #quote
错误示例:#quote[引用内容]。
Reproduction URL
No response
Operating system
Windows, Linux, macOS
Typst version
- [x] I am using the latest version of Typst
Hi again,
Following up on this issue, I've noticed that the spacing inconsistency isn't limited to the opening quotation mark. It appears the closing quotation mark generated by the quote function also doesn't compress its space with subsequent punctuation marks, similar to the problem described for the opening quote.
Did some initial testing, and it seems the problem also exists if you simply pass the content into an identity function, so this is not an issue unique to quotes.
// I haven't downloaded Source Han Serif, but the difference is still visible with the default font
#set text(lang: "zh", region: "cn")
#set page(width: auto, height: auto)
// This is how it should look
正确示例:“引用内容”。
// This is what happens with #quote
错误示例:#quote[引用内容]。
// Testing
#let identity(body) = body
错误示例:#identity[“引用内容”]。
Did some initial testing, and it seems the problem also exists if you simply pass the content into an identity function, so this is not an issue unique to quotes.
It seems like there isn't this issue on my local machine, and after testing several other fonts, the results are as shown in the figure while keeping the language as "zh" and the region as "cn":
Update: Simplified the code while adding tests for the
boxfunction.
code
#set page(columns: 2)
#let test(font: "Source Han Serif SC", showname: none, is_wrong: false) = [
#set text(
lang: "zh",
region: "cn",
font: font,
size: 16pt,
)
#if showname == none {
font
} else { showname } #if is_wrong { sym.dagger } \
示例:“引用内容”。 \
#{ [示例:] + [“引用内容”] }。 \
示例:#[“引用内容”]。 \
#let id(it) = it
示例:#id[“引用内容”]。 \
示例:#quote[引用内容]。 \
示例:#box[“引用内容”]。 \
]
#test(is_wrong: true)
#test(font: "Zhuque Fangsong (technical preview)", showname: [Zhuque Fangsong])
#test(font: "Noto Serif JP")
#test(font: "Jigmo", showname: [Jigmo 字雲])
#colbreak()
#test(font: "Noto Serif CJK SC", is_wrong: true)
#test(font: "Noto Serif SC", is_wrong: true)
#test(font: "Noto Serif CJK JP", is_wrong: true)
#test(font: "LXGW WenKai")
The difference between Noto Serif CJK SC and Noto Serif SC, and between Noto Serif CJK JP and Noto Serif JP, is that the fonts with CJK are language-specific, while those without CJK are region-specific.
I found that this issue seems to be related to the font, but the specific reason is unclear. I have marked all the problematic fonts with #sym.dagger. However, all fonts are normal for the result of the id function.
Note: All fonts were tested using the latest versions downloaded from GitHub or official channels. The CLI parameters are
--ignore-system-fonts --font-path fonts, wherefontsis the local directory where I store these fonts
This issue can be resolved by @YDX-2147483647's comment, but I don't feel this is a true solution, as it relies on the quality of the font. Nevertheless, I plan to close this issue, as the problem is indeed resolved.