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