-
Notifications
You must be signed in to change notification settings - Fork 163
Open
Description
Simple example script behaves unexpectedly.
I ask imageproc for text_size
and then render a few characters.
pub fn txt_img() -> image::DynamicImage {
use imageproc::drawing::draw_text_mut;
let deja_vu_sans = include_bytes!(r"..\..\system\registration\assets\DejaVuSans.ttf");
let deja_vu_sans = ab_glyph::FontArc::try_from_slice(deja_vu_sans).unwrap();
let font_size = 128.0;
let word = "FMCPE";
let (w, h) = imageproc::drawing::text_size(font_size, &deja_vu_sans, word);
let mut image = image::DynamicImage::new_rgba8(w, h);
draw_text_mut(&mut image, image::Rgba([ 255u8, 255u8, 255u8, 255u8 ]), 0, 0, font_size, &deja_vu_sans, word);
image
}
fn main() {
let img = txt_img();
img.save("test.png").unwrap();
}
The bottom of the letters in "test.png" are cut off.
I have tried a number of random windows fonts and had the same issue with all of them.
Unsure what the root cause of the issue is, whether it is the vertical padding built into the font or some other kind of logic bug.
Metadata
Metadata
Assignees
Labels
No labels