X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fglsnake.c;h=07f9c54d90f0925b2272180dc0d1a20c5ed8d511;hp=534788b4c3d28601d5efaed223c004ed98357390;hb=2d04c4f22466851aedb6ed0f2919d148f726b889;hpb=bc7b7a8eb122206d239ec0e693676bcce31be1aa diff --git a/hacks/glx/glsnake.c b/hacks/glx/glsnake.c index 534788b4..07f9c54d 100644 --- a/hacks/glx/glsnake.c +++ b/hacks/glx/glsnake.c @@ -156,6 +156,7 @@ extern XtAppContext app; #define countof(x) (sizeof((x))/sizeof((*x))) #include "xlockmore.h" +#include "glxfonts.h" static XrmOptionDescRec opts[] = { { "-explode", ".explode", XrmoptionSepArg, DEF_EXPLODE }, @@ -1400,33 +1401,6 @@ void gettime(snaketime *t) #endif /* !HAVE_GETTIMEOFDAY */ } -#ifndef HAVE_GLUT -static void load_font(ModeInfo * mi, char * res, XFontStruct ** fontp, GLuint * dlistp) { - const char * font = get_string_resource(res, "Font"); - XFontStruct * f; - Font id; - int first, last; - - if (!font) - font = "-*-helvetica-medium-r-*-*-*-120-*"; - - f = XLoadQueryFont(mi->dpy, font); - if (!f) - f = XLoadQueryFont(mi->dpy, "fixed"); - - id = f->fid; - first = f->min_char_or_byte2; - last = f->max_char_or_byte2; - - clear_gl_error(); - *dlistp = glGenLists((GLuint) last + 1); - check_gl_error("glGenLists"); - glXUseXFont(id, first, last - first + 1, *dlistp + first); - check_gl_error("glXUseXFont"); - - *fontp = f; -} -#endif void start_morph(int model_index, int immediate); @@ -1479,7 +1453,7 @@ ModeInfo * mi /* set up a font for the labels */ #ifndef HAVE_GLUT if (titles) - load_font(mi, "labelfont", &bp->font, &bp->font_list); + load_font(mi->dpy, "labelfont", &bp->font, &bp->font_list); #endif /* build a solid display list */ @@ -1663,25 +1637,15 @@ void draw_title( { char interactstr[] = "interactive"; char * s; - int i = 0; -#ifdef HAVE_GLUT - int w; -#endif - if (interactive) s = interactstr; else s = model[glc->next_model].name; -#ifdef HAVE_GLUT - w = glutBitmapLength(GLUT_BITMAP_HELVETICA_12, (unsigned char *) s); - glRasterPos2f(glc->width - w - 3, 4); - while (s[i] != '\0') - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, s[i++]); -#else - glRasterPos2f(10, mi->xgwa.height - 10 - (bp->font->ascent + bp->font->descent)); - while (s[i] != '\0') - glCallList(bp->font_list + (int)s[i++]); -#endif + + print_gl_string (mi->dpy, bp->font, bp->font_list, + mi->xgwa.width, mi->xgwa.height, + 10, mi->xgwa.height - 10, + s); } glPopMatrix(); glMatrixMode(GL_PROJECTION);