diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-11-25 16:56:29 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-11-25 16:56:29 +0100 |
| commit | 11e44516fae84f907ea992311fcfdc3636101f14 (patch) | |
| tree | ff9b6a04c3accd5c0f75f1ceb60e578c389a2606 /src/library/spacing.rs | |
| parent | 761931405c68efe0a35d96524df797dda7155723 (diff) | |
Merge some modules 🥞
Diffstat (limited to 'src/library/spacing.rs')
| -rw-r--r-- | src/library/spacing.rs | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/library/spacing.rs b/src/library/spacing.rs deleted file mode 100644 index d6d0d7b0..00000000 --- a/src/library/spacing.rs +++ /dev/null @@ -1,39 +0,0 @@ -use crate::geom::Linear; -use crate::layout::{Softness, Spacing}; -use crate::prelude::*; - -/// `h`: Add horizontal spacing. -/// -/// # Positional arguments -/// - The spacing (length or relative to font size). -pub fn h(args: Args, ctx: &mut EvalContext) -> Value { - spacing(args, ctx, SpecAxis::Horizontal) -} - -/// `v`: Add vertical spacing. -/// -/// # Positional arguments -/// - The spacing (length or relative to font size). -pub fn v(args: Args, ctx: &mut EvalContext) -> Value { - spacing(args, ctx, SpecAxis::Vertical) -} - -/// Apply spacing along a specific axis. -fn spacing(mut args: Args, ctx: &mut EvalContext, axis: SpecAxis) -> Value { - let spacing = args.need::<_, Linear>(ctx, 0, "spacing"); - args.done(ctx); - - if let Some(linear) = spacing { - let amount = linear.resolve(ctx.state.font.font_size()); - let spacing = Spacing { amount, softness: Softness::Hard }; - if ctx.state.flow.main.axis() == axis { - ctx.end_par_group(); - ctx.push(spacing); - ctx.start_par_group(); - } else { - ctx.push(spacing); - } - } - - Value::None -} |
