Skip to content

Chinese punctuation overhang #6582

Open

Description

@Krasjet

Description

Hi, I'm trying to enable punctuation overhang for Chinese punctuation. I noticed that this feature was already there but it was removed by #1211.

It was quoted that

Most Chinese publications do not use hanging punctuation at line end.

But this is more of a stylish choice, not a rule, and I definitely see publications using overhang punctuation, especially in the indie publishing scene. InDesign also provides this option (Apply kinsoku hanging): https://helpx.adobe.com/indesign/using/composing-cjk-characters.html

Do you think it would be possible to provide some customization options for which punctuation should be used for hanging?

Use Case

See for example the punctuation in 政见合辑

政见合辑

Han.css also enables punctuation hanging by default for simplified Chinese, but not traditional Chinese.

Han

See also: https://ethantw.github.io/Han/latest/hanging.html#hans

Activity

  1. added
    feature request
    on Jul 9, 2025
  2. added
    cjk
    text
    on Jul 9, 2025
  3. Krasjet commented on Jul 10, 2025

    @Krasjet
    ContributorAuthor

    might be related #261

  4. YDX-2147483647 commented on Jul 26, 2025

    @YDX-2147483647
    Contributor

    A possible fix would be:

    1. changing text.overhang from bool (default: true) to bool | auto (default: auto, which resolves to true/false according to text.lang),

    2. and adding back '\u{3001}' | '\u{3002}' => 1.0 to overhang()

      /// How much a character should hang into the end margin.
      ///
      /// For more discussion, see:
      /// <https://recoveringphysicist.com/21/>
      fn overhang(c: char) -> f64 {
      match c {
      // Dashes.
      '–' | '—' => 0.2,
      '-' => 0.55,
      // Punctuation.
      '.' | ',' => 0.8,
      ':' | ';' => 0.3,
      // Arabic
      '\u{60C}' | '\u{6D4}' => 0.4,
      _ => 0.0,
      }
      }


    An explanatory article: The Biggest Myth in Chinese Typesetting: Punctuation Overhang 中文排版的最大迷思:标点悬挂 (thetype.com) (Chinese only)

    LLM summary (Chinese)

    文章《中文排版的最大迷思:标点悬挂》探讨了“标点悬挂”这一排版技术。作者指出,虽然标点悬挂常被视为精致排版的标志,但它实际上源自西方的“视觉边距对齐”(Optical Margin Alignment),主要目的是为了处理西文字符形状不一导致的视觉边缘不齐。

    文章强调,简单套用西文逻辑到中文排版并不合适。中文排版的核心在于“避头尾”规则和“标点挤压”,而标点悬挂只是处理避头尾的一种可选方式,而非必要条件。作者认为,相较于单纯追求行尾对齐的悬挂,更应优先考虑行内标点的挤压处理,以维持中文“密排”和网格的整齐感。

    文章分析了多种排版软件(如 Word, InDesign, QuarkXPress)对标点悬挂的支持和设置,并指出其背后的算法逻辑。结论是,标点悬挂不应被盲目推崇或作为唯一解决方案。正确的排版需要一个系统性的设计逻辑,综合考虑标点挤压、避头尾、行长、字距调整等多个因素,其应用需要根据具体情境(如行长、文本类型、整体设计风格)进行判断,而不是一刀切地“挂”或“不挂”。文章最后提出了一些值得进一步探讨的中文排版需求问题。

    LLM summary (English)

    The article "The Greatest Misconception in Chinese Typesetting: Hanging Punctuation" examines the typographic technique known as "hanging punctuation." The author argues that while hanging punctuation is often seen as a hallmark of refined typesetting, it actually originates from the Western concept of "optical margin alignment," primarily aimed at addressing the visually uneven edges caused by the varied shapes of Latin letters.

    The article emphasizes that directly applying Western logic to Chinese typesetting is inappropriate. The core of Chinese typesetting lies in "line-start/line-end prohibition rules" (avoiding certain punctuation at the beginning or end of lines) and "punctuation compression/adjustment." Hanging punctuation is presented merely as one optional method within the strategy for handling line-end punctuation, not a necessary condition. The author contends that priority should be given to adjusting punctuation spacing within the line (compression) to maintain the essence of Chinese "solid setting" and grid alignment, rather than simply hanging punctuation for edge alignment.

    The article analyzes how various desktop publishing software (like Microsoft Word, Adobe InDesign, QuarkXPress) implement hanging punctuation and explains the underlying algorithms. The conclusion is that hanging punctuation should not be blindly championed or used as a universal solution. Correct typesetting requires a systematic design logic that considers multiple factors holistically, including punctuation adjustment, line-start/line-end rules, line length, character spacing, and overall design intent. The decision to use hanging punctuation should be based on specific contexts (e.g., line length, text type, design style) rather than being applied uniformly. The article concludes by posing further questions about Chinese typesetting requirements worthy of discussion.

    For Chinese, set par(justify: true) kind of eliminates the need of set text(overhang: true).

  5. Krasjet commented on Jul 28, 2025

    @Krasjet
    ContributorAuthor

    A possible fix would be:

    1. changing text.overhang from bool (default: true) to bool | auto (default: auto, which resolves to true/false according to text.lang),

    2. and adding back '\u{3001}' | '\u{3002}' => 1.0 to overhang()

    Yeah, I know it's possible to fix this problem directly in the rust code, essentially reverting #1211. Though I wish more parts of the layout engine could be directly accessed in the Typst scripting language, since this is a stylistic choice, not a rule, e.g.

    #let punct_hang = (
      "\u{3001}": 1.0,
      "\u{3002}": 1.0,
      "\u{FF0C}": 1.0,
    )
    #set text(overhang: punct_hang)

    probably it should also have a global variable that encodes the default overhang table.

    For Chinese, set par(justify: true) kind of eliminates the need of set text(overhang: true).

    I don't really agree with this part. Overhang is only useful when paragraph justification is enabled, where the optical misalignment, i.e. jagged spaces, of the left and right edges are more prominent. To reference an image in the article you mentioned:

    Image

    It's something extra to justification, and it's a stylistic choice to prefer outward protrusion over inward jagged spaces. Sometimes there won't be any flexible spaces within a line to move the punctuation elsewhere without creating more inter-character spacing.

    I feel like the main confusion about this technique being not necessary is that the quality of typesetting in most Chinese publications are limited by the tools, with this feature not being widely available, so it's hard to find high quality examples of typesetting in Chinese, especially ones that use this feature with care. It can be helpful to think about how to do this with pen and paper without the constraints of existing typesetting tools, rather than looking for existing examples designed by other tools to decide what a tool should do. It can be a vicious cycle that never leads to any improvements.

  6. added a commit that references this issue on Jul 28, 2025
  7. YDX-2147483647 commented on Jan 31, 2026

    @YDX-2147483647
    Contributor

    If #7782 is merged, then the above is possible.

    Image
    #set page(height: auto, width: 16em, margin: 1em, background: {
      block(stroke: (x: blue + 0.5pt), width: 14em, height: 100%)
    })
    
    #set text(lang: "zh", font: "Source Han Serif", top-edge: "ascender", bottom-edge: "descender", overhang: (
      "。": (false, 100%),
      rest: right,
    ))
    #set par(justify: true)
    
    字体排印不是艺术;字体排印也不是科学。字体排印是一项工艺。这项工艺不是对那些规则一知半解地盲从,而是要凭借尝试和验证过的经验进行精密地运用。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cjkfeature requesttext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions