Format code

This commit is contained in:
Laurenz 2023-04-04 14:36:25 +02:00
parent 8271ba5a52
commit c2d88989a7
3 changed files with 53 additions and 31 deletions

View File

@ -277,7 +277,7 @@ fn convert_yaml(value: serde_yaml::Value) -> Value {
.map(|(key, value)| (convert_yaml_key(key), convert_yaml(value))) .map(|(key, value)| (convert_yaml_key(key), convert_yaml(value)))
.filter_map(|(key, value)| key.map(|key| (key, value))) .filter_map(|(key, value)| key.map(|key| (key, value)))
.collect(), .collect(),
) ),
} }
} }

View File

@ -363,7 +363,7 @@ impl NumberingKind {
let symbol = SYMBOLS[(n - 1) % SYMBOLS.len()]; let symbol = SYMBOLS[(n - 1) % SYMBOLS.len()];
let amount = ((n - 1) / SYMBOLS.len()) + 1; let amount = ((n - 1) / SYMBOLS.len()) + 1;
std::iter::repeat(symbol).take(amount).collect() std::iter::repeat(symbol).take(amount).collect()
}, }
Self::Hebrew => { Self::Hebrew => {
if n == 0 { if n == 0 {
return '-'.into(); return '-'.into();
@ -410,7 +410,7 @@ impl NumberingKind {
n -= value; n -= value;
continue; continue;
}, }
} }
break 'outer; break 'outer;
} }

View File

@ -193,12 +193,20 @@ fn render_svg_glyph(
// be on the safe size. We also compute the intersection // be on the safe size. We also compute the intersection
// with the canvas rectangle // with the canvas rectangle
let svg_ts = usvg::Transform::new( let svg_ts = usvg::Transform::new(
ts.sx.into(), ts.kx.into(), ts.sx.into(),
ts.ky.into(), ts.sy.into(), ts.kx.into(),
ts.tx.into(), ts.ty.into()); ts.ky.into(),
let bbox = bbox.transform(&svg_ts)? ts.sy.into(),
.to_screen_rect(); ts.tx.into(),
let bbox = usvg::ScreenRect::new(bbox.left()-5, bbox.y()-5, bbox.width()+10, bbox.height()+10)? ts.ty.into(),
);
let bbox = bbox.transform(&svg_ts)?.to_screen_rect();
let bbox = usvg::ScreenRect::new(
bbox.left() - 5,
bbox.y() - 5,
bbox.width() + 10,
bbox.height() + 10,
)?
.fit_to_rect(canvas_rect); .fit_to_rect(canvas_rect);
let mut pixmap = sk::Pixmap::new(bbox.width(), bbox.height())?; let mut pixmap = sk::Pixmap::new(bbox.width(), bbox.height())?;
@ -207,7 +215,14 @@ fn render_svg_glyph(
let ts = ts.post_translate(-bbox.left() as f32, -bbox.top() as f32); let ts = ts.post_translate(-bbox.left() as f32, -bbox.top() as f32);
resvg::render(&tree, FitTo::Original, ts, pixmap.as_mut())?; resvg::render(&tree, FitTo::Original, ts, pixmap.as_mut())?;
canvas.draw_pixmap(bbox.left(), bbox.top(), pixmap.as_ref(), &sk::PixmapPaint::default(), sk::Transform::identity(), mask) canvas.draw_pixmap(
bbox.left(),
bbox.top(),
pixmap.as_ref(),
&sk::PixmapPaint::default(),
sk::Transform::identity(),
mask,
)
} }
/// Render a bitmap glyph into the canvas. /// Render a bitmap glyph into the canvas.
@ -294,7 +309,14 @@ fn render_outline_glyph(
let left = bitmap.left; let left = bitmap.left;
let top = bitmap.top; let top = bitmap.top;
canvas.draw_pixmap(left-1, top-1, pixmap.as_ref(), &sk::PixmapPaint::default(), sk::Transform::identity(), mask) canvas.draw_pixmap(
left - 1,
top - 1,
pixmap.as_ref(),
&sk::PixmapPaint::default(),
sk::Transform::identity(),
mask,
)
} else { } else {
let cw = canvas.width() as i32; let cw = canvas.width() as i32;
let ch = canvas.height() as i32; let ch = canvas.height() as i32;