1 | /* |
2 | * freeglut_glutfont_definitions_x11.c |
3 | * |
4 | * Bitmap and stroke fonts displaying. |
5 | * |
6 | * Copyright (c) 2003 Stephen J. Baker (whether he wants it or not). |
7 | * All Rights Reserved. |
8 | * Written by John F. Fay <fayjf@sourceforge.net>, who releases the |
9 | * copyright over to the "freeglut" project lead. |
10 | * Creation date: Mon July 21 2003 |
11 | * |
12 | * Permission is hereby granted, free of charge, to any person obtaining a |
13 | * copy of this software and associated documentation files (the "Software"), |
14 | * to deal in the Software without restriction, including without limitation |
15 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
16 | * and/or sell copies of the Software, and to permit persons to whom the |
17 | * Software is furnished to do so, subject to the following conditions: |
18 | * |
19 | * The above copyright notice and this permission notice shall be included |
20 | * in all copies or substantial portions of the Software. |
21 | * |
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
23 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
25 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
26 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
27 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
28 | */ |
29 | |
30 | /* |
31 | * This file is necessary for the *nix version of "freeglut" because the |
32 | * original GLUT defined its font variables in rather an unusual way. |
33 | * Publicly, in "glut.h", they were defined as "void *". Privately, |
34 | * in one of the source code files, they were defined as pointers to a |
35 | * structure. Most compilers and linkers are satisfied with the "void *" |
36 | * and don't go any farther, but some of them balked. In particular, |
37 | * when compiling with "freeglut" and then trying to run using the GLUT |
38 | * ".so" library, some of them would give an error. So we are having to |
39 | * create this file to define the variables as pointers to an unusual |
40 | * structure to match GLUT. |
41 | */ |
42 | |
43 | /* |
44 | * freeglut_internal.h uses some GL types, but including the GL header portably |
45 | * is a bit tricky, so we include freeglut_std.h here, which contains the |
46 | * necessary machinery. But this poses another problem, caused by the ugly |
47 | * original definition of the font constants in "classic" GLUT: They are defined |
48 | * as void* externally, so we move them temporarily out of the way by AN EXTREME |
49 | * CPP HACK. |
50 | */ |
51 | |
52 | #define glutStrokeRoman glutStrokeRomanIGNOREME |
53 | #define glutStrokeMonoRoman glutStrokeMonoRomanIGNOREME |
54 | #define glutBitmap9By15 glutBitmap9By15IGNOREME |
55 | #define glutBitmap8By13 glutBitmap8By13IGNOREME |
56 | #define glutBitmapTimesRoman10 glutBitmapTimesRoman10IGNOREME |
57 | #define glutBitmapTimesRoman24 glutBitmapTimesRoman24IGNOREME |
58 | #define glutBitmapHelvetica10 glutBitmapHelvetica10IGNOREME |
59 | #define glutBitmapHelvetica12 glutBitmapHelvetica12IGNOREME |
60 | #define glutBitmapHelvetica18 glutBitmapHelvetica18IGNOREME |
61 | |
62 | #include <GL/freeglut_std.h> |
63 | |
64 | #undef glutStrokeRoman |
65 | #undef glutStrokeMonoRoman |
66 | #undef glutBitmap9By15 |
67 | #undef glutBitmap8By13 |
68 | #undef glutBitmapTimesRoman10 |
69 | #undef glutBitmapTimesRoman24 |
70 | #undef glutBitmapHelvetica10 |
71 | #undef glutBitmapHelvetica12 |
72 | #undef glutBitmapHelvetica18 |
73 | |
74 | #include "../fg_internal.h" |
75 | |
76 | struct freeglutStrokeFont |
77 | { |
78 | const char *name ; |
79 | int num_chars ; |
80 | void *ch ; |
81 | float top ; |
82 | float bottom ; |
83 | }; |
84 | |
85 | struct freeglutBitmapFont |
86 | { |
87 | const char *name ; |
88 | const int num_chars ; |
89 | const int first ; |
90 | const void *ch ; |
91 | }; |
92 | |
93 | |
94 | struct freeglutStrokeFont glutStrokeRoman ; |
95 | struct freeglutStrokeFont glutStrokeMonoRoman ; |
96 | |
97 | struct freeglutBitmapFont glutBitmap9By15 ; |
98 | struct freeglutBitmapFont glutBitmap8By13 ; |
99 | struct freeglutBitmapFont glutBitmapTimesRoman10 ; |
100 | struct freeglutBitmapFont glutBitmapTimesRoman24 ; |
101 | struct freeglutBitmapFont glutBitmapHelvetica10 ; |
102 | struct freeglutBitmapFont glutBitmapHelvetica12 ; |
103 | struct freeglutBitmapFont glutBitmapHelvetica18 ; |
104 | |
105 | |