use image::{DynamicImage, Rgba};
use once_cell::sync::Lazy;
use rusttype::Font;
use crate::utils;
static FONT: Lazy<Font<'static>> = Lazy::new(|| {
let font_data = include_bytes!("fonts/PublicSans-Bold.ttf");
let font = Font::try_from_bytes(font_data).expect("font should load");
font
});
const COLOR: Rgba<u8> = Rgba([255, 255, 255, 255]);
pub fn draw(img: &mut DynamicImage, body: &str) {
let side_length = img.height();
let max_h = side_length / 28;
let (scale, _, _) = utils::text_size(&FONT, u32::MAX, max_h, body);
let text_y = side_length * 19 / 24;
utils::draw_wrapped_text(img, COLOR, scale, &FONT, text_y, body);
}