From a3a9d6c04bcca14241f2d0f2703ce3182a34042c Mon Sep 17 00:00:00 2001 From: cjp Date: Wed, 23 Jul 2003 22:09:24 +0000 Subject: [PATCH] This should put an end to the font binary compatibility issue. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@146 7f0cb862-5218-0410-a997-914c9d46530a --- .gitattributes | 1 + freeglut/freeglut/include/GL/glut.h | 18 ++--- freeglut/freeglut/src/Makefile.am | 1 + freeglut/freeglut/src/freeglut_font.c | 30 -------- .../src/freeglut_glutfont_definitions.c | 76 +++++++++++++++++++ 5 files changed, 87 insertions(+), 39 deletions(-) create mode 100644 freeglut/freeglut/src/freeglut_glutfont_definitions.c diff --git a/.gitattributes b/.gitattributes index 8497758..ebb1f80 100644 --- a/.gitattributes +++ b/.gitattributes @@ -88,6 +88,7 @@ freeglut/freeglut/src/freeglut_font.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/src/freeglut_font_data.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/src/freeglut_gamemode.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/src/freeglut_geometry.c svn_keywords=Author+Date+Id+Revision +freeglut/freeglut/src/freeglut_glutfont_definitions.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/src/freeglut_init.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/src/freeglut_internal.h svn_keywords=Author+Date+Id+Revision freeglut/freeglut/src/freeglut_joystick.c svn_keywords=Author+Date+Id+Revision diff --git a/freeglut/freeglut/include/GL/glut.h b/freeglut/freeglut/include/GL/glut.h index 06ceae8..de16dcf 100644 --- a/freeglut/freeglut/include/GL/glut.h +++ b/freeglut/freeglut/include/GL/glut.h @@ -164,15 +164,15 @@ /* * I don't really know if it's a good idea... But here it goes: */ - extern struct _GLUTstrokeFont glutStrokeRoman; - extern struct _GLUTstrokeFont glutStrokeMonoRoman; - extern struct _GLUTbitmapFont glutBitmap9By15; - extern struct _GLUTbitmapFont glutBitmap8By13; - extern struct _GLUTbitmapFont glutBitmapTimesRoman10; - extern struct _GLUTbitmapFont glutBitmapTimesRoman24; - extern struct _GLUTbitmapFont glutBitmapHelvetica10; - extern struct _GLUTbitmapFont glutBitmapHelvetica12; - extern struct _GLUTbitmapFont glutBitmapHelvetica18; + extern void* glutStrokeRoman; + extern void* glutStrokeMonoRoman; + extern void* glutBitmap9By15; + extern void* glutBitmap8By13; + extern void* glutBitmapTimesRoman10; + extern void* glutBitmapTimesRoman24; + extern void* glutBitmapHelvetica10; + extern void* glutBitmapHelvetica12; + extern void* glutBitmapHelvetica18; /* * Those pointers will be used by following definitions: diff --git a/freeglut/freeglut/src/Makefile.am b/freeglut/freeglut/src/Makefile.am index 6093d38..a933e64 100644 --- a/freeglut/freeglut/src/Makefile.am +++ b/freeglut/freeglut/src/Makefile.am @@ -14,6 +14,7 @@ libglut_la_SOURCES = freeglut_callbacks.c \ freeglut_display.c \ freeglut_ext.c \ freeglut_font.c \ + freeglut_glutfont_definitions.c \ freeglut_font_data.c \ freeglut_stroke_roman.c \ freeglut_stroke_mono_roman.c \ diff --git a/freeglut/freeglut/src/freeglut_font.c b/freeglut/freeglut/src/freeglut_font.c index 3fe559a..89dc41f 100644 --- a/freeglut/freeglut/src/freeglut_font.c +++ b/freeglut/freeglut/src/freeglut_font.c @@ -55,36 +55,6 @@ extern SFG_Font fgFontTimesRoman24; extern SFG_StrokeFont fgStrokeRoman; extern SFG_StrokeFont fgStrokeMonoRoman; -/* - * This is for GLUT binary compatibility, as suggested by Steve Baker - */ -#if TARGET_HOST_UNIX_X11 - struct _GLUTstrokeFont { - const char *name; - int num_chars; - void *ch; - float top; - float bottom; - }; - - struct _GLUTbitmapFont { - const char *name; - const int num_chars; - const int first; - const void *ch; - }; - - struct _GLUTstrokeFont glutStrokeRoman; - struct _GLUTstrokeFont glutStrokeMonoRoman; - struct _GLUTbitmapFont glutBitmap9By15; - struct _GLUTbitmapFont glutBitmap8By13; - struct _GLUTbitmapFont glutBitmapTimesRoman10; - struct _GLUTbitmapFont glutBitmapTimesRoman24; - struct _GLUTbitmapFont glutBitmapHelvetica10; - struct _GLUTbitmapFont glutBitmapHelvetica12; - struct _GLUTbitmapFont glutBitmapHelvetica18; -#endif - /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ diff --git a/freeglut/freeglut/src/freeglut_glutfont_definitions.c b/freeglut/freeglut/src/freeglut_glutfont_definitions.c new file mode 100644 index 0000000..7cb34f8 --- /dev/null +++ b/freeglut/freeglut/src/freeglut_glutfont_definitions.c @@ -0,0 +1,76 @@ +/* + * freeglut_glutfont_definitions.c + * + * Bitmap and stroke fonts displaying. + * + * Copyright (c) 2003 Stephen J. Baker (whether he wants it or not). All Rights Reserved. + * Written by John F. Fay , who releases the copyright over to the + * "freeglut" project lead. + * Creation date: Mon July 21 2003 + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file is necessary for the *nix version of "freeglut" because the original GLUT + * defined its font variables in rather an unusual way. Publicly, in "glut.h", they were + * defined as "void *". Privately, in one of the source code files, they were defined as + * pointers to a structure. Most compilers and linkers are satisfied with the "void *" + * and don't go any farther, but some of them balked. In particular, when compiling with + * "freeglut" and then trying to run using the GLUT ".so" library, some of them would give + * an error. So we are having to create this file to define the variables as pointers + * to an unusual structure to match GLUT. + */ + +#include "freeglut_internal.h" + +#if TARGET_HOST_UNIX_X11 + +#define G_LOG_DOMAIN "freeglut-glutfont-definitions" + +struct freeglutStrokeFont +{ + const char *name ; + int num_chars ; + void *ch ; + float top ; + float bottom ; +} ; + +struct freeglutBitmapFont +{ + const char *name ; + const int num_chars ; + const int first ; + const void *ch ; +} ; + + +struct freeglutStrokeFont *glutStrokeRoman ; +struct freeglutStrokeFont *glutStrokeMonoRoman ; + +struct freeglutBitmapFont *glutBitmap9By15 ; +struct freeglutBitmapFont *glutBitmap8By13 ; +struct freeglutBitmapFont *glutBitmapTimesRoman10 ; +struct freeglutBitmapFont *glutBitmapTimesRoman24 ; +struct freeglutBitmapFont *glutBitmapHelvetica10 ; +struct freeglutBitmapFont *glutBitmapHelvetica12 ; +struct freeglutBitmapFont *glutBitmapHelvetica18 ; + +#endif +