Skip to content

Better CJK support #276

Open
Open

Description

@cqjjjzr

I've heard about this new typesetting engine from my friends and I'm immediately attracted to the intuitiveness and elegance of the typst's language - this is exactly the typesetting I need. However, after trying to typeset a lab report of mine using typst, I found its CJK typesetting somehow lacking. To be more detailed:

  • The CJK line-break rule (禁则处理/禁則処理) is basically honored, but all punctuations seem to be treated as using the same size as the normal CJK characters, instead of being squashed first when applying justification.
  • There's no way to specify fonts for CJK and non-CJK (e.g. Latin) characters separately.
  • The first-line indent of CJK paragraphs is always 2-character, and the first line in a page will also be indented, but currently, typst doesn't indent the first line of the first paragraph.
  • There's no way to switch between the basic "styles" of CJK fonts (Songti=Mincho, Heiti=Gothic, Kaiti, Fangsong, etc.) - solvable via custom functions.
  • The spacing between CJK and non-CJK characters should be adjusted.
  • No support for vertical typesetting.
  • No support for pronunciation labeling (ruby).

Since I'm not a typesetting expert, the list can be way longer than above. Supporting proper Chinese, Japanese, and Korean typesetting is a huge project involving numerous aspects, but is definitely invaluable. Please consider taking it into consideration.

Here's some related information:

Activity

  1. laurmaedje commented on Mar 24, 2023

    @laurmaedje
    Member

    Yes. We implemented Typst with general support for non-Latin scripts, but lots of details are not yet dealt with. I'm optimistic that this will improve with time, also because now people who actually know and write these scripts (like you) are testing it.

  2. added
    feature request
    text
    on Apr 1, 2023
  3. ai25395 commented on Jul 21, 2023

    @ai25395

    Fully agree. When I finished the official tutorial on Typst, I felt that I could already use it for some daily work and looked forward to it. However, when I use my native language (non latin) on Typst, I feel that it may require more time to adapt and improve. The several features you mentioned that need improvement are all important and practical. Without these features, as a non Latin native speaker, it would be unlikely for me to use Typst in practical work because my boss will not be satisfied.

  4. Andrew15-5 commented on Sep 10, 2023

    @Andrew15-5
    Contributor
    • No support for pronunciation labeling (ruby).

    I've created a Typst package that you can use for ruby typesetting:
    typst/packages
    Andrew15-5/rubby

    It seems to work pretty good, but I'm not an expert on ruby.

    P.S. Even though I've created a package, the core logic/code is not mine (see Notes section).

  5. laurmaedje commented on Oct 12, 2023

    @laurmaedje
    Member

    I'm not sure whether there any issues when used in practice, but technically regex show rules can be used to configure the CJK font differently, e.g. like this:

    #show regex("\p{sc=Hani}+"): set text(red)
    Hello "你好" 世界
  6. changed the title [-]Better CJK support?[/-] [+]Better CJK support[/+] on Jan 1, 2024
  7. reknih commented on Jan 1, 2024

    @reknih
    Member

    cf. #193

  8. added
    cjk
    on Feb 10, 2025
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