mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Define base fallback list ♾
This commit is contained in:
parent
a93b1ab003
commit
c9fd39f37e
@ -16,7 +16,7 @@
|
|||||||
//! format is _PDF_. Alternatively, the layout can be serialized to pass it to
|
//! format is _PDF_. Alternatively, the layout can be serialized to pass it to
|
||||||
//! a suitable renderer.
|
//! a suitable renderer.
|
||||||
|
|
||||||
// #![allow(unused)]
|
#![allow(unused)]
|
||||||
|
|
||||||
pub extern crate toddle;
|
pub extern crate toddle;
|
||||||
|
|
||||||
|
26
src/style.rs
26
src/style.rs
@ -58,8 +58,15 @@ impl TextStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! fallback {
|
macro_rules! fallback {
|
||||||
(($($f:expr),*), $($c:expr => ($($cf:expr),*),)*) => ({
|
(
|
||||||
let mut fallback = FontFallbackTree::new(vec![$($f.to_string()),*]);
|
list: ($($f:expr),*),
|
||||||
|
classes: { $($c:expr => ($($cf:expr),*),)* },
|
||||||
|
base: ($($b:expr),*),
|
||||||
|
) => ({
|
||||||
|
let mut fallback = FontFallbackTree::new(
|
||||||
|
vec![$($f.to_string()),*],
|
||||||
|
vec![$($b.to_string()),*],
|
||||||
|
);
|
||||||
$(
|
$(
|
||||||
fallback.set_class_list($c.to_string(), vec![$($cf.to_string()),*])
|
fallback.set_class_list($c.to_string(), vec![$($cf.to_string()),*])
|
||||||
.expect("TextStyle::default: unexpected error \
|
.expect("TextStyle::default: unexpected error \
|
||||||
@ -73,12 +80,15 @@ impl Default for TextStyle {
|
|||||||
fn default() -> TextStyle {
|
fn default() -> TextStyle {
|
||||||
TextStyle {
|
TextStyle {
|
||||||
fallback: fallback! {
|
fallback: fallback! {
|
||||||
("sans-serif"),
|
list: ("sans-serif"),
|
||||||
"serif" => ("source serif pro", "noto serif", "__base"),
|
classes: {
|
||||||
"sans-serif" => ("source sans pro", "noto sans", "__base"),
|
"serif" => ("source serif pro", "noto serif"),
|
||||||
"monospace" => ("source code pro", "noto sans mono", "__base"),
|
"sans-serif" => ("source sans pro", "noto sans"),
|
||||||
"math" => ("latin modern math", "serif", "__base"),
|
"monospace" => ("source code pro", "noto sans mono"),
|
||||||
"__base" => ("latin modern math", "noto emoji"),
|
"math" => ("latin modern math", "serif"),
|
||||||
|
},
|
||||||
|
base: ("source sans pro", "noto sans",
|
||||||
|
"noto emoji", "latin modern math"),
|
||||||
},
|
},
|
||||||
variant: FontVariant {
|
variant: FontVariant {
|
||||||
style: FontStyle::Normal,
|
style: FontStyle::Normal,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user