3dphotoshoot

annotate libs/drawtext/drawtext_impl.h @ 17:aef7f51f6397

resource loading works
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 10 Jun 2015 06:56:27 +0300
parents
children
rev   line source
nuclear@10 1 /*
nuclear@10 2 libdrawtext - a simple library for fast text rendering in OpenGL
nuclear@10 3 Copyright (C) 2011-2012 John Tsiombikas <nuclear@member.fsf.org>
nuclear@10 4
nuclear@10 5 This program is free software: you can redistribute it and/or modify
nuclear@10 6 it under the terms of the GNU Lesser General Public License as published by
nuclear@10 7 the Free Software Foundation, either version 3 of the License, or
nuclear@10 8 (at your option) any later version.
nuclear@10 9
nuclear@10 10 This program is distributed in the hope that it will be useful,
nuclear@10 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
nuclear@10 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
nuclear@10 13 GNU Lesser General Public License for more details.
nuclear@10 14
nuclear@10 15 You should have received a copy of the GNU Lesser General Public License
nuclear@10 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
nuclear@10 17 */
nuclear@10 18 #ifndef TEXT_IMPL_H_
nuclear@10 19 #define TEXT_IMPL_H_
nuclear@10 20
nuclear@10 21 struct glyph {
nuclear@10 22 int code;
nuclear@10 23 float x, y, width, height;
nuclear@10 24 /* normalized coords [0, 1] */
nuclear@10 25 float nx, ny, nwidth, nheight;
nuclear@10 26 float orig_x, orig_y;
nuclear@10 27 float advance;
nuclear@10 28 struct glyph *next;
nuclear@10 29 };
nuclear@10 30
nuclear@10 31 struct dtx_glyphmap {
nuclear@10 32 int ptsize;
nuclear@10 33
nuclear@10 34 int xsz, ysz;
nuclear@10 35 unsigned char *pixels;
nuclear@10 36 unsigned int tex;
nuclear@10 37
nuclear@10 38 int cstart, cend; /* character range */
nuclear@10 39 int crange;
nuclear@10 40
nuclear@10 41 float line_advance;
nuclear@10 42
nuclear@10 43 struct glyph *glyphs;
nuclear@10 44 struct dtx_glyphmap *next;
nuclear@10 45 };
nuclear@10 46
nuclear@10 47 struct dtx_font {
nuclear@10 48 /* freetype FT_Face */
nuclear@10 49 void *face;
nuclear@10 50
nuclear@10 51 /* list of glyphmaps */
nuclear@10 52 struct dtx_glyphmap *gmaps;
nuclear@10 53
nuclear@10 54 /* last returned glyphmap (cache) */
nuclear@10 55 struct dtx_glyphmap *last_gmap;
nuclear@10 56 };
nuclear@10 57
nuclear@10 58
nuclear@10 59 struct dtx_font *dtx_font;
nuclear@10 60 int dtx_font_sz;
nuclear@10 61
nuclear@10 62
nuclear@10 63 #define fperror(str) \
nuclear@10 64 fprintf(stderr, "%s: %s: %s\n", __FUNCTION__, (str), strerror(errno))
nuclear@10 65
nuclear@10 66 int dtx_gl_init(void);
nuclear@10 67
nuclear@10 68 /* returns zero if it should NOT be printed and modifies xpos/ypos */
nuclear@10 69 /* implemented in font.c */
nuclear@10 70 struct dtx_glyphmap *dtx_proc_char(int code, float *xpos, float *ypos);
nuclear@10 71
nuclear@10 72 #endif /* TEXT_IMPL_H_ */