Skip to content

Implement word breaking for asian languages #335

Closed

Description

@whs

It seems that Typst do not break long words that are not space-separated.

For example

ซัพพลายเออร์โหงวฮาโลวีนอุปัทวเหตุยนตรกรรมแบคโฮแมชีนเลิฟรีดไถมัฟฟินรูบิกเฟรชชี่ซะพรีเมียมเสกสรรค์คันธาระช็อคก๊วนวานิลลาเลดี้โพสต์วอล์คทรูว้อดก้าชีสฮองเฮาริกเตอร์ป๋อหลอราชบัณฑิตยสถานแอปพริคอทซาฟารีโบกี้แบคโฮผ้าห่มวอเตอร์ละอ่อนยิวธัมโมสารขัณฑ์เทคไคลแม็กซ์ฮัลโลวีนแมชชีนสไลด์ภควัทคีตากิฟท์ทอล์คโปรเจ็กเตอร์สงบสุขโปรเจ็กเตอร์แชมเปญรวมมิตรไคลแมกซ์พาร์ตเนอร์ทอร์นาโดกาญจน์คาเฟ่ศึกษาศาสตร์เอ๋ฟลุตแทคติค

ปิกอัพโปรโมทแมนชั่นคอมพ์กุนซือเป่ายิ้งฉุบอิ่มแปร้ไฮแจ็คไฮกุสหรัฐนายแบบหม่านโถวแทกติคแคทวอล์คทอล์คฮิปฮอปคอนแท็คเกมส์อิสรชนเลคเชอร์ไบโอทริปการันตีเปราะบางท็อปบูตบลูเบอร์รีแจ็กพ็อตบิ๊กวอลนัทรีวิวคาแรคเตอร์เปราะบางดีพาร์ตเมนต์ฟลุทปาสเตอร์อุปการคุณสะกอมบอร์ดไฟลต์เซ่นไหว้แมคเคอเรลเบอร์เกอร์โลโก้ไนท์ชาร์ป

เบอร์รีไฮกุราเมนไวอะกร้าสคริปต์สะบึมส์โอเวอร์เอ็นทรานซ์ช็อปปิ้งชีสไวอากร้าอินดอร์คาร์เคลมเห่ยจอหงวนเมจิคสเกตช์สะบึมส์สตาร์นายพรานอิกัวนาวอล์กแบล็กคอปเตอร์พอเพียงซีนเซ็นทรัลอุปการคุณลาตินกราวนด์ก่อนหน้าเฟรชปฏิสัมพันธ์เอ็กซ์โปโดนัทยะเยือกแอดมิสชันซะตังค์คอปเตอร์เกรย์ตัวเองอมาตยาธิปไตยป๋าโบว์ปฏิสัมพันธ์เซนเซอร์อีสเตอร์เบนโล

ทีวีตรวจทานนอร์ทแฟรีเลคเชอร์โกลด์อัลบัมเชอร์รี่เย้วสโตร์กฤษณ์เคลมเยอบีร่าพ่อค้าบลูเบอร์รี่สหัสวรรษโฮปแคนูโยโย่จูนสตรอว์เบอร์รีซื่อบื้อเยนแบ็กโฮเป็นไงโดนัททอมสเตริโอแคนูวิทย์แดรี่โดนัทวิทย์แอปพริคอทเซอร์ไพรส์ไฮบริดกิฟท์อินเตอร์โซนเซอร์วิสเทียมทานโคโยตี้ม็อบเที่ยงคืนบุญคุณ

อาว์แฟนตาซีซูเอี๋ยพิซซ่ารวมมิตรแอสเตอร์ควีนเลดี้เกจิคาปูชิโนเอ๋อิสรชนช็อปเปอร์อ่วมติงต๊องซิตี้เฟรชสหัชญาณห่วยวาทกรรมไตรมาสทอล์คติวบอมบ์ดั๊มพ์อวอร์ดง่าวซัมเมอร์สะกอมวอล์คขั้นตอนแมนชั่นเพนตากอนท็อปบู๊ทลอจิสติกส์สัมนาวิลล์อุปนายิกาซีนแตงโมตรวจสอบคัตเอาต์เซนเซอร์รีไซเคิลม็อบสารขัณฑ์ฮาโลวีน

Is rendered as

image

Expected result (note that the input text above has all space removed, which is not the case here)

image

Version tested:
Typst Web Application
Deployed on 2023-03-25T14:41:51.218Z
Typst compiler version: d0782b1

Activity

  1. added
    bug
    text
    on Apr 1, 2023
  2. laurmaedje commented on Sep 6, 2023

    @laurmaedje
    Member

    @peng1999 You wrote "Fix #1009, #335" in #1355, but the later fix wasn't detected by GitHub. Can we close this?

  3. peng1999 commented on Sep 6, 2023

    @peng1999
    Contributor

    @peng1999 You wrote "Fix #1009, #335" in #1355, but the later fix wasn't detected by GitHub. Can we close this?

    I don't speak Thai. So it would be better to let someone who knows Thai to confirm it. Maybe @whs ?

  4. whs commented on Sep 6, 2023

    @whs
    Author

    image

    Typst Web Application
    
    Deployed on 2023-09-04T14:43:05.952Z
    Copyright © 2022—2023 Typst
    Typst compiler version: da8367e189b02918a8fe1a98fd3059fd11a82cd9
    

    Result looks almost right. There's no splitting mid-word but there are still splitting in the middle of compound word. I think it would be the artifact of the dictionaryless splitting system?

    For example, the last word of the second to last line of the first paragraph is ทอร์นาโด (tornado)

    ...ทอร์นา
    โด
    

    which is like the English

    ...torna
    do
    
  5. laurmaedje commented on Nov 5, 2023

    @laurmaedje
    Member

    Closing this for now as baseline support has now been there for a while. Further improvements could be discussed in separate issues.

  6. pacaunt commented on Jun 1, 2024

    @pacaunt

    image

    Typst Web Application
    
    Deployed on 2023-09-04T14:43:05.952Z
    Copyright © 2022—2023 Typst
    Typst compiler version: da8367e189b02918a8fe1a98fd3059fd11a82cd9
    

    Result looks almost right. There's no splitting mid-word but there are still splitting in the middle of compound word. I think it would be the artifact of the dictionaryless splitting system?

    For example, the last word of the second to last line of the first paragraph is ทอร์นาโด (tornado)

    ...ทอร์นา
    โด
    

    which is like the English

    ...torna
    do
    

    Mid-word separation is still present; that is "แมนชั {linebreak} ชั่น" as "mans {linebreak} ion" in the third line from last.

  7. added a commit that references this issue on Dec 23, 2024
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