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
40struct gl_font;
41
42#define GLF_FLG_LCD (1 << 0)
43
52
53struct gl_font *glf_alloc(int height, int flags);
54void glf_free(struct gl_font *glf);
55
56int glf_load_face_file(struct gl_font *glf, const char *filename);
57int glf_load_face_mem(struct gl_font *glf, const void *data, size_t len);
58
59float glf_width_str(const struct gl_font *glf, const char *str);
60
61void 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
66void 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
71void glf_begin(const struct gl_font *glf, float fg_color[3]);
72void glf_end(void);
73
74
75/*! @} */
76
77#endif /* __FOSPHOR_GL_FONT_H__ */
void glf_end(void)
float glf_width_str(const struct gl_font *glf, const char *str)
int glf_load_face_file(struct gl_font *glf, const char *filename)
#define ATTR_FORMAT(a, b, c)
Definition gl_font.h:36
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
int glf_load_face_mem(struct gl_font *glf, const void *data, size_t len)
glf_align
Definition gl_font.h:45
void void glf_begin(const struct gl_font *glf, float fg_color[3])
struct gl_font * glf_alloc(int height, int flags)
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)
void glf_free(struct gl_font *glf)
@ GLF_RIGHT
Definition gl_font.h:47
@ GLF_CENTER
Definition gl_font.h:50
@ GLF_BOTTOM
Definition gl_font.h:49
@ GLF_TOP
Definition gl_font.h:48
@ GLF_LEFT
Definition gl_font.h:46