font.c - ploot - simple plotting tools
(HTM) git clone git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ploot
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
font.c (324B)
---
1 #include "font.h"
2 #include <string.h>
3
4 size_t
5 font_width(struct font *ft, int c)
6 {
7 size_t len;
8
9 len = strlen(ft->glyph[(c < 0 || c > 127) ? 0 : c]) / ft->height;
10 return len;
11 }
12
13 size_t
14 font_strlen(struct font *ft, char *s)
15 {
16 size_t len;
17
18 len = 0;
19 for (; *s != '\0'; s++)
20 len += font_width(ft, *s) + 1;
21 return len;
22 }