-/* $Id: xfonts.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
+/* $Id: xfonts.c,v 1.8 2000/08/13 03:57:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.1
+ * Version: 3.4
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include <X11/Xutil.h>
#include "GL/gl.h"
#include "GL/glx.h"
-#include "GL/xmesa.h"
#include "context.h"
-#include "fakeglx.h"
-#include "macros.h"
-#include "xmesaP.h"
+#include "mem.h"
+#include "xfonts.h"
+
/* Some debugging info. */
void Fake_glXUseXFont( Font font, int first, int count, int listbase )
{
- XMesaContext CC;
Display *dpy;
Window win;
Pixmap pixmap;
XGCValues values;
unsigned long valuemask;
XFontStruct *fs;
-
GLint swapbytes, lsbfirst, rowlength;
GLint skiprows, skippixels, alignment;
-
unsigned int max_width, max_height, max_bm_width, max_bm_height;
GLubyte *bm;
-
int i;
- CC = XMesaGetCurrentContext();
- dpy = CC->display;
- win = CC->xm_buffer->frontbuffer;
+ dpy = glXGetCurrentDisplay();
+ if (!dpy)
+ return; /* I guess glXMakeCurrent wasn't called */
+ win = RootWindow(dpy, DefaultScreen(dpy));
fs = XQueryFont (dpy, font);
- if (!fs)
- {
- gl_error (CC->gl_ctx, GL_INVALID_VALUE,
- "Couldn't get font structure information");
+ if (!fs) {
+ gl_error(NULL, GL_INVALID_VALUE,
+ "Couldn't get font structure information");
return;
- }
+ }
/* Allocate a bitmap that can fit all characters. */
max_width = fs->max_bounds.rbearing - fs->min_bounds.lbearing;
max_bm_width = (max_width + 7) / 8;
max_bm_height = max_height;
- bm = (GLubyte *) malloc ((max_bm_width * max_bm_height) * sizeof
+ bm = (GLubyte *) MALLOC((max_bm_width * max_bm_height) * sizeof
(GLubyte));
if (!bm) {
XFreeFontInfo( NULL, fs, 0 );
- gl_error (CC->gl_ctx, GL_OUT_OF_MEMORY,
+ gl_error(NULL, GL_OUT_OF_MEMORY,
"Couldn't allocate bitmap in glXUseXFont()");
return;
- }
+ }
#if 0
/* get the page info */
width = ch->rbearing - ch->lbearing;
height = ch->ascent + ch->descent;
x0 = - ch->lbearing;
- y0 = ch->descent - 1;
+ y0 = ch->descent - 0; /* XXX used to subtract 1 here */
+ /* but that caused a conformace failure */
dx = ch->width;
dy = 0;
glEndList ();
}
- free (bm);
+ FREE(bm);
XFreeFontInfo( NULL, fs, 0 );
XFreeGC (dpy, gc);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
}
-
-void xmesa_xfonts_dummy( void )
-{
- /* silence unused var warnings */
- (void) kernel8;
- (void) DitherValues;
- (void) HPCR_DRGB;
- (void) kernel1;
-}
-
-/* The End. */