minor fixes

This commit is contained in:
Dennis Eichhorn 2024-12-11 23:58:25 +01:00
parent fe054ebb13
commit d5e8a0c936
2 changed files with 9 additions and 4 deletions

View File

@ -237,7 +237,7 @@ int32 font_to_data(
memcpy(pos, font->glyphs, font->glyph_count * sizeof(Glyph));
pos += font->glyph_count * sizeof(Glyph);
int32 size = (int32) (pos - data);
int32 size = font_data_size(font);
SWAP_ENDIAN_LITTLE_SIMD(
(int32 *) file.content,
@ -246,7 +246,12 @@ int32 font_to_data(
steps
);
return font_data_size(font);
return size;
}
f32 font_line_height(Font* font, f32 size)
{
return font->line_height * size / font->size;
}
#endif

View File

@ -510,7 +510,7 @@ f32 vertex_text_create(
f32 offset_x = x;
for (int32 i = 0; i < length; ++i) {
int32 character = is_ascii ? text[i] : utf8_get_char_at(text, i);
if (character == '\n') {
if (character == '\n' && i != 0) {
y -= font->line_height * scale;
offset_x = x;
@ -654,7 +654,7 @@ f32 ui_text_create(
for (int32 i = 0; i < length; ++i) {
int32 character = is_ascii ? text->value_str[i] : utf8_get_char_at(text->value_str, i);
if (character == '\n') {
if (character == '\n' && i != 0) {
offset_y += theme->font.line_height * scale;
offset_x = (f32) x->value_int;