ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/defaultfont.C
(Generate patch)

Comparing rxvt-unicode/src/defaultfont.C (file contents):
Revision 1.5 by pcg, Thu Dec 4 00:43:26 2003 UTC vs.
Revision 1.6 by pcg, Wed Dec 17 22:29:03 2003 UTC

353bool 353bool
354rxvt_font_x11::load (int maxheight) 354rxvt_font_x11::load (int maxheight)
355{ 355{
356 clear (); 356 clear ();
357 357
358 char **list;
359 int count;
360 XFontStruct *info;
361 list = XListFontsWithInfo (DISPLAY, name, 128, &count, &info);
362
363 if (!list)
364 return false;
365
366 XFontStruct *best = 0;
367 for (int i = 0; i < count; i++)
368 {
369 XFontStruct *f = info + i;
370 if (f->ascent + f->descent <= maxheight) // weed out too large fonts
371 if (!best // compare against best found so far
372 || best->ascent + best->descent < f->ascent + f->descent)
373 best = f;
374 }
375
376 set_name (strdup (list[best - info]));
377
378 XFreeFontInfo (list, info, count);
379
358 f = XLoadQueryFont (DISPLAY, name); 380 f = XLoadQueryFont (DISPLAY, name);
359 381
360 if (!f) 382 if (!f)
361 return false; 383 return false;
362 384

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines