TODO cleanup

This commit is contained in:
Alessandro Mauri 2026-03-20 18:30:46 +01:00
parent f533d1f17a
commit f68327b027

View File

@ -100,8 +100,6 @@ fn void? Font.load(&font, Allocator allocator, String name, ZString path, uint h
font.linegap = (float)lmetrics.lineGap; font.linegap = (float)lmetrics.lineGap;
//io::printfn("ascender:%d, descender:%d, linegap:%d", font.ascender, font.descender, font.linegap); //io::printfn("ascender:%d, descender:%d, linegap:%d", font.ascender, font.descender, font.linegap);
// TODO: allocate buffer based on FONT_CACHED and the size of a sample letter
// like the letter 'A'
ushort size = (ushort)font.size*(ushort)($$sqrt((float)FONT_CACHED)); ushort size = (ushort)font.size*(ushort)($$sqrt((float)FONT_CACHED));
font.atlas.new(font.id, ATLAS_GRAYSCALE, size, size)!; font.atlas.new(font.id, ATLAS_GRAYSCALE, size, size)!;
@ -205,9 +203,10 @@ fn void? Ctx.load_font(&ctx, Allocator allocator, String name, ZString path, uin
<* <*
@param [&in] ctx @param [&in] ctx
@param [in] label @param [in] label
@require ctx.font.id != 0 : "font not loaded"
*> *>
// TODO: check if the font is present in the context // TODO: check if the font is present in the context
fn Id Ctx.get_font_id(&ctx, String label) => (Id)label.hash(); fn Id Ctx.get_font_id(&ctx, String label) => (Id)ctx.font.id;
<* <*
@param [&in] ctx @param [&in] ctx
@ -215,7 +214,6 @@ fn Id Ctx.get_font_id(&ctx, String label) => (Id)label.hash();
*> *>
fn Atlas*? Ctx.get_font_atlas(&ctx, String name) fn Atlas*? Ctx.get_font_atlas(&ctx, String name)
{ {
// TODO: use the font name, for now there is only one font
if (name.hash() != ctx.font.id) { if (name.hash() != ctx.font.id) {
return WRONG_ID~; return WRONG_ID~;
} }