diff --git a/src/font.c3 b/src/font.c3 index afdf1f7..d5badb1 100644 --- a/src/font.c3 +++ b/src/font.c3 @@ -100,8 +100,6 @@ fn void? Font.load(&font, Allocator allocator, String name, ZString path, uint h font.linegap = (float)lmetrics.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)); 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] label +@require ctx.font.id != 0 : "font not loaded" *> // 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 @@ -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) { - // TODO: use the font name, for now there is only one font if (name.hash() != ctx.font.id) { return WRONG_ID~; }