Load emoji font dynamically when initializing

This commit is contained in:
Elena Torro 2025-04-25 13:40:17 +02:00
parent 56ecacee21
commit 2306df5fb7
6 changed files with 80 additions and 48 deletions

View file

@ -6,14 +6,24 @@ use crate::STATE;
use crate::shapes::FontFamily;
#[no_mangle]
pub extern "C" fn store_font(a: u32, b: u32, c: u32, d: u32, weight: u32, style: u8) {
pub extern "C" fn store_font(
a: u32,
b: u32,
c: u32,
d: u32,
weight: u32,
style: u8,
is_emoji: bool,
) {
with_state!(state, {
let id = uuid_from_u32_quartet(a, b, c, d);
let font_bytes = mem::bytes();
let family = FontFamily::new(id, weight, style.into());
let res = state
.render_state()
.fonts_mut()
.add(family, &font_bytes, is_emoji);
let res = state.render_state().fonts_mut().add(family, &font_bytes);
match res {
Err(msg) => {
eprintln!("{}", msg);