diff options
Diffstat (limited to 'src/library/font.rs')
| -rw-r--r-- | src/library/font.rs | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/library/font.rs b/src/library/font.rs index ba778693..9f7902f6 100644 --- a/src/library/font.rs +++ b/src/library/font.rs @@ -13,17 +13,17 @@ function! { } parse(header, body, ctx, f) { - let list = header.args.pos.get_all::<StringLike>(&mut f.errors) + let list = header.args.pos.get_all::<StringLike>(&mut f.problems) .map(|s| s.0.to_lowercase()) .collect(); let tuples: Vec<_> = header.args.key - .get_all::<String, Tuple>(&mut f.errors) + .get_all::<String, Tuple>(&mut f.problems) .collect(); let classes = tuples.into_iter() .map(|(class, mut tuple)| { - let fallback = tuple.get_all::<StringLike>(&mut f.errors) + let fallback = tuple.get_all::<StringLike>(&mut f.problems) .map(|s| s.0.to_lowercase()) .collect(); (class.to_lowercase(), fallback) @@ -37,7 +37,7 @@ function! { } } - layout(self, ctx, errors) { + layout(self, ctx, f) { styled(&self.body, ctx, Some(()), |s, _| { if !self.list.is_empty() { @@ -64,12 +64,12 @@ function! { parse(header, body, ctx, f) { FontStyleFunc { body: body!(opt: body, ctx, f), - style: header.args.pos.get::<FontStyle>(&mut f.errors) - .or_missing(&mut f.errors, header.name.span, "style"), + style: header.args.pos.get::<FontStyle>(&mut f.problems) + .or_missing(&mut f.problems, header.name.span, "style"), } } - layout(self, ctx, errors) { + layout(self, ctx, f) { styled(&self.body, ctx, self.style, |t, s| t.variant.style = s) } } @@ -84,22 +84,24 @@ function! { parse(header, body, ctx, f) { let body = body!(opt: body, ctx, f); - let weight = header.args.pos.get::<Spanned<(FontWeight, bool)>>(&mut f.errors) + let weight = header.args.pos.get::<Spanned<(FontWeight, bool)>>(&mut f.problems) .map(|Spanned { v: (weight, is_clamped), span }| { if is_clamped { - f.errors.push(err!(@Warning: span; - "weight should be between \ - 100 and 900, clamped to {}", weight.0)); + warning!( + @f, span, + "weight should be between 100 and 900, clamped to {}", + weight.0, + ); } weight }) - .or_missing(&mut f.errors, header.name.span, "weight"); + .or_missing(&mut f.problems, header.name.span, "weight"); FontWeightFunc { body, weight } } - layout(self, ctx, errors) { + layout(self, ctx, f) { styled(&self.body, ctx, self.weight, |t, w| t.variant.weight = w) } } @@ -115,12 +117,12 @@ function! { parse(header, body, ctx, f) { FontSizeFunc { body: body!(opt: body, ctx, f), - size: header.args.pos.get::<FSize>(&mut f.errors) - .or_missing(&mut f.errors, header.name.span, "size") + size: header.args.pos.get::<FSize>(&mut f.problems) + .or_missing(&mut f.problems, header.name.span, "size") } } - layout(self, ctx, errors) { + layout(self, ctx, f) { styled(&self.body, ctx, self.size, |t, s| { match s { FSize::Absolute(size) => { |
