From 5fa96e59fa378af36e90cdd8ee741d164304e3b8 Mon Sep 17 00:00:00 2001 From: Riley Beckett Date: Tue, 14 Oct 2025 15:48:32 -0400 Subject: read stdin input --- font.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'font.c') diff --git a/font.c b/font.c index ef95d79..533788c 100644 --- a/font.c +++ b/font.c @@ -1,5 +1,6 @@ #include #include "font.h" +#include "array.h" char* get_font(const char* font_name) { FcPattern* pattern = FcNameParse((const FcChar8*)font_name); @@ -76,6 +77,8 @@ void atlas_init(client_state* state) { metric->advance_y = (float)state->ft_face->glyph->advance.y / 64; metric->bitmap_width = state->ft_face->glyph->bitmap.width; metric->bitmap_height = state->ft_face->glyph->bitmap.rows; + metric->bearing_x = state->ft_face->glyph->bitmap_left; + metric->bearing_y = state->ft_face->glyph->bitmap_top; } } @@ -133,3 +136,9 @@ int atlas_get_strwidth(client_state* state, const char* str) { } return (int)ceil(width); } + +void atlas_calc_item_widths(client_state* state) { + array_for_all(item_t, item, state->items) { + item->pixel_len = atlas_get_strwidth(state, item->text); + } +} -- cgit v1.2.3