* The examples now use FONT_FILE if it was found by the configure step.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
diff --git a/demo/FTGLDemo.cpp b/demo/FTGLDemo.cpp
index 221a545..fc490cf 100644
--- a/demo/FTGLDemo.cpp
+++ b/demo/FTGLDemo.cpp
@@ -43,18 +43,13 @@
#include "tb.h"
-// YOU'LL PROBABLY WANT TO CHANGE THESE
-#ifdef __linux__
-# define FONT_FILE "/usr/share/fonts/truetype/arial.ttf"
-#endif
-#ifdef __APPLE_CC__
-# define FONT_FILE "/usr/X11R6/lib/X11/fonts/TTF/Vera.ttf"
-#endif
-#ifdef WIN32
-# define FONT_FILE "C:\\WINNT\\Fonts\\arial.ttf"
-#endif
-#ifndef FONT_FILE
-# define FONT_FILE 0
+#if !defined FONT_FILE
+# ifdef WIN32
+# define FONT_FILE "C:\\WINNT\\Fonts\\arial.ttf"
+# else
+ // Put your font file here if configure did not find it.
+# define FONT_FILE 0
+# endif
#endif
#define EDITING 1
diff --git a/demo/FTGLMFontDemo.cpp b/demo/FTGLMFontDemo.cpp
index 7142db9..efde368 100644
--- a/demo/FTGLMFontDemo.cpp
+++ b/demo/FTGLMFontDemo.cpp
@@ -42,22 +42,20 @@
#include "tb.h"
// YOU'LL PROBABLY WANT TO CHANGE THESE
-#ifdef __linux__
- char const *defaultFonts[] = { "/usr/share/fonts/truetype/arial.ttf" };
+#if defined FONT_FILE
+ char const *defaultFonts[] = { FONT_FILE };
const int NumDefaultFonts = 1;
-#endif
-#ifdef __APPLE_CC__
- //#define FONT_FILE "/Users/henry/Development/PROJECTS/FTGL/ftglcvs/FTGL/test/arial.ttf"
+#elif defined __APPLE_CC__
char const *defaultFonts[] = { "/System/Library/Fonts/Helvetica.dfont",
"/System/Library/Fonts/Geneva.dfont" };
const int NumDefaultFonts = 2;
-#endif
-#ifdef WIN32
+#elif defined WIN32
char const *defaultFonts[] = { "C:\\WINNT\\Fonts\\arial.ttf" };
const int NumDefaultFonts = 1;
-#endif
-#ifndef FONT_FILE
-# define FONT_FILE 0
+#else
+ // Put your font files here if configure did not find any.
+ char const *defaultFonts[] = { };
+ const int NumDefaultFonts = 0;
#endif
/* Set this to 1 to build a Mac os app (ignore the command line args). */
diff --git a/demo/c-demo.c b/demo/c-demo.c
index 2a0ae8b..7ab809a 100644
--- a/demo/c-demo.c
+++ b/demo/c-demo.c
@@ -169,11 +169,22 @@ static void ProcessKeys(unsigned char key, int x, int y)
*/
int main(int argc, char **argv)
{
+ char const *file = NULL;
+
+#ifdef FONT_FILE
+ file = FONT_FILE;
+#else
if(argc < 2)
{
fprintf(stderr, "Usage: %s <font_name.ttf>\n", argv[0]);
return EXIT_FAILURE;
}
+#endif
+
+ if(argc > 1)
+ {
+ file = argv[1];
+ }
/* Initialise GLUT stuff */
glutInit(&argc, argv);
@@ -194,13 +205,12 @@ int main(int argc, char **argv)
gluLookAt(0.0, 0.0, 640.0f / 2.0f, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
/* Initialise FTGL stuff */
- //font = ftglCreateExtrudeFont(argv[1]);
- font[0] = ftglCreateExtrudeFont(argv[1]);
- font[1] = ftglCreatePolygonFont(argv[1]);
- font[2] = ftglCreateCustomFont(argv[1], NULL, MakeHaloGlyph);
+ font[0] = ftglCreateExtrudeFont(file);
+ font[1] = ftglCreatePolygonFont(file);
+ font[2] = ftglCreateCustomFont(file, NULL, MakeHaloGlyph);
if(!font[0] || !font[1] || !font[2])
{
- fprintf(stderr, "%s: could not load font `%s'\n", argv[0], argv[1]);
+ fprintf(stderr, "%s: could not load font `%s'\n", argv[0], file);
return EXIT_FAILURE;
}
diff --git a/demo/simple.cpp b/demo/simple.cpp
index 68e79f7..299d4b0 100644
--- a/demo/simple.cpp
+++ b/demo/simple.cpp
@@ -161,11 +161,22 @@ static void ProcessKeys(unsigned char key, int x, int y)
//
int main(int argc, char **argv)
{
+ char const *file = NULL;
+
+#ifdef FONT_FILE
+ file = FONT_FILE;
+#else
if(argc < 2)
{
fprintf(stderr, "Usage: %s <font_name.ttf>\n", argv[0]);
return EXIT_FAILURE;
}
+#endif
+
+ if(argc > 1)
+ {
+ file = argv[1];
+ }
// Initialise GLUT stuff
glutInit(&argc, argv);
@@ -186,13 +197,13 @@ int main(int argc, char **argv)
gluLookAt(0.0, 0.0, 640.0f / 2.0f, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
// Initialise FTGL stuff
- font[0] = new FTExtrudeFont(argv[1]);
- font[1] = new FTPolygonFont(argv[1]);
- font[2] = new FTHaloFont(argv[1]);
+ font[0] = new FTExtrudeFont(file);
+ font[1] = new FTPolygonFont(file);
+ font[2] = new FTHaloFont(file);
if(font[0]->Error() || font[1]->Error() || font[2]->Error())
{
- fprintf(stderr, "%s: could not load font `%s'\n", argv[0], argv[1]);
+ fprintf(stderr, "%s: could not load font `%s'\n", argv[0], file);
return EXIT_FAILURE;
}