Diffstat (limited to 'tests/test.rs')
| -rw-r--r-- | tests/test.rs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/test.rs b/tests/test.rs index 6e5a55b..817f939 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1,13 +1,15 @@ use std::sync::LazyLock; +use std::time::Instant; -use dsb::{Fonts, cell::Style}; +use dsb::Fonts; +use dsb::cell::Style; use swash::FontRef; fn main() { - let ppem = 15.0; + let ppem = 40.0; let lh = 200.0; // let (fw, fh) = dsb::dims(&FONT, ppem); - let (w, h) = (1920, 1080); + let (w, h) = (2160, 1440); dbg!(w, h); let (c, r) = dsb::fit(&FONT, ppem, lh, (w, h)); @@ -19,27 +21,33 @@ fn main() { .take((c * r) as _) .map(|x: char| dsb::Cell { style: Style { - bg: [0; 3], - color: [255; 3], + bg: [255; 3], + color: [132, 148, 164], flags: 0, }, letter: Some(x), }) .collect::<Vec<_>>(); + let now = Instant::now(); let x = unsafe { dsb::render( &cells, (c, r), ppem, - [1; 3], + [255; 3], Fonts::new(*FONT, *FONT, *FONT, *FONT), lh, ) }; - x.save("yes.png"); + println!("{:?}", now.elapsed()); + x.as_ref().show(); assert!(x.height() < h as u32); dbg!(x.width(), x.height()); } pub static FONT: LazyLock<FontRef<'static>> = LazyLock::new(|| { - FontRef::from_index(&include_bytes!("/home/os/CascadiaCodeNF.ttf")[..], 0).unwrap() + FontRef::from_index( + &include_bytes!("/home/os/CascadiaCodeNF.ttf")[..], + 0, + ) + .unwrap() }); |