summaryrefslogtreecommitdiff
path: root/library/src/text/raw.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-08 13:02:41 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-08 14:35:33 +0100
commitd7a65fa26d131179d9d82226e5ee1b562084e48a (patch)
treec21ab20e9fb851e14e1ebea3e14fc351b1fdbcc9 /library/src/text/raw.rs
parente5eab73374880077971f3f22acbdd3d302877128 (diff)
Rework style chain access
Diffstat (limited to 'library/src/text/raw.rs')
-rw-r--r--library/src/text/raw.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs
index 4eefb0ea..8526a278 100644
--- a/library/src/text/raw.rs
+++ b/library/src/text/raw.rs
@@ -114,7 +114,7 @@ impl Prepare for RawNode {
mut this: Content,
styles: StyleChain,
) -> SourceResult<Content> {
- this.push_field("lang", styles.get(Self::LANG).clone());
+ this.push_field("lang", Self::lang_in(styles).clone());
Ok(this)
}
}
@@ -122,7 +122,7 @@ impl Prepare for RawNode {
impl Show for RawNode {
fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> SourceResult<Content> {
let text = self.text();
- let lang = styles.get(Self::LANG).as_ref().map(|s| s.to_lowercase());
+ let lang = Self::lang_in(styles).as_ref().map(|s| s.to_lowercase());
let foreground = THEME
.settings
.foreground
@@ -181,11 +181,11 @@ impl Show for RawNode {
impl Finalize for RawNode {
fn finalize(&self, realized: Content) -> Content {
let mut map = StyleMap::new();
- map.set(TextNode::OVERHANG, false);
- map.set(TextNode::HYPHENATE, Hyphenate(Smart::Custom(false)));
- map.set(TextNode::SIZE, TextSize(Em::new(0.8).into()));
- map.set(TextNode::FONT, FontList(vec![FontFamily::new("DejaVu Sans Mono")]));
- map.set(SmartQuoteNode::ENABLED, false);
+ map.set(TextNode::set_overhang(false));
+ map.set(TextNode::set_hyphenate(Hyphenate(Smart::Custom(false))));
+ map.set(TextNode::set_size(TextSize(Em::new(0.8).into())));
+ map.set(TextNode::set_font(FontList(vec![FontFamily::new("DejaVu Sans Mono")])));
+ map.set(SmartQuoteNode::set_enabled(false));
realized.styled_with_map(map)
}
}
@@ -221,7 +221,7 @@ fn styled(piece: &str, foreground: Paint, style: synt::Style) -> Content {
let paint = to_typst(style.foreground).into();
if paint != foreground {
- body = body.styled(TextNode::FILL, paint);
+ body = body.styled(TextNode::set_fill(paint));
}
if style.font_style.contains(synt::FontStyle::BOLD) {