wasm, ui, dpi and text baseline

This commit is contained in:
Krzosa Karol
2025-01-22 13:11:04 +01:00
parent e54265fcac
commit 223038c9cd
7 changed files with 46 additions and 38 deletions

View File

@@ -14,23 +14,21 @@
fn void app_init(f32 dpr) {
ma_arena_t *perm = &tcx._perm;
unused(perm);
// mt_embed_file(font_data, "package/FiraCode-Regular.ttf");
mt_tweak_f32(font_size, 50, 4, 200);
// mt_tweak_f32(_font_size, 50, 50, 50);
mt_tweak_f32(_font_size, 50, 50, 50);
rn_init(perm, font_size * dpr);
rn_init(perm, font_size, dpr);
ui_demo_init(perm);
}
fn b32 app_update(app_frame_t *frame) {
// if (!f32_are_equal(font_size, _font_size)) {
// _font_size = font_size;
// rn_reload_font(font_data, font_size);
// }
// @todo
if (!f32_are_equal(font_size, _font_size)) {
_font_size = font_size;
rn_reload_font(font_size, frame->dpr);
}
ui_demo_update(frame);
v2f32_t size = rn_measure_string(rn_state.main_font, s8_lit("Memes and other things"));
debugf("font size = %f %f", size.x, size.y);
// v2f32_t size = rn_measure_string(rn_state.main_font, s8_lit("Memes and other things"));
// debugf("font size = %f %f", size.x, size.y);
return true;
}