summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-01-06 13:06:17 +0100
committerLaurenz <laurmaedje@gmail.com>2020-01-06 13:06:17 +0100
commitc9fd39f37eb00e2b26b3e0cc5347dffb09e2a0ba (patch)
treec37d8bcd08e46137ec618cdac090934d4e58a0eb
parenta93b1ab003affb0d72e9da4007b04a2a6cfd4462 (diff)
Define base fallback list ♾
-rw-r--r--src/lib.rs2
-rw-r--r--src/style.rs26
2 files changed, 19 insertions, 9 deletions
diff --git a/src/lib.rs b/src/lib.rs
index ffd464fe..8968df02 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,7 +16,7 @@
//! format is _PDF_. Alternatively, the layout can be serialized to pass it to
//! a suitable renderer.
-// #![allow(unused)]
+#![allow(unused)]
pub extern crate toddle;
diff --git a/src/style.rs b/src/style.rs
index 68c76ad1..e552a63d 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -58,8 +58,15 @@ impl TextStyle {
}
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()),*])
.expect("TextStyle::default: unexpected error \
@@ -73,12 +80,15 @@ impl Default for TextStyle {
fn default() -> TextStyle {
TextStyle {
fallback: fallback! {
- ("sans-serif"),
- "serif" => ("source serif pro", "noto serif", "__base"),
- "sans-serif" => ("source sans pro", "noto sans", "__base"),
- "monospace" => ("source code pro", "noto sans mono", "__base"),
- "math" => ("latin modern math", "serif", "__base"),
- "__base" => ("latin modern math", "noto emoji"),
+ list: ("sans-serif"),
+ classes: {
+ "serif" => ("source serif pro", "noto serif"),
+ "sans-serif" => ("source sans pro", "noto sans"),
+ "monospace" => ("source code pro", "noto sans mono"),
+ "math" => ("latin modern math", "serif"),
+ },
+ base: ("source sans pro", "noto sans",
+ "noto emoji", "latin modern math"),
},
variant: FontVariant {
style: FontStyle::Normal,