diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-10-10 22:35:24 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-10-10 22:35:24 +0200 |
| commit | 51bf3268ddf5db1bdd61e59bfb4a30f0463a4bfb (patch) | |
| tree | 9da15f6e77e714f5f983e60159cecd6d37cd7cf2 /src/library/font.rs | |
| parent | 92c01da36016e94ff20163806ddcbcf7e33d4031 (diff) | |
Refactor text state 🆎
Diffstat (limited to 'src/library/font.rs')
| -rw-r--r-- | src/library/font.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/library/font.rs b/src/library/font.rs index e6d9cd12..7460b21b 100644 --- a/src/library/font.rs +++ b/src/library/font.rs @@ -58,10 +58,10 @@ pub fn font(mut args: Args, ctx: &mut EvalContext) -> Value { if let Some(linear) = args.find::<Linear>() { if linear.is_absolute() { - ctx.state.text.font_size.base = linear.abs; - ctx.state.text.font_size.scale = Relative::ONE.into(); + ctx.state.font.size = linear.abs; + ctx.state.font.scale = Relative::ONE.into(); } else { - ctx.state.text.font_size.scale = linear; + ctx.state.font.scale = linear; } } @@ -69,20 +69,20 @@ pub fn font(mut args: Args, ctx: &mut EvalContext) -> Value { let list: Vec<_> = args.find_all::<StringLike>().map(|s| s.to_lowercase()).collect(); if !list.is_empty() { - Rc::make_mut(&mut ctx.state.text.fallback).list = list; + Rc::make_mut(&mut ctx.state.font.families).list = list; needs_flattening = true; } if let Some(style) = args.get::<_, FontStyle>(ctx, "style") { - ctx.state.text.variant.style = style; + ctx.state.font.variant.style = style; } if let Some(weight) = args.get::<_, FontWeight>(ctx, "weight") { - ctx.state.text.variant.weight = weight; + ctx.state.font.variant.weight = weight; } if let Some(stretch) = args.get::<_, FontStretch>(ctx, "stretch") { - ctx.state.text.variant.stretch = stretch; + ctx.state.font.variant.stretch = stretch; } for (class, dict) in args.find_all_str::<Spanned<ValueDict>>() { @@ -91,14 +91,14 @@ pub fn font(mut args: Args, ctx: &mut EvalContext) -> Value { .map(|s| s.to_lowercase()) .collect(); - Rc::make_mut(&mut ctx.state.text.fallback).update_class_list(class, fallback); + Rc::make_mut(&mut ctx.state.font.families).update_class_list(class, fallback); needs_flattening = true; } args.done(ctx); if needs_flattening { - Rc::make_mut(&mut ctx.state.text.fallback).flatten(); + Rc::make_mut(&mut ctx.state.font.families).flatten(); } if let Some(body) = body { |
