-/* texfonts, Copyright (c) 2005, 2006 Jamie Zawinski <jwz@jwz.org>
+/* texfonts, Copyright (c) 2005-2007 Jamie Zawinski <jwz@jwz.org>
* Loads X11 fonts into textures for use with OpenGL.
*
* Permission to use, copy, modify, distribute, and sell this software and its
int grid_mag; /* 1, 2, 4, or 8 */
int ntextures; /* 1, 4, 16, or 64 (grid_mag ^ 2) */
- GLuint texid[32];
+ GLuint texid[64]; /* must hold ntextures */
};
texture_font_data *data = 0;
char *font = get_string_resource (dpy, res, "Font");
- const char *def1 = "-*-times-bold-r-normal-*-240-*";
- const char *def2 = "-*-times-bold-r-normal-*-180-*";
+ const char *def1 = "-*-helvetica-medium-r-normal-*-240-*";
+ const char *def2 = "-*-helvetica-medium-r-normal-*-180-*";
const char *def3 = "fixed";
XFontStruct *f;
int which;
/* See comment in print_texture_string for bit layout explanation.
*/
- int lbearing = (f->per_char
+ int lbearing = (f->per_char && ii >= f->min_char_or_byte2
? f->per_char[ii - f->min_char_or_byte2].lbearing
: f->min_bounds.lbearing);
- int ascent = (f->per_char
+ int ascent = (f->per_char && ii >= f->min_char_or_byte2
? f->per_char[ii - f->min_char_or_byte2].ascent
: f->max_bounds.ascent);
- int width = (f->per_char
+ int width = (f->per_char && ii >= f->min_char_or_byte2
? f->per_char[ii - f->min_char_or_byte2].width
: f->max_bounds.width);
while (*c)
{
int cc = *((unsigned char *) c);
- w += (f->per_char
+ w += (f->per_char && cc >= f->min_char_or_byte2
? f->per_char[cc-f->min_char_or_byte2].width
: f->max_bounds.width);
c++;
We want to make a quad from point A to point C.
We want to position that quad so that point B lies at x,y.
*/
- int lbearing = (f->per_char
+ int lbearing = (f->per_char && c >= f->min_char_or_byte2
? f->per_char[c - f->min_char_or_byte2].lbearing
: f->min_bounds.lbearing);
- int rbearing = (f->per_char
+ int rbearing = (f->per_char && c >= f->min_char_or_byte2
? f->per_char[c - f->min_char_or_byte2].rbearing
: f->max_bounds.rbearing);
- int ascent = (f->per_char
+ int ascent = (f->per_char && c >= f->min_char_or_byte2
? f->per_char[c - f->min_char_or_byte2].ascent
: f->max_bounds.ascent);
- int descent = (f->per_char
+ int descent = (f->per_char && c >= f->min_char_or_byte2
? f->per_char[c - f->min_char_or_byte2].descent
: f->max_bounds.descent);
- int cwidth = (f->per_char
+ int cwidth = (f->per_char && c >= f->min_char_or_byte2
? f->per_char[c - f->min_char_or_byte2].width
: f->max_bounds.width);