libdrawtext

view src/drawtext_impl.h @ 57:7b01e04c9c8b

added copyright notices
author John Tsiombikas <nuclear@mutantstargoat.com>
date Fri, 16 Sep 2011 08:42:07 +0300
parents bfe431dd1d80
children 7e0c702f1223
line source
1 /*
2 libdrawtext - a simple library for fast text rendering in OpenGL
3 Copyright (C) 2011 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef TEXT_IMPL_H_
19 #define TEXT_IMPL_H_
21 struct glyph {
22 int code;
23 float x, y, width, height;
24 /* normalized coords [0, 1] */
25 float nx, ny, nwidth, nheight;
26 float orig_x, orig_y;
27 float advance;
28 struct glyph *next;
29 };
31 struct dtx_glyphmap {
32 int ptsize;
34 int xsz, ysz;
35 unsigned char *pixels;
36 unsigned int tex;
38 int cstart, cend; /* character range */
39 int crange;
41 float line_advance;
43 struct glyph *glyphs;
44 struct dtx_glyphmap *next;
45 };
47 struct dtx_font {
48 /* freetype FT_Face */
49 void *face;
51 /* list of glyphmaps */
52 struct dtx_glyphmap *gmaps;
54 /* last returned glyphmap (cache) */
55 struct dtx_glyphmap *last_gmap;
56 };
59 #define fperror(str) \
60 fprintf(stderr, "%s: %s: %s\n", __func__, (str), strerror(errno))
62 #endif /* TEXT_IMPL_H_ */