2 libdrawtext - a simple library for fast text rendering in OpenGL
3 Copyright (C) 2011-2016 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/>.
18 #ifndef DRAWTEXT_IMPL_H_
19 #define DRAWTEXT_IMPL_H_
25 float x, y, width, height;
26 /* normalized coords [0, 1] */
27 float nx, ny, nwidth, nheight;
37 unsigned int xsz_shift;
38 unsigned char *pixels;
43 int cstart, cend; /* character range */
50 struct dtx_glyphmap *next;
54 /* freetype FT_Face */
57 /* list of glyphmaps */
58 struct dtx_glyphmap *gmaps;
60 /* last returned glyphmap (cache) */
61 struct dtx_glyphmap *last_gmap;
64 #ifdef DTX_DEFINE_COMMON
67 #define DTX_COMMON extern
70 DTX_COMMON struct dtx_font *dtx_font;
71 DTX_COMMON int dtx_font_sz;
72 DTX_COMMON int dtx_buf_mode; /* DTX_NBF is 0 */
73 DTX_COMMON float dtx_cur_color[4];
74 DTX_COMMON int dtx_cur_color_int[4];
75 DTX_COMMON float dtx_cur_offset[2];
77 #define fperror(str) \
78 fprintf(stderr, "%s: %s\n", (str), strerror(errno))
80 /* returns zero if it should NOT be printed and modifies xpos/ypos */
81 /* implemented in font.c */
82 struct dtx_glyphmap *dtx_proc_char(int code, float *xpos, float *ypos);
84 DTX_COMMON const char *(*dtx_drawchar)(const char*, float*, float*, int*);
85 DTX_COMMON void (*dtx_drawflush)(void);
87 int dtx_gl_setopt(enum dtx_option opt, int val);
88 int dtx_gl_getopt(enum dtx_option opt, int *ret);
89 int dtx_rast_setopt(enum dtx_option opt, int val);
90 int dtx_rast_getopt(enum dtx_option opt, int *ret);
92 #endif /* DRAWTEXT_IMPL_H_ */