summaryrefslogtreecommitdiff
path: root/src/library/text.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-01-07 10:46:55 +0100
committerLaurenz <laurmaedje@gmail.com>2022-01-07 10:46:55 +0100
commitaf014cfe5eea4233d8034c79c1a5f898c972396c (patch)
tree3345554e62d3f1696006fdb42296be5c744fbf77 /src/library/text.rs
parent5fd9c0b0d7b519802d56dd04cb61340c11014cb1 (diff)
Tidy up styling
Diffstat (limited to 'src/library/text.rs')
-rw-r--r--src/library/text.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/library/text.rs b/src/library/text.rs
index ab5c15c3..d5c87949 100644
--- a/src/library/text.rs
+++ b/src/library/text.rs
@@ -96,10 +96,10 @@ impl TextNode {
impl Construct for TextNode {
fn construct(_: &mut EvalContext, args: &mut Args) -> TypResult<Node> {
- // We don't need to do anything more here because the whole point of the
- // text constructor is to apply the styles and that happens
- // automatically during class construction.
- args.expect::<Node>("body")
+ // The text constructor is special: It doesn't create a text node.
+ // Instead, it leaves the passed argument structurally unchanged, but
+ // styles all text in it.
+ args.expect("body")
}
}
@@ -404,9 +404,7 @@ fn line_impl(args: &mut Args, kind: LineKind) -> TypResult<Value> {
let extent = args.named("extent")?.unwrap_or_default();
let body: Node = args.expect("body")?;
let deco = LineDecoration { kind, stroke, thickness, offset, extent };
- Ok(Value::Node(
- body.styled(StyleMap::with(TextNode::LINES, vec![deco])),
- ))
+ Ok(Value::Node(body.styled(TextNode::LINES, vec![deco])))
}
/// Defines a line that is positioned over, under or on top of text.