We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimal reproducible
use ab_glyph::FontRef; use imageproc::{ drawing::*, image::{Rgb, RgbImage}, rect::Rect, }; fn main() { let mut image = RgbImage::new(200, 200); let font = FontRef::try_from_slice(include_bytes!("../DejaVuSans.ttf")).unwrap(); let white = Rgb([255, 255, 255]); let scale = 64.; let text = "hello"; let (w, h) = text_size(scale, &font, text); draw_text_mut(&mut image, white, 0, 0, scale, &font, text); draw_hollow_rect_mut(&mut image, Rect::at(0, 0).of_size(w, h), white); image.save("./output.png").unwrap(); }
Rendered
This issue would be more obvious if we used other fonts or languages.
For example, NotoSansCJK-Regular.ttc
NotoSansCJK-Regular.ttc
The text was updated successfully, but these errors were encountered:
I think It's not the wrong Y position, it's the wrong text_size
text_size
Sorry, something went wrong.
Thats probably glyph "bearing" at the top. But text_size is broken for sure!
No branches or pull requests
Minimal reproducible
Rendered
This issue would be more obvious if we used other fonts or languages.
For example,
NotoSansCJK-Regular.ttc
The text was updated successfully, but these errors were encountered: