aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-24 21:03:16 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-24 21:03:16 +0100
commit6b7fbf4fe476d908fd44ca9421363e053324ba69 (patch)
treeacd1acf75e5fd037044cde07a45919a20c7543e5 /tests
parent242e4d0ea14a713e38b99e4206bb0f05c05f92df (diff)
Fix glyphs overlapping, but adds unnecessary padding
Diffstat (limited to 'tests')
-rw-r--r--tests/main.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/main.c b/tests/main.c
index b341bb3..0d4f096 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -56,8 +56,8 @@ static void draw(mgl_window *window, void *userdata) {
u->fps_counter = 0;
fprintf(stderr, "fps: %d\n", u->fps);
}
- char str[255];
- snprintf(str, sizeof(str), "hello|fps\nåäö: %d", u->fps);
+ char str[512];
+ snprintf(str, sizeof(str), ",.-_/1234567890½!\"#¤%%&/()=?¡@£$€¥{[]}\\'abcdefghijklmnopqrstuvwxyzáàäåãâíìîïúùũüûéèẽëêóòõôöABCDEFGHIJKLMNOPQRSTUVWXYZÁÀÄÅÃÂÍÌÎÏÚÙŨÜÛÉÈẼËÊÓÒÕÔÖ └> pacman -Q quickmedia-git");
mgl_text text;
mgl_text_init(&text, u->font, str, strlen(str));
@@ -120,7 +120,7 @@ static void draw(mgl_window *window, void *userdata) {
mgl_rectangle rect = {
.position = { window->cursor_position.x, window->cursor_position.y },
- .size = { u->cjk_font->texture.width, u->cjk_font->texture.height },
+ .size = { u->font->texture.width, u->font->texture.height },
.color = { 255, 255, 255, 255 },
};
mgl_rectangle_draw(context, &rect);
@@ -132,25 +132,25 @@ static void draw(mgl_window *window, void *userdata) {
.color = {255, 0, 0, 100}
},
(mgl_vertex){
- .position = {u->cjk_font->texture.width, 0.0f},
- .texcoords = {u->cjk_font->texture.width, 0.0f},
+ .position = {u->font->texture.width, 0.0f},
+ .texcoords = {u->font->texture.width, 0.0f},
.color = {0, 255, 0, 100},
},
(mgl_vertex){
- .position = {u->cjk_font->texture.width, u->cjk_font->texture.height},
- .texcoords = {u->cjk_font->texture.width, u->cjk_font->texture.height},
+ .position = {u->font->texture.width, u->font->texture.height},
+ .texcoords = {u->font->texture.width, u->font->texture.height},
.color = {0, 0, 255, 100},
},
(mgl_vertex){
- .position = {0.0f, u->cjk_font->texture.height},
- .texcoords = {0.0f, u->cjk_font->texture.height},
+ .position = {0.0f, u->font->texture.height},
+ .texcoords = {0.0f, u->font->texture.height},
.color = {255, 0, 255, 100}
}
};
mgl_vertex_buffer_update(u->vertex_buffer1, vertices1, 4, MGL_PRIMITIVE_QUADS, MGL_USAGE_STREAM);
mgl_vertex_buffer_set_position(u->vertex_buffer1, (mgl_vec2f){ window->cursor_position.x, window->cursor_position.y });
- mgl_vertex_buffer_draw(context, u->vertex_buffer1, &u->cjk_font->texture);
+ mgl_vertex_buffer_draw(context, u->vertex_buffer1, &u->font->texture);
}
static void test_hash_map_get_insert(mgl_font_char_map *char_map, uint32_t unicode, bool exists) {
@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
if(mgl_texture_load_from_file(&texture, "tests/X11.jpg", &(mgl_texture_load_options){ false, false }) != 0)
return 1;
- if(mgl_mapped_file_load("/usr/share/fonts/noto/NotoSans-Regular.ttf", &font_file, &(mgl_memory_mapped_file_load_options){ .readable = true, .writable = false }) != 0)
+ if(mgl_mapped_file_load("/usr/share/fonts/TTF/Hack-Regular.ttf", &font_file, &(mgl_memory_mapped_file_load_options){ .readable = true, .writable = false }) != 0)
return 1;
if(mgl_mapped_file_load("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc", &cjk_font_file, &(mgl_memory_mapped_file_load_options){ .readable = true, .writable = false }) != 0)