libdrawtext

annotate src/drawtext_impl.h @ 0:bfe431dd1d80

initial commit
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 15 Sep 2011 10:47:38 +0300
parents
children 095ff7ca4e74
rev   line source
nuclear@0 1 #ifndef TEXT_IMPL_H_
nuclear@0 2 #define TEXT_IMPL_H_
nuclear@0 3
nuclear@0 4 struct glyph {
nuclear@0 5 int code;
nuclear@0 6 float x, y, width, height;
nuclear@0 7 /* normalized coords [0, 1] */
nuclear@0 8 float nx, ny, nwidth, nheight;
nuclear@0 9 float orig_x, orig_y;
nuclear@0 10 float advance;
nuclear@0 11 struct glyph *next;
nuclear@0 12 };
nuclear@0 13
nuclear@0 14 struct dtx_glyphmap {
nuclear@0 15 int ptsize;
nuclear@0 16
nuclear@0 17 int xsz, ysz;
nuclear@0 18 unsigned char *pixels;
nuclear@0 19 unsigned int tex;
nuclear@0 20
nuclear@0 21 int cstart, cend; /* character range */
nuclear@0 22 int crange;
nuclear@0 23
nuclear@0 24 float line_advance;
nuclear@0 25
nuclear@0 26 struct glyph *glyphs;
nuclear@0 27 struct dtx_glyphmap *next;
nuclear@0 28 };
nuclear@0 29
nuclear@0 30 struct dtx_font {
nuclear@0 31 /* freetype FT_Face */
nuclear@0 32 void *face;
nuclear@0 33
nuclear@0 34 /* list of glyphmaps */
nuclear@0 35 struct dtx_glyphmap *gmaps;
nuclear@0 36
nuclear@0 37 /* last returned glyphmap (cache) */
nuclear@0 38 struct dtx_glyphmap *last_gmap;
nuclear@0 39 };
nuclear@0 40
nuclear@0 41
nuclear@0 42 #define fperror(str) \
nuclear@0 43 fprintf(stderr, "%s: %s: %s\n", __func__, (str), strerror(errno))
nuclear@0 44
nuclear@0 45 #endif /* TEXT_IMPL_H_ */