Skip to content

Automatic font expansion #4693

Open
Open

Description

@Enivex

Description

The microtype package in LaTeX provides several microtypographical features. The two main ones, enabled by default in pdfTeX and luaTeX, are protrusion and expansion.

Typst already supports a (very) limited form of protrusion, and there's an existing issue concerning improving this #261

However, expansion is currently completely absent from Typst, as far as I'm aware.

Automatic font expansion can subtly (default max in microtype is 2%) change the width of a font (through stretching) in order to achieve better typesetting results.

Use Case

Font expansion can improve improve text regularity and greatly reduce the need for hyphenation.

Activity

  1. added
    feature request
    text
    on Aug 6, 2024
  2. eclecticfluff commented on Aug 7, 2024

    @eclecticfluff

    Note that microtype does font expansion by directly modifying glyphs. While this does work and provides a reasonable fallback, using the width axis in variable fonts that have it would be ideal.

  3. Enivex commented on Aug 7, 2024

    @Enivex
    CollaboratorAuthor

    Note that microtype does font expansion by directly modifying glyphs. While this does work and provides a reasonable fallback, using the width axis in variable fonts that have it would be ideal.

    Yes, that would be a better option for variable fonts. However, I do not think all of them have a width axis.

    (Also typst does not yet support variable fonts.)

  4. corneliusroemer commented on May 5, 2025

    @corneliusroemer

    The microtype user manual is a good resource for inspiration.

  5. Krasjet commented on Oct 10, 2025

    @Krasjet
    Contributor

    I'll add some more resources in case someone wants to take on the glyph expansion part:

    1. The extension to the Knuth-Plass algorithm used by pdftex is explained in this thesis. (the implementation in pdftex is a literal program as well)
    2. There was a demo made by @ammonj for justification using variable font glyph expansion: https://ammonj.github.io/better-justification-demo/. It's not using Knuth-Plass, but the idea is there.
  6. omentic commented on Jun 5, 2026

    @omentic
    Contributor

    Support for variable fonts has just been merged (#8425) 🎉

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

    feature requesttext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions