Skip to content

Roundhand calligraphic function in math #5853

@MDLC01

Description

@MDLC01

Description

Currently, the main way to insert calligraphic variants of Latin letters in math is through the math.cal function.

There are two styles of calligraphic letters: roundhand (also known as "script"; \mathscr in LaTeX), and chancery (\mathcal in LaTeX). Unicode provides a single codepoint for each calligraphic letter, and it is up to the font to decide which style to use.

Some fonts may provide the other style as a stylistic set, but this is not standardized, and therefore cannot be used by default by Typst. Notwithstanding, Unicode provides a way to specify a style to use through standardized variation sequences for capital non-bold letters.12 Sadly, this feature is not supported by many fonts. This issue mainly focuses on tracking font support for chancery and roundhand style calligraphic variation sequences. Discussions can happen in the Math forge on Discord, and specific proposals can be submitted as separate issues.

Use Case

Being able to easily typeset documents requiring the use of both calligraphic styles using Typst.

Font support

Font support can be tested using the following piece of code:

#set text(font: "..")
\u{2112} \u{2112}\u{FE00} \u{2112}\u{FE01}

The first L should be of either style (for math fonts, this is typically chancery); the second one should be chancery; the third one should be roundhand.

Below is a list of mathematical fonts with relevant information. As an indication, I believe it should be trivial for fonts that already have both glyph styles (typically, one of them accessible through a stylistic set as mentioned above). For other fonts, they have to create new glyphs, which requires some work.

Open questions

  • Should we add native support for this Unicode feature even though most math fonts don't support it for now? This could indicate to the maintainers of those fonts that there is demand for this feature. But at the same time, we would likely get complaints from users that the function does not work. The extreme lack of font support should be clearly documented.
    • The latest version of New Computer Modern Math, Typst's default math font, now supports chancery variation sequences, so at least the function will work as expected with the default settings.
  • Either way, as noted on Discord, support for variation sequences in math might be missing "because its multiple characters and so ends up going through the normal text layout."

Footnotes

  1. https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-22/#G82733

  2. https://www.unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt

  3. https://learn.microsoft.com/en-us/typography/font-list/cambria-math; https://learn.microsoft.com/en-us/typography/fonts/windows_11_font_list

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or requestmathRelated to math category, with its syntax, layout, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions