Commit ca7ef109 authored by Alex Butler's avatar Alex Butler

cargo fmt

parent 3a88c927
Pipeline #7315 passed with stages
in 7 minutes and 1 second
......@@ -8,12 +8,10 @@ static DEJA_VU_MONO: Lazy<Font<'static>> = Lazy::new(|| {
static OPEN_SANS_ITALIC: Lazy<Font<'static>> = Lazy::new(|| {
Font::try_from_bytes(include_bytes!("../fonts/opensans/OpenSans-Italic.ttf") as &[u8]).unwrap()
});
static EXO2_OTF: Lazy<Font<'static>> = Lazy::new(|| {
Font::try_from_bytes(include_bytes!("../fonts/Exo2-Light.otf") as &[u8]).unwrap()
});
static EXO2_TTF: Lazy<Font<'static>> = Lazy::new(|| {
Font::try_from_bytes(include_bytes!("../fonts/Exo2-Light.ttf") as &[u8]).unwrap()
});
static EXO2_OTF: Lazy<Font<'static>> =
Lazy::new(|| Font::try_from_bytes(include_bytes!("../fonts/Exo2-Light.otf") as &[u8]).unwrap());
static EXO2_TTF: Lazy<Font<'static>> =
Lazy::new(|| Font::try_from_bytes(include_bytes!("../fonts/Exo2-Light.ttf") as &[u8]).unwrap());
fn draw_big_biohazard(c: &mut Criterion) {
let glyph = DEJA_VU_MONO
......
......@@ -9,9 +9,8 @@ static DEJA_VU_MONO: Lazy<Font<'static>> = Lazy::new(|| {
static OPEN_SANS_ITALIC: Lazy<Font<'static>> = Lazy::new(|| {
Font::try_from_bytes(include_bytes!("../fonts/opensans/OpenSans-Italic.ttf") as &[u8]).unwrap()
});
static EXO2_OFT: Lazy<Font<'static>> = Lazy::new(|| {
Font::try_from_bytes(include_bytes!("../fonts/Exo2-Light.otf") as &[u8]).unwrap()
});
static EXO2_OFT: Lazy<Font<'static>> =
Lazy::new(|| Font::try_from_bytes(include_bytes!("../fonts/Exo2-Light.otf") as &[u8]).unwrap());
fn draw_luma_alpha(glyph: ScaledGlyph<'_>) -> image::GrayAlphaImage {
let glyph = glyph.positioned(point(0.0, 0.0));
......@@ -117,7 +116,8 @@ fn render_to_reference_iota() {
}
}
/// Render a 300px 'ę' character that uses cubic beziers & require it to match the reference.
/// Render a 300px 'ę' character that uses cubic beziers & require it to match
/// the reference.
#[test]
fn render_to_reference_oft_tailed_e() {
let new_image = draw_luma_alpha(EXO2_OFT.glyph('ę').scaled(Scale::uniform(300.0)));
......
......@@ -222,15 +222,15 @@ impl<'font> Font<'font> {
/// Functionality to allow owned font data using ttf-parser.
///
/// This requires _unsafe_ usage to implement pinned self referencing, as ttf-parser does not
/// currently support owned data directly.
/// This requires _unsafe_ usage to implement pinned self referencing, as
/// ttf-parser does not currently support owned data directly.
mod owned_ttf_parser {
use super::{Font, Arc};
use super::{Arc, Font};
#[cfg(not(feature = "std"))]
use alloc::{boxed::Box, vec::Vec};
use core::marker::PhantomPinned;
use core::pin::Pin;
use core::slice;
#[cfg(not(feature = "std"))]
use alloc::{boxed::Box, vec::Vec};
pub type OwnedFont = Pin<Box<VecFont>>;
......@@ -276,8 +276,9 @@ mod owned_ttf_parser {
Some(Arc::new(b))
}
// Must not leak the fake 'static lifetime that we lied about earlier to the compiler.
// Since the lifetime 'a will not outlive our owned data it's safe to provide Font<'a>
// Must not leak the fake 'static lifetime that we lied about earlier to the
// compiler. Since the lifetime 'a will not outlive our owned data it's
// safe to provide Font<'a>
#[inline]
pub fn inner_ref<'a>(self: &'a Pin<Box<Self>>) -> &'a ttf_parser::Font<'a> {
match self.font.as_ref() {
......
......@@ -119,7 +119,7 @@ use crate::nostd_float::FloatExt;
macro_rules! relative_eq {
($a:expr, $b:expr) => {
($a - $b).abs() <= core::f32::EPSILON
}
};
}
#[derive(Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)]
......
......@@ -10,7 +10,12 @@ pub(crate) struct OutlineRasterizer {
}
impl OutlineRasterizer {
pub(crate) fn new(position: Point<f32>, scale: Vector<f32>, width: usize, height: usize) -> Self {
pub(crate) fn new(
position: Point<f32>,
scale: Vector<f32>,
width: usize,
height: usize,
) -> Self {
Self {
rasterizer: Rasterizer::new(width, height),
last: ab_point(0.0, 0.0),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment