diff options
| author | Riley Beckett <rbeckettvt@gmail.com> | 2025-10-14 15:48:32 -0400 |
|---|---|---|
| committer | Riley Beckett <rbeckettvt@gmail.com> | 2025-10-14 15:48:32 -0400 |
| commit | 5fa96e59fa378af36e90cdd8ee741d164304e3b8 (patch) | |
| tree | 233787686f276f4ca77dc98d61d6efbd6435efb1 /font.c | |
| parent | 26a95fface3c47a870d88cc1abd174c708af0ffe (diff) | |
read stdin input
Diffstat (limited to 'font.c')
| -rw-r--r-- | font.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1,5 +1,6 @@ #include <fontconfig/fontconfig.h> #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); + } +} |
