75107909af1666e2cd65225988095e273aa66f6a
[xscreensaver] / hacks / glx / glxfonts.h
1 /* glxfonts, Copyright (c) 2001-2008 Jamie Zawinski <jwz@jwz.org>
2  * Loads X11 fonts for use with OpenGL.
3  *
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 
10  * implied warranty.
11  *
12  * Compute normal vectors for arbitrary triangles.
13  */
14
15 #ifndef __GLXFONTS_H__
16 #define __GLXFONTS_H__
17
18 /* Loads the font named by the X resource "res".
19    Returns an XFontStruct.
20    Also converts the font to a set of GL lists and returns the first list.
21 */
22 extern void load_font (Display *, char *resource,
23                        XFontStruct **font_ret,
24                        GLuint *dlist_ret);
25
26 /* Bounding box of the string in pixels.
27  */
28 extern int string_width (XFontStruct *f, const char *c, int *height_ret);
29
30 /* Draws the string on the window at the given pixel position.
31    Newlines and tab stops are honored.
32    Any text inside [] will be rendered as a subscript.
33    Assumes the font has been loaded as with load_font(). */
34 void print_gl_string (Display *dpy,
35                       XFontStruct *font,
36                       GLuint font_dlist,
37                       int window_width, int window_height,
38                       GLfloat x, GLfloat y,
39                       const char *string,
40                       Bool clear_background_p);
41
42 #endif /* __GLXFONTS_H__ */