Skip to content

Size per font #6295

Open
Open

Description

@pompydev

Description

Currently, the only option for font size is a single global config.

#set text(
  font: (
    "Playpen Sans",    // 15pt
    "Nanum Pen Script" // 15pt
  ),
  size: 15pt
)

I propose adding the option to set size for each font in addition to the existing global font size setting.

#set text(
  font: (
    "Playpen Sans",               // 11pt
    (name: "Nanum Pen Script", size: 15pt)
  ),
  size: 11pt
)

Use Case

Different fonts (especially for different languages) have different visible font sizes.

For example, when using Nanum Pen Script, a Korean font with Playpen Sans, a English font, with the following config:

#set text(font: ("Playpen Sans", "Nanum Pen Script"))

We get the following result:

Image

While we can do something like #text(cjk_font_size)[복소수] as a hacky way to fix the issue, a single place to target all cjk fonts would be very helpful for multi-language documents.

Activity

  1. added
    textRelated to the text category, which is all about text handling, shaping, etc.
    cjkChinese, Japanese, Korean typography.
    on May 21, 2025
  2. bluss commented on Jul 2, 2025

    @bluss
    Contributor

    Could this be an alternate solution for raw and its font? There is no reason the raw element should have a default 0.8em text size - instead its mono font could "load in at a smaller size"?

  3. laurmaedje commented on Jul 2, 2025

    @laurmaedje
    Member

    Could this be an alternate solution for raw and its font? There is no reason the raw element should have a default 0.8em text size - instead its mono font could "load in at a smaller size"?

    Sort of, but it's worth mentioning that most mono fonts are somehow just visually too large, so as soon as you switch, you'd typically have to include the 0.8em (or whatever factor) yourself.

  4. Enivex commented on Jul 2, 2025

    @Enivex
    Collaborator

    Could this be an alternate solution for raw and its font? There is no reason the raw element should have a default 0.8em text size - instead its mono font could "load in at a smaller size"?

    Sort of, but it's worth mentioning that most mono fonts are somehow just visually too large, so as soon as you switch, you'd typically have to include the 0.8em (or whatever factor) yourself.

    CSS seems to have something relevant here

    https://developer.mozilla.org/en-US/docs/Web/CSS/font-size-adjust

  5. chiefaccelerators commented on Aug 20, 2025

    @chiefaccelerators

    Can we also add baseline settings per font? Different Chinese font vendors often set their fonts at different "baselines" (because baseline isn't really a thing in Chinese), so they can be misaligned when used together. And many of them have terrible Latin type design, which makes it a necessity to use a different Latin font and adjust baselines accordingly:

    Image
  6. tjwhang commented on Dec 2, 2025

    @tjwhang

    Currently the easiest workaround I can possibly find for size and baselines before this is changed is to do something like this:

    #show regex("[\p{scx:Han}\p{scx:Hira}\p{scx:Kana}\p{scx:Hangul}]"): set text(size: 0.925em)
    #show regex("[\p{scx:Hangul}]"): set text(baseline: -0.04em)

    before:

    Image

    after:

    Image
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

    cjkChinese, Japanese, Korean typography.feature requestNew feature or requesttextRelated to the text category, which is all about text handling, shaping, etc.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions