libdrawtext

diff src/drawtext_impl.h @ 52:34130f58141a

initial commit
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 15 Sep 2011 10:47:38 +0300
parents
children 095ff7ca4e74
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/drawtext_impl.h	Thu Sep 15 10:47:38 2011 +0300
     1.3 @@ -0,0 +1,45 @@
     1.4 +#ifndef TEXT_IMPL_H_
     1.5 +#define TEXT_IMPL_H_
     1.6 +
     1.7 +struct glyph {
     1.8 +	int code;
     1.9 +	float x, y, width, height;
    1.10 +	/* normalized coords [0, 1] */
    1.11 +	float nx, ny, nwidth, nheight;
    1.12 +	float orig_x, orig_y;
    1.13 +	float advance;
    1.14 +	struct glyph *next;
    1.15 +};
    1.16 +
    1.17 +struct dtx_glyphmap {
    1.18 +	int ptsize;
    1.19 +
    1.20 +	int xsz, ysz;
    1.21 +	unsigned char *pixels;
    1.22 +	unsigned int tex;
    1.23 +
    1.24 +	int cstart, cend;	/* character range */
    1.25 +	int crange;
    1.26 +
    1.27 +	float line_advance;
    1.28 +
    1.29 +	struct glyph *glyphs;
    1.30 +	struct dtx_glyphmap *next;
    1.31 +};
    1.32 +
    1.33 +struct dtx_font {
    1.34 +	/* freetype FT_Face */
    1.35 +	void *face;
    1.36 +
    1.37 +	/* list of glyphmaps */
    1.38 +	struct dtx_glyphmap *gmaps;
    1.39 +
    1.40 +	/* last returned glyphmap (cache) */
    1.41 +	struct dtx_glyphmap *last_gmap;
    1.42 +};
    1.43 +
    1.44 +
    1.45 +#define fperror(str) \
    1.46 +	fprintf(stderr, "%s: %s: %s\n", __func__, (str), strerror(errno))
    1.47 +
    1.48 +#endif	/* TEXT_IMPL_H_ */