GNU Radio's TEST Package
gl_font.h
Go to the documentation of this file.
1 /*
2  * gl_font.h
3  *
4  * Basic OpenGL font rendering
5  *
6  * Copyright (C) 2013-2014 Sylvain Munaut
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __FOSPHOR_GL_FONT_H__
23 #define __FOSPHOR_GL_FONT_H__
24 
25 /*! \defgroup gl/font
26  * @{
27  */
28 
29 /*! \file gl_font.h
30  * \brief Basic OpenGL font rendering
31  */
32 
33 #ifdef _MSC_VER
34 # define ATTR_FORMAT(a,b,c)
35 #else
36 # define ATTR_FORMAT(a,b,c) __attribute__((format(a,b,c)))
37 #endif
38 
39 
40 struct gl_font;
41 
42 #define GLF_FLG_LCD (1 << 0)
43 
45 {
51 };
52 
53 struct gl_font *glf_alloc(int height, int flags);
54 void glf_free(struct gl_font *glf);
55 
56 int glf_load_face_file(struct gl_font *glf, const char *filename);
57 int glf_load_face_mem(struct gl_font *glf, const void *data, size_t len);
58 
59 float glf_width_str(const struct gl_font *glf, const char *str);
60 
61 void glf_draw_str(const struct gl_font *glf,
62  float x, enum glf_align x_align,
63  float y, enum glf_align y_align,
64  const char *str);
65 
66 void glf_printf(const struct gl_font *glf,
67  float x, enum glf_align x_align,
68  float y, enum glf_align y_align,
69  const char *fmt, ...) ATTR_FORMAT(printf, 6, 7);
70 
71 void glf_begin(const struct gl_font *glf, float fg_color[3]);
72 void glf_end(void);
73 
74 
75 /*! @} */
76 
77 #endif /* __FOSPHOR_GL_FONT_H__ */
glf_free
void glf_free(struct gl_font *glf)
glf_alloc
struct gl_font * glf_alloc(int height, int flags)
GLF_BOTTOM
Definition: gl_font.h:49
glf_align
glf_align
Definition: gl_font.h:44
GLF_TOP
Definition: gl_font.h:48
GLF_CENTER
Definition: gl_font.h:50
ATTR_FORMAT
#define ATTR_FORMAT(a, b, c)
Definition: gl_font.h:36
glf_load_face_file
int glf_load_face_file(struct gl_font *glf, const char *filename)
glf_begin
void void glf_begin(const struct gl_font *glf, float fg_color[3])
glf_draw_str
void glf_draw_str(const struct gl_font *glf, float x, enum glf_align x_align, float y, enum glf_align y_align, const char *str)
glf_end
void glf_end(void)
glf_width_str
float glf_width_str(const struct gl_font *glf, const char *str)
GLF_RIGHT
Definition: gl_font.h:47
GLF_LEFT
Definition: gl_font.h:46
glf_load_face_mem
int glf_load_face_mem(struct gl_font *glf, const void *data, size_t len)
glf_printf
void glf_printf(const struct gl_font *glf, float x, enum glf_align x_align, float y, enum glf_align y_align, const char *fmt,...) ATTR_FORMAT(printf