Change default font to Libertinus Serif (#4969)
2
Cargo.lock
generated
@ -2709,7 +2709,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "typst-assets"
|
||||
version = "0.11.0"
|
||||
source = "git+https://github.com/typst/typst-assets?rev=4633b8c#4633b8c59e4d97b7cb07c054aabcd52c6d19d916"
|
||||
source = "git+https://github.com/typst/typst-assets?rev=4afd428#4afd428838a8fc99151c00dcf52f26b94c367aa0"
|
||||
|
||||
[[package]]
|
||||
name = "typst-cli"
|
||||
|
@ -27,7 +27,7 @@ typst-svg = { path = "crates/typst-svg", version = "0.11.0" }
|
||||
typst-syntax = { path = "crates/typst-syntax", version = "0.11.0" }
|
||||
typst-timing = { path = "crates/typst-timing", version = "0.11.0" }
|
||||
typst-utils = { path = "crates/typst-utils", version = "0.11.0" }
|
||||
typst-assets = { git = "https://github.com/typst/typst-assets", rev = "4633b8c" }
|
||||
typst-assets = { git = "https://github.com/typst/typst-assets", rev = "4afd428" }
|
||||
typst-dev-assets = { git = "https://github.com/typst/typst-dev-assets", rev = "e9f8127" }
|
||||
arrayvec = "0.7.4"
|
||||
az = "1.2"
|
||||
|
@ -43,7 +43,7 @@ downloads = ["dep:env_proxy", "dep:native-tls", "dep:ureq", "dep:openssl"]
|
||||
packages = ["downloads", "dep:dirs", "dep:flate2", "dep:tar"]
|
||||
|
||||
# Embeds some fonts into the binary:
|
||||
# - For text: Linux Libertine, New Computer Modern
|
||||
# - For text: Libertinus Serif, New Computer Modern
|
||||
# - For math: New Computer Modern Math
|
||||
# - For code: Deja Vu Sans Mono
|
||||
#
|
||||
|
@ -4,7 +4,7 @@
|
||||
//! # Embedded fonts
|
||||
//! The following fonts are available as embedded fonts via the `embed-fonts`
|
||||
//! feature flag:
|
||||
//! - For text: Linux Libertine, New Computer Modern
|
||||
//! - For text: Libertinus Serif, New Computer Modern
|
||||
//! - For math: New Computer Modern Math
|
||||
//! - For code: Deja Vu Sans Mono
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
//! - [fonts] contains a default implementation for searching local and system
|
||||
//! installed fonts. It is enabled by the `fonts` feature flag, additionally
|
||||
//! the `embed-fonts` feature can be used to embed the Typst default fonts.
|
||||
//! - For text: Linux Libertine, New Computer Modern
|
||||
//! - For text: Libertinus Serif, New Computer Modern
|
||||
//! - For math: New Computer Modern Math
|
||||
//! - For code: Deja Vu Sans Mono
|
||||
//! - [download] contains functionality for making simple web requests with
|
||||
|
@ -105,7 +105,7 @@ pub struct TextElem {
|
||||
/// automatically. The priority is: project fonts > server fonts.
|
||||
///
|
||||
/// - Locally, Typst uses your installed system fonts or embedded fonts in
|
||||
/// the CLI, which are `Linux Libertine`, `New Computer Modern`,
|
||||
/// the CLI, which are `Libertinus Serif`, `New Computer Modern`,
|
||||
/// `New Computer Modern Math`, and `DejaVu Sans Mono`. In addition, you
|
||||
/// can use the `--font-path` argument or `TYPST_FONT_PATHS` environment
|
||||
/// variable to add directories that should be scanned for fonts. The
|
||||
@ -128,21 +128,12 @@ pub struct TextElem {
|
||||
/// ```
|
||||
#[parse({
|
||||
let font_list: Option<Spanned<FontList>> = args.named("font")?;
|
||||
if let Some(font_list) = &font_list {
|
||||
let book = engine.world.book();
|
||||
for family in &font_list.v {
|
||||
if !book.contains_family(family.as_str()) {
|
||||
engine.sink.warn(warning!(
|
||||
font_list.span,
|
||||
"unknown font family: {}",
|
||||
family.as_str(),
|
||||
));
|
||||
}
|
||||
}
|
||||
if let Some(list) = &font_list {
|
||||
check_font_list(engine, list);
|
||||
}
|
||||
font_list.map(|font_list| font_list.v)
|
||||
})]
|
||||
#[default(FontList(vec![FontFamily::new("Linux Libertine")]))]
|
||||
#[default(FontList(vec![FontFamily::new("Libertinus Serif")]))]
|
||||
#[borrowed]
|
||||
#[ghost]
|
||||
pub font: FontList,
|
||||
@ -182,7 +173,7 @@ pub struct TextElem {
|
||||
/// change your mind about how to signify the emphasis.
|
||||
///
|
||||
/// ```example
|
||||
/// #text(font: "Linux Libertine", style: "italic")[Italic]
|
||||
/// #text(font: "Libertinus Serif", style: "italic")[Italic]
|
||||
/// #text(font: "DejaVu Sans", style: "oblique")[Oblique]
|
||||
/// ```
|
||||
#[ghost]
|
||||
@ -418,7 +409,7 @@ pub struct TextElem {
|
||||
///
|
||||
/// ```example
|
||||
/// #set text(
|
||||
/// font: "Linux Libertine",
|
||||
/// font: "Libertinus Serif",
|
||||
/// size: 20pt,
|
||||
/// )
|
||||
///
|
||||
@ -821,7 +812,7 @@ cast! {
|
||||
/// Resolve a prioritized iterator over the font families.
|
||||
pub(crate) fn families(styles: StyleChain) -> impl Iterator<Item = &str> + Clone {
|
||||
const FALLBACKS: &[&str] = &[
|
||||
"linux libertine",
|
||||
"libertinus serif",
|
||||
"twitter color emoji",
|
||||
"noto color emoji",
|
||||
"apple color emoji",
|
||||
@ -1328,3 +1319,34 @@ pub(crate) fn isolate(text: Content, styles: StyleChain, out: &mut Vec<Content>)
|
||||
out.push(text);
|
||||
out.push(TextElem::packed("\u{202C}"));
|
||||
}
|
||||
|
||||
/// Checks for font families that are not available.
|
||||
fn check_font_list(engine: &mut Engine, list: &Spanned<FontList>) {
|
||||
let book = engine.world.book();
|
||||
for family in &list.v {
|
||||
let found = book.contains_family(family.as_str());
|
||||
if family.as_str() == "linux libertine" {
|
||||
let mut warning = warning!(
|
||||
list.span,
|
||||
"Typst's default font has changed from Linux Libertine to its successor Libertinus Serif";
|
||||
hint: "please set the font to `\"Libertinus Serif\"` instead"
|
||||
);
|
||||
|
||||
if found {
|
||||
warning.hint(
|
||||
"Linux Libertine is available on your system - \
|
||||
you can ignore this warning if you are sure you want to use it",
|
||||
);
|
||||
warning.hint("this warning will be removed in Typst 0.13");
|
||||
}
|
||||
|
||||
engine.sink.warn(warning);
|
||||
} else if !found {
|
||||
engine.sink.warn(warning!(
|
||||
list.span,
|
||||
"unknown font family: {}",
|
||||
family.as_str(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ function. The following example illustrates how it works:
|
||||
>>> abstract: [],
|
||||
>>> doc,
|
||||
>>> ) = {
|
||||
>>> set text(font: "Linux Libertine", 11pt)
|
||||
>>> set text(font: "Libertinus Serif", 11pt)
|
||||
>>> set par(justify: true)
|
||||
>>> set page(
|
||||
>>> "us-letter",
|
||||
|
@ -61,7 +61,7 @@ Let's start by writing some set rules for the document.
|
||||
)
|
||||
#set par(justify: true)
|
||||
#set text(
|
||||
font: "Linux Libertine",
|
||||
font: "Libertinus Serif",
|
||||
size: 11pt,
|
||||
)
|
||||
|
||||
@ -69,7 +69,7 @@ Let's start by writing some set rules for the document.
|
||||
```
|
||||
|
||||
You are already familiar with most of what is going on here. We set the text
|
||||
size to `{11pt}` and the font to Linux Libertine. We also enable paragraph
|
||||
size to `{11pt}` and the font to Libertinus Serif. We also enable paragraph
|
||||
justification and set the page size to US letter.
|
||||
|
||||
The `header` argument is new: With it, we can provide content to fill the top
|
||||
@ -90,7 +90,7 @@ align it and increase its font weight by enclosing it in `[*stars*]`.
|
||||
|
||||
```example
|
||||
>>> #set page(width: 300pt, margin: 30pt)
|
||||
>>> #set text(font: "Linux Libertine", 11pt)
|
||||
>>> #set text(font: "Libertinus Serif", 11pt)
|
||||
#align(center, text(17pt)[
|
||||
*A fluid dynamic model
|
||||
for glacier flow*
|
||||
@ -104,7 +104,7 @@ supervisor, we'll add our own and their name.
|
||||
|
||||
```example
|
||||
>>> #set page(width: 300pt, margin: 30pt)
|
||||
>>> #set text(font: "Linux Libertine", 11pt)
|
||||
>>> #set text(font: "Libertinus Serif", 11pt)
|
||||
>>>
|
||||
>>> #align(center, text(17pt)[
|
||||
>>> *A fluid dynamic model
|
||||
@ -141,7 +141,7 @@ Now, let's add the abstract. Remember that the conference wants the abstract to
|
||||
be set ragged and centered.
|
||||
|
||||
```example:0,0,612,317.5
|
||||
>>> #set text(font: "Linux Libertine", 11pt)
|
||||
>>> #set text(font: "Libertinus Serif", 11pt)
|
||||
>>> #set par(justify: true)
|
||||
>>> #set page(
|
||||
>>> "us-letter",
|
||||
@ -200,7 +200,7 @@ keyword:
|
||||
|
||||
<<< ...
|
||||
|
||||
>>> #set text(font: "Linux Libertine", 11pt)
|
||||
>>> #set text(font: "Libertinus Serif", 11pt)
|
||||
>>> #set par(justify: true)
|
||||
#set page(
|
||||
>>> "us-letter",
|
||||
@ -266,7 +266,7 @@ content. In our case, it passes it on to the `columns` function.
|
||||
>>> for glacier flow
|
||||
>>> ]
|
||||
>>>
|
||||
>>> #set text(font: "Linux Libertine", 11pt)
|
||||
>>> #set text(font: "Libertinus Serif", 11pt)
|
||||
>>> #set par(justify: true)
|
||||
>>> #set page(
|
||||
>>> "us-letter",
|
||||
@ -325,7 +325,7 @@ a way to set any of that, we need to write our own heading show rule.
|
||||
>>> for glacier flow
|
||||
>>> ]
|
||||
>>>
|
||||
>>> #set text(font: "Linux Libertine", 11pt)
|
||||
>>> #set text(font: "Libertinus Serif", 11pt)
|
||||
>>> #set par(justify: true)
|
||||
>>> #set page(
|
||||
>>> "us-letter",
|
||||
@ -401,7 +401,7 @@ differentiate between section and subsection headings:
|
||||
>>> for glacier flow
|
||||
>>> ]
|
||||
>>>
|
||||
>>> #set text(font: "Linux Libertine", 11pt)
|
||||
>>> #set text(font: "Libertinus Serif", 11pt)
|
||||
>>> #set par(justify: true)
|
||||
>>> #set page(
|
||||
>>> "us-letter",
|
||||
|
@ -97,7 +97,7 @@ previous chapter.
|
||||
)
|
||||
set par(justify: true)
|
||||
set text(
|
||||
font: "Linux Libertine",
|
||||
font: "Libertinus Serif",
|
||||
size: 11pt,
|
||||
)
|
||||
|
||||
@ -270,7 +270,7 @@ want to import.
|
||||
>>> abstract: [],
|
||||
>>> doc,
|
||||
>>> ) = {
|
||||
>>> set text(font: "Linux Libertine", 11pt)
|
||||
>>> set text(font: "Libertinus Serif", 11pt)
|
||||
>>> set par(justify: true)
|
||||
>>> set page(
|
||||
>>> "us-letter",
|
||||
|
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 570 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 795 B After Width: | Height: | Size: 790 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 549 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 548 B After Width: | Height: | Size: 547 B |
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 911 B After Width: | Height: | Size: 908 B |
Before Width: | Height: | Size: 286 B After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 461 B After Width: | Height: | Size: 460 B |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 870 B After Width: | Height: | Size: 920 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 733 B After Width: | Height: | Size: 736 B |
Before Width: | Height: | Size: 299 B After Width: | Height: | Size: 302 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 587 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 570 B After Width: | Height: | Size: 565 B |
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 473 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 691 B After Width: | Height: | Size: 687 B |
Before Width: | Height: | Size: 973 B After Width: | Height: | Size: 979 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 967 B After Width: | Height: | Size: 960 B |
Before Width: | Height: | Size: 889 B After Width: | Height: | Size: 896 B |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 810 B After Width: | Height: | Size: 810 B |
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 411 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 565 B |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 838 B After Width: | Height: | Size: 842 B |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 747 B After Width: | Height: | Size: 744 B |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 380 B |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 271 B |
Before Width: | Height: | Size: 951 B After Width: | Height: | Size: 954 B |
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 613 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 836 B After Width: | Height: | Size: 830 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 649 B After Width: | Height: | Size: 650 B |
Before Width: | Height: | Size: 299 B After Width: | Height: | Size: 299 B |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 533 B |
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 551 B After Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 963 B After Width: | Height: | Size: 960 B |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 446 B After Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 525 B |