Skip to content

Wrong spacing for Thai words after a line break. #5543

Open

Description

@pacaunt

Description

This happens when I type in Thai characters with some space and set par(justify: true). The compiler just break the lines automatically but the space after linebreak is not eliminated like in latin characters.

This is the output:
Screenshot from 2024-12-07 16-29-15
while this all is from only one input line of code:
Screenshot from 2024-12-07 16-29-32

Reproduction URL

https://typst.app/project/r9pZvRg02ZG2Mw8rvtBomz

Operating system

Web app

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Dec 7, 2024
  2. added
    text
    on Dec 7, 2024
  3. pacaunt commented on Jul 7, 2025

    @pacaunt
    Author

    My current workaround:

    #set text(lang: "th", region: "TH", font:"Noto Sans Thai")
    
    #set par(justify: true)
    #let sequence = [].func()
    
    #show sequence: it => {
      if it.has("label") and it.label == <processed> {
        it
      } else {
        let fields = it.fields()
        let _ = fields.remove("label", default: none)
        let children = fields.remove("children").filter(it => it != [ ])
        [#sequence(children)<processed>]
      }
    }
    
    บูรณาการมวลชนลงทุนล้ำสมัยต้นแบบ ทั้งนี้ของบูรณาการสำคัญข้อความ พลเมืองจริยธรรมต้นแบบสำเร็จ 
    กระแสโลกาภิวัฒน์หลากหลายนวัตกรรมนวัตกรรมบริหาร คัดเลือกด้วยประชารัฐทั้งนี้มุ่งมั่น
    คุณธรรมวัยรุ่นพันธกิจสร้างสรรค์พลเมือง ข้อความสนทนาเป้าหมายสุขภาวะคัดเลือก ซึ่งด้วยสนทนาในเพื่อสนธิกำลัง 
    เป้าหมายสนใจสนทนาพยายาม เทคโนโลยีประโยชน์ต้นแบบสุขภาวะสำเร็จ วิสาหกิจและวาทกรรมซึ่งมุ่งมั่นที่สำเร็จ 
    ที่ของ
  4. haminic commented on Jul 18, 2025

    @haminic

    This seems to happen only with linebreaks set to "optimized" or auto, so a workaround is to use linebreaks: "simple" instead. Seeing that it has something to do with the "optimized" option and spaces between line breaks, it might be related to #5348, but I'm not sure.

    Side note: I tried with a few other scripts and found the same behavior in Burmese, Lao, and Khmer.

  5. added a commit that references this issue on Oct 28, 2026
    d91abc8
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

    bugtext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions