Skip to content

Change default font to Libertinus Serif - #4969

Merged
laurmaedje merged 3 commits into
mainfrom
libertinus-serif
Sep 30, 2024
Merged

laurmaedje merged 3 commits into
mainfrom
libertinus-serif

Conversation

@laurmaedje

@laurmaedje laurmaedje commented Sep 16, 2024 •

Copy link
Copy Markdown
Member

Closes #1257.

While we could have kept Linux Libertine for the test suite, I prefer testing with the real default font. This updates ~800 reference images. This doesn't make me particularly happy, but the repository bloat shouldn't be much more than 2MB due to the work done so far in keeping reference images small.

Unresolved questions:

  • Should we bundle the semibold variants? Linux Libertine didn't have those. I've opted for yes now.
  • Do we need some kind of migration period?
    • Should we keep bundling the old font for one more release? I personally feel like this is not really necessary. Layout shifts should be non-existent or very minor since the fonts are mostly metrically compatible. I suspect that most users won't notice a thing.
    • Adding a hint when the font was explicitly set to "Linux Libertine"

Todo:

@alerque

alerque commented Sep 16, 2024

Copy link
Copy Markdown
Contributor

I assume you're working with Libertinus 7.040? There are a few minor updates (e.g. I_J kerning for Dutch locales) since the last tagged release. If desired I could look into cutting a new release with that in place before this work merges just so the loop is as closed as it can be.

@laurmaedje

Copy link
Copy Markdown
Member Author

That would be great! I indeed used the latest released the version.

@alerque

alerque commented Sep 17, 2024

Copy link
Copy Markdown
Contributor

