summaryrefslogtreecommitdiff
path: root/text.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-07-16 15:49:34 -0400
committerpommicket <pommicket@gmail.com>2023-07-19 19:02:27 -0400
commitc4095353c5fc3712890cb5b7e78520105a23753a (patch)
treed1e0cb0308c8422c81493e055771cf3b68d46f58 /text.c
parent50692503702b9d419de99c97cff59a970627de01 (diff)
variable width fonts seem to be working
Diffstat (limited to 'text.c')
-rw-r--r--text.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/text.c b/text.c
index 093c5ec..c869a5e 100644
--- a/text.c
+++ b/text.c
@@ -195,12 +195,8 @@ Font *text_font_load(const char *ttf_filename, float font_size) {
font->char_height = font_size;
font->ttf_data = file_data;
if (text_load_char_page(font, 0)) { // load page with Latin text, etc.
- // calculate width of the character 'a'
- stbtt_aligned_quad q = {0};
- float x = 0, y = 0;
- stbtt_GetBakedQuad(font->char_pages[0], font->tex_widths[0], font->tex_heights[0],
- 'a', &x, &y, &q, 1);
- font->space_width = x;
+ // calculate width of the character ' '
+ font->space_width = font->char_pages[0][' '].xadvance;
}
} else {
text_set_err("Couldn't read font file.");