correct text bounds

font_atlas
Alessandro Mauri 2 weeks ago
parent 089140e1ed
commit c880c2b26e
  1. 8
      src/ugui_text.c3

@ -21,11 +21,11 @@ fn Rect! Ctx.get_text_bounds(&ctx, String text, bool* update_atlas)
if (n) { *update_atlas = true; } if (n) { *update_atlas = true; }
} else { } else {
text_bounds.h += line_height + line_gap; text_bounds.h += line_height + line_gap;
if (line_len > text_bounds.w) {
text_bounds.w = line_len;
}
line_len = 0; line_len = 0;
} }
if (line_len > text_bounds.w) {
text_bounds.w = line_len;
}
} }
return text_bounds; return text_bounds;
@ -78,7 +78,7 @@ fn void! Ctx.text_unbounded(&ctx, String label, String text)
.rect.color = uint_to_rgba(0x000000ff), .rect.color = uint_to_rgba(0x000000ff),
}; };
ctx.cmd_queue.enqueue(&bounds)!; ctx.cmd_queue.enqueue(&bounds)!;
Point orig = { Point orig = {
.x = c_elem.bounds.x, .x = c_elem.bounds.x,
.y = c_elem.bounds.y, .y = c_elem.bounds.y,

Loading…
Cancel
Save