After a few years without a release there were some problems with the font tooling (changes in python-fonttools meant it wouldn't build against current versions) but I think I've got that worked out so I could cut a release at any time. That being said there are a couple PRs that look valuable and may be ready to go it, but it is 3 am and I can't do more tonight. What's your timeline on this? Should I cut a release so you can start testing it or do I have a couple days to review PRs and make a release with any of the pending contributions that seem ready for production?

@laurmaedje

laurmaedje commented Sep 17, 2024 •

Copy link
Copy Markdown
Member Author

A few days are no problem. I've got some other stuff to do as well. I just wanted to get the ball rolling here and potentially get some feedback on the unresolved questions. Thanks for being so considerate of our timeline!

@ssotoen

ssotoen commented Sep 17, 2024

Copy link
Copy Markdown
Contributor

Should we bundle the semibold variants? Linux Libertine didn't have those. I've opted for yes now.

Bundle all available weights.

Do we need some kind of migration period?

I would keep Libertine for 0.12 and emit a compiler hint when the font is explicitly set. Then drop it for the next release.

@laurmaedje

Copy link
Copy Markdown
Member Author

I would keep Libertine for 0.12 and emit a compiler hint when the font is explicitly set.

Some people might have Linux Libertine installed and if they want to use it, who am I to stop them. So a blanket warning seems problematic. That's why I think adding a hint to the "unknown font family" warning specifically for Linux Libertine is better, but it means removing the font now.

@alerque

alerque commented Sep 17, 2024

Copy link
Copy Markdown
Contributor

emit a compiler hint when the font is explicitly set.

Wouldn't warning when it is not explicitly set make more sense?

In any case some transition time where both fonts are available so that people have a low friction way not to reflow anything is likely to be appreciated by a few folks. Even if Libertinus Serif is better in every way (of course I think it is) there are some differences in metrics to some glyphs that will cause many documents to reflow. For most people it probably won't matter at all, but there is bound to be a few documents where people are committed to exact metrics that do matter.

@laurmaedje

Copy link
Copy Markdown
Member Author

Wouldn't warning when it is not explicitly set make more sense?

Then, it would warn on almost every document, with no good way to get rid of the warning. I think that's rather something that should just be stated prominently in the changelog.

My proposal was to warn only when it's explicitly set and not available on the system. The most likely cause of that situation is someone hardcoding the default font for some reason (maybe they needed to go back to the default within an equation) and they should likely update it to the new default.

We can also keep bundling it for another version, but then I see no opportunity for a warning that doesn't trigger on pretty much everything.

@laurmaedje

laurmaedje commented Sep 17, 2024 •

Copy link
Copy Markdown
Member Author

For most people it probably won't matter at all, but there is bound to be a few documents where people are committed to exact metrics that do matter.

We've tuned hyphenation costs (to get rid of over-eager hyphenation), so 0.12 will probably reflow lots of documents anyway... And there are a few other breaking changes.

@Andrew15-5

Copy link
Copy Markdown
Contributor
  • Should we bundle the semibold variants? Linux Libertine didn't have those. I've opted for yes now.

Are you concerned about additional binary size, or just a plain question? I personally only use normal/bold/italic/bold+italic 99.9% of the time. I almost never had to tweak the weight parameter. But I think it's a safe bet that some people would do that, and therefore it's better to pack all variants in, than have an incomplete bundle which can lead to issues like "add x variant to the default font".

  • Do we need some kind of migration period?

To be on the safe side, yeah. One (minor) version is probably enough?

  • Should we keep bundling the old font for one more release? I personally feel like this is not really necessary. Layout shifts should be non-existent or very minor since the fonts are mostly metrically compatible. I suspect that most users won't notice a thing.

I think this is the same question as the above, so yes, I think we should. Hard breaking changes (with no deprecations) is probably never nice to see as a user.

  • Adding a hint when the font was explicitly set to "Linux Libertine", but that font isn't available could be a good idea.

If it was explicitly set and is present on the system (if you can differentiate between system and built-in fonts), then I guess it's fine. If however the font is not present on the system, then a warning/hint should definitely be added ("the default font has changed, the old one is deprecated, and it's not found on the system, consider installing or changing to the new font", something like that). Either way, a warning in the changelog (or somewhere else as well?) should be enough for those who care (which font is the default one).

@Enivex

Enivex commented Sep 18, 2024

Copy link
Copy Markdown
Collaborator

I really don't see the point of a migration period. There are already breaking changes in 0.12, and the font is almost identical to the one we're already using. I'd wager the vast majority won't even notice that the font changed.

@ssotoen

ssotoen commented Sep 20, 2024

Copy link
Copy Markdown
Contributor

Should we also bundle Libertinus Math?

@Enivex

Enivex commented Sep 20, 2024

Copy link
Copy Markdown
Collaborator

Should we also bundle Libertinus Math?

I don't think there's any plan to change the default math font.

@ssotoen

ssotoen commented Sep 20, 2024

Copy link
Copy Markdown
Contributor

I know there’s no plan, that’s why I’m suggesting it. Linux Libertine doesn’t have a math font so it’s understandable that the team went for New CM; but Libertinus does, and this would be a good opportunity to make the default look more consistent.

@Enivex

Enivex commented Sep 20, 2024 •

Copy link
Copy Markdown
Collaborator

I know there’s no plan, that’s why I’m suggesting it. Linux Libertine doesn’t have a math font so it’s understandable that the team went for New CM; but Libertinus does, and this would be a good opportunity to make the default look more consistent.

I don't think the math font works well enough in typst to be a default. See for instance #2860

It also has way fewer (less than half) symbols than the most complete fonts (e.g. ncm and stix two)

https://tug.org/tug2023/files/sa-13-vieth-otmath/vieth-otmath-preprint.pdf

This could of course change in the future.

@alerque

alerque commented Sep 20, 2024

Copy link
Copy Markdown
Contributor

@laurmaedje Is the prior perceived need for a TTF variant resolved? (I have handled all outstanding PRs for Libertinus and am tinkering with release tooling). I can build TTFs with a one line config change, but I can't vouch for how good they would be. We've been releasing OTF only for a while and we know those builds are pretty robust, but any TTF builds I put out wouldn't have had much exercise. They could be hinted with ttfautohint (or not at all) but there would not any manual hinting or tweaking. From my perspective that isn't any "value added" over OTF and just letting the device do the hinting. But if there are other reasons to consider we could check it out.

@alerque

alerque commented Sep 21, 2024 •

Copy link
Copy Markdown
Contributor

I just shipped Libertinus v7.050. It's already deployed to all Arch Linux users via otf-libertinus and Homebrew users via Homebrew Cask and I've submitted bumps for Fedora and CTAN. The latter haven't landed yet but CTAN at least usually does so within a few hours. I'm going to bed now but if the issue tracker hasn't exploded in the next day or so then the OTF release at least should be good to go.

@laurmaedje

Copy link
Copy Markdown
Member Author

Sounds great, thank you! There is no need for TTF anymore, the printer issues and suboptimal subsetting are fixed thanks to @LaurenzV.

@alerque

alerque commented Sep 21, 2024

Copy link
Copy Markdown
Contributor

c.f. typst/typst-assets#3

@sijow

sijow commented Sep 23, 2024

Copy link
Copy Markdown
Contributor

What about bundling Libertinus Sans? Currently the only option for a sans-serif default that should work everywhere is to use the mono font. Having another option would be nice for slide themes and many other documents (for example popular styles like KOMA-Script use sans serif for titles).

Maybe another sans serif font would be better though...

@Enivex

Enivex commented Sep 23, 2024

Copy link
Copy Markdown
Collaborator

A template opinionated enough to want a sans serif font will probably want a specific one, and not just the one type would hypothetically provide.

Starting to bundle a ton of fonts feels like a mistake.

@sijow

sijow commented Sep 24, 2024

Copy link
Copy Markdown
Contributor

Sure, but bundling one sans serif font could be a good middle-ground between "just one text font" and "a ton of fonts".

Mixing a serif and a sans-serif font is a common technique to make a design more dynamic. The contrast is often more important than the precise choice of font. Even opinionated templates could use a standard sans-serif as fallback that works everywhere.

For example, I'm working on some slide themes that use a two-font design. What should I use as fallback that looks OK if not great? Will it still make clear what part is in what font in case the user wants to change one font?

@laurmaedje

Copy link
Copy Markdown
Member Author

The point of the built-in fonts wasn't really to ship a sensible base collection of fonts. It was to ship exactly the fonts Typst uses by default for text, math, and code, such that the defaults work out of the box.

I agree that we have a problem with reproducibility and fonts (it's being discussed at various times in the #Fonts forge on discord), but I think the solution isn't to bundle more fonts, but rather to find a proper way to distribute a larger collection of fonts.

@Andrew15-5

Copy link
Copy Markdown
Contributor
#import "@font/fira-code-nerd-font"
#show raw: set text(font: "Fira Code Nerd Font")

@sijow

sijow commented Sep 24, 2024

Copy link
Copy Markdown
Contributor

@laurmaedje OK that makes sense.

@laurmaedje

Copy link
Copy Markdown
Member Author
warning: Typst's default font has changed from Linux Libertine to its successor Libertinus Serif
  ┌─ hi.typ:1:16
  │
1 │ #set text(font: "Linux Libertine")
  │                 ^^^^^^^^^^^^^^^^^
  │
  = hint: please set the font to `"Libertinus Serif"` instead
  = hint: Linux Libertine is available on your system - you can ignore this warning if you are sure you want to use it
  = hint: this warning will be removed in Typst 0.13

@laurmaedje
laurmaedje added this pull request to the merge queue Sep 30, 2024
Merged via the queue into main with commit 7ff83db Sep 30, 2024
@laurmaedje
laurmaedje deleted the libertinus-serif branch September 30, 2024 15:26
Dikluwe pushed a commit to Dikluwe/typst-crystalline that referenced this pull request Sep 12, 2026
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.

Replace "Linux Libertine" with the more up to date fork "Libertinus Serif"

6 participants