diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
| commit | 264a7dedd42e27cd9e604037640cf0594b2ec46b (patch) | |
| tree | d26feea399d54bb86bd44878f40293983bf5251d /src/library/spacing.rs | |
| parent | ca3df70e2a5069832d7d2135967674c34a155442 (diff) | |
Scheduled maintenance 🔨
- New naming scheme
- TextNode instead of NodeText
- CallExpr instead of ExprCall
- ...
- Less glob imports
- Removes Value::Args variant
- Removes prelude
- Renames Layouted to Fragment
- Moves font into env
- Moves shaping into layout
- Moves frame into separate module
Diffstat (limited to 'src/library/spacing.rs')
| -rw-r--r-- | src/library/spacing.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/library/spacing.rs b/src/library/spacing.rs index 4965a220..fee802fa 100644 --- a/src/library/spacing.rs +++ b/src/library/spacing.rs @@ -1,4 +1,5 @@ use super::*; +use crate::layout::SpacingNode; /// `h`: Add horizontal spacing. /// @@ -7,7 +8,7 @@ use super::*; /// /// # Return value /// A template that adds horizontal spacing. -pub fn h(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { +pub fn h(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { spacing(ctx, args, SpecAxis::Horizontal) } @@ -18,17 +19,17 @@ pub fn h(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { /// /// # Return value /// A template that adds vertical spacing. -pub fn v(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { +pub fn v(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { spacing(ctx, args, SpecAxis::Vertical) } /// Apply spacing along a specific axis. -fn spacing(ctx: &mut EvalContext, args: &mut ValueArgs, axis: SpecAxis) -> Value { +fn spacing(ctx: &mut EvalContext, args: &mut FuncArgs, axis: SpecAxis) -> Value { let spacing: Option<Linear> = args.require(ctx, "spacing"); Value::template("spacing", move |ctx| { if let Some(linear) = spacing { let amount = linear.resolve(ctx.state.font.font_size()); - let spacing = NodeSpacing { amount, softness: 0 }; + let spacing = SpacingNode { amount, softness: 0 }; if axis == ctx.state.dirs.main.axis() { ctx.push_into_stack(spacing); } else { |
