Skip to content

Ensure normal weight math font face is consistent#1774

Merged
laurmaedje merged 3 commits intotypst:mainfrom
damaxwell:regular-book
Aug 2, 2023
Merged

Ensure normal weight math font face is consistent#1774
laurmaedje merged 3 commits intotypst:mainfrom
damaxwell:regular-book

Conversation

@damaxwell
Copy link
Contributor

@damaxwell damaxwell commented Jul 21, 2023

By default, Typst uses New Computer Modern Math at weight 450 for its math font. This results in NewComputerModernMath-Book as the default font. However, sometimes NewComputerModernMath-Regular (font weight 400) sneaks in.

$ log x (log x)/ y $
image

There are two fonts in the file:

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
ABCDEF+NewCMMath-Book                CID Type 0C (OT)  Identity-H       yes yes yes      3  0
ABCDEF+NewCMMath-Regular             CID Type 0C (OT)  Identity-H       yes yes yes      8  0

The log in the beginning is Book weight, and the log in the numerator is Regular weight (look at the thinnest spots on the os and the upper-right decorations on the gs). Both xs, on the other hand, are Book weight; this isn't a design choice that stuff in denominators should have lesser weight. Instead, there are currently multiple pathways for rendering text in math, and one of them is accidentally overriding the initial weight of 450.

This PR ensures that the meaning of "normal" font weight is tied to the font weight initially selected for the math font.

A number of reference test images needed to be updated. The only changes were that text in some circumstances became a little heavier.

After

image
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
ABCDEF+NewCMMath-Book                CID Type 0C (OT)  Identity-H       yes yes yes      3  0

@laurmaedje laurmaedje merged commit 20eb284 into typst:main Aug 2, 2023
@laurmaedje
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants