istereo2

view libs/drawtext/drawtext_impl.h @ 21:8f41da60b9f5

revert accidentally commited ui change
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 02 Oct 2015 04:55:54 +0300
parents a3c4fcc9f8f3
children
line source
1 /*
2 libdrawtext - a simple library for fast text rendering in OpenGL
3 Copyright (C) 2011-2015 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;
53 int num_gmaps;
55 /* last returned glyphmap (cache) */
56 struct dtx_glyphmap *last_gmap;
57 };
60 extern struct dtx_font *dtx_font;
61 extern int dtx_font_sz;
64 #define fperror(str) \
65 fprintf(stderr, "%s: %s: %s\n", __func__, (str), strerror(errno))
67 int dtx_gl_init(void);
69 /* returns zero if it should NOT be printed and modifies xpos/ypos */
70 /* implemented in font.c */
71 struct dtx_glyphmap *dtx_proc_char(int code, float *xpos, float *ypos);
73 #endif /* TEXT_IMPL_H_ */