1 /* texfonts, Copyright (c) 2005-2014 Jamie Zawinski <jwz@jwz.org>
2 * Loads X11 fonts into textures for use with OpenGL.
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation. No representations are made about the suitability of this
9 * software for any purpose. It is provided "as is" without express or
13 #ifndef __TEXTURE_FONT_H__
14 #define __TEXTURE_FONT_H__
16 typedef struct texture_font_data texture_font_data;
18 /* Loads the font named by the X resource "res" and returns
19 a texture-font object.
21 extern texture_font_data *load_texture_font (Display *, char *res);
23 /* Bounding box of the multi-line string, in pixels.
25 extern int texture_string_width (texture_font_data *, const char *,
28 /* Draws the string in the scene at the origin.
29 Newlines and tab stops are honored.
30 Any numbers inside [] will be rendered as a subscript.
31 Assumes the font has been loaded as with load_texture_font().
33 extern void print_texture_string (texture_font_data *, const char *);
35 /* Draws the string on the window at the given pixel position.
36 Newlines and tab stops are honored.
37 Any numbers inside [] will be rendered as a subscript.
38 Assumes the font has been loaded as with load_texture_font().
40 Position is 0 for center, 1 for top left, 2 for bottom left.
42 void print_texture_label (Display *, texture_font_data *,
43 int window_width, int window_height,
44 int position, const char *string);
46 /* Releases the texture font.
48 extern void free_texture_font (texture_font_data *);
50 #endif /* __TEXTURE_FONT_H__ */