-/* $Id: xfonts.c,v 1.5 1999/12/12 17:04:50 brianp Exp $ */
+/* $Id: xfonts.c,v 1.14 2001/04/26 19:28:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
- * 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"),
* Copyright (C) 1995 Thorsten.Ohl @ Physik.TH-Darmstadt.de
*/
+#ifdef __VMS
+#include <GL/vms_x_fix.h>
+#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#include <X11/Xutil.h>
#include "GL/gl.h"
#include "GL/glx.h"
-#include "GL/xmesa.h"
#include "context.h"
#include "mem.h"
-#include "xmesaP.h"
+#include "xfonts.h"
+
/* Some debugging info. */
* determine if a given glyph is valid and return the
* corresponding XCharStruct.
*/
-static XCharStruct *isvalid(XFontStruct *fs, int which)
+static XCharStruct *isvalid(XFontStruct *fs, unsigned int which)
{
unsigned int rows,pages;
- int byte1,byte2;
+ unsigned int byte1 = 0,byte2 = 0;
int i,valid = 1;
rows = fs->max_byte1 - fs->min_byte1 + 1;
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) {
+ _mesa_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;
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,
+ XFreeFontInfo( NULL, fs, 1 );
+ _mesa_error(NULL, GL_OUT_OF_MEMORY,
"Couldn't allocate bitmap in glXUseXFont()");
return;
- }
+ }
#if 0
/* get the page info */
glEndList ();
}
- free (bm);
- XFreeFontInfo( NULL, fs, 0 );
+ FREE(bm);
+ XFreeFontInfo( NULL, fs, 1 );
XFreeGC (dpy, gc);
/* Restore saved packing modes. */
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. */