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

Comparing rxvt-unicode/src/rxvtfont.C (file contents):
Revision 1.75 by root, Sun Dec 18 00:59:42 2005 UTC vs.
Revision 1.78 by root, Fri Jan 6 05:37:59 2006 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: rxvtfont.C 2 * File: rxvtfont.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> 4 * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com>
5 * - original version. 5 * - original version.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or 9 * the Free Software Foundation; either version 2 of the License, or
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *---------------------------------------------------------------------*/ 20 *---------------------------------------------------------------------*/
21 21
22#include "../config.h" 22#include "../config.h"
23#include "rxvt.h" 23#include "rxvt.h"
24#include "rxvtlib.h"
24#include "rxvtutil.h" 25#include "rxvtutil.h"
25#include "rxvtfont.h" 26#include "rxvtfont.h"
26 27
27#include <cstdlib> 28#include <cstdlib>
28#include <wchar.h> 29#include <wchar.h>
276 rxvt_fontprop properties () 277 rxvt_fontprop properties ()
277 { 278 {
278 rxvt_fontprop p; 279 rxvt_fontprop p;
279 280
280 p.width = p.height = 1; 281 p.width = p.height = 1;
282 p.ascent = rxvt_fontprop::unset;
281 p.weight = rxvt_fontprop::medium; 283 p.weight = rxvt_fontprop::medium;
282 p.slant = rxvt_fontprop::roman; 284 p.slant = rxvt_fontprop::roman;
283 285
284 return p; 286 return p;
285 } 287 }
305 return false; 307 return false;
306 308
307 if (unicode <= 0x009f) 309 if (unicode <= 0x009f)
308 return true; 310 return true;
309 311
310 if (unicode >= 0x2500 && unicode <= 0x259f) 312 if (unicode >= 0x2500 && unicode <= 0x259f &&
313 ! OPTION_R (Opt_skipBuiltinGlyphs))
311 return true; 314 return true;
312 315
313 if (IS_COMPOSE (unicode)) 316 if (IS_COMPOSE (unicode))
314 return true; 317 return true;
315 318
351 ; 354 ;
352 355
353 int width = text - tp; 356 int width = text - tp;
354 int fwidth = r->fwidth * width; 357 int fwidth = r->fwidth * width;
355 358
356 if (0x2500 <= t && t <= 0x259f) 359 if (0x2500 <= t && t <= 0x259f &&
360 ! OPTION_R (Opt_skipBuiltinGlyphs))
357 { 361 {
358 uint16_t offs = linedraw_offs[t - 0x2500]; 362 uint16_t offs = linedraw_offs[t - 0x2500];
359 uint32_t *a = linedraw_command + (offs >> 4); 363 uint32_t *a = linedraw_command + (offs >> 4);
360 uint32_t *b = a + (offs & 15); 364 uint32_t *b = a + (offs & 15);
361 365
523bool 527bool
524rxvt_font_x11::set_properties (rxvt_fontprop &p, int height, const char *weight, const char *slant, int avgwidth) 528rxvt_font_x11::set_properties (rxvt_fontprop &p, int height, const char *weight, const char *slant, int avgwidth)
525{ 529{
526 p.width = avgwidth ? (avgwidth + 1) / 10 : (height + 1) / 2; 530 p.width = avgwidth ? (avgwidth + 1) / 10 : (height + 1) / 2;
527 p.height = height; 531 p.height = height;
532 p.ascent = rxvt_fontprop::unset;
528 p.weight = *weight == 'B' || *weight == 'b' ? rxvt_fontprop::bold : rxvt_fontprop::medium; 533 p.weight = *weight == 'B' || *weight == 'b' ? rxvt_fontprop::bold : rxvt_fontprop::medium;
529 p.slant = *slant == 'r' || *slant == 'R' ? rxvt_fontprop::roman : rxvt_fontprop::italic; 534 p.slant = *slant == 'r' || *slant == 'R' ? rxvt_fontprop::roman : rxvt_fontprop::italic;
530 535
531 return true; 536 return true;
532} 537}
552 557
553 set_properties (p, height, weight, slant, avgwidth); 558 set_properties (p, height, weight, slant, avgwidth);
554 559
555 free (weight); 560 free (weight);
556 free (slant); 561 free (slant);
562
563 p.ascent = f->ascent;
557 564
558 return true; 565 return true;
559} 566}
560 567
561bool 568bool
1073 1080
1074 FT_Face face = XftLockFace (f); 1081 FT_Face face = XftLockFace (f);
1075 1082
1076 p.width = width; 1083 p.width = width;
1077 p.height = height; 1084 p.height = height;
1085 p.ascent = ascent;
1078 p.weight = face->style_flags & FT_STYLE_FLAG_BOLD 1086 p.weight = face->style_flags & FT_STYLE_FLAG_BOLD
1079 ? rxvt_fontprop::bold : rxvt_fontprop::medium; 1087 ? rxvt_fontprop::bold : rxvt_fontprop::medium;
1080 p.slant = face->style_flags & FT_STYLE_FLAG_ITALIC 1088 p.slant = face->style_flags & FT_STYLE_FLAG_ITALIC
1081 ? rxvt_fontprop::italic : rxvt_fontprop::roman; 1089 ? rxvt_fontprop::italic : rxvt_fontprop::roman;
1082 1090
1336} 1344}
1337 1345
1338void 1346void
1339rxvt_fontset::clear () 1347rxvt_fontset::clear ()
1340{ 1348{
1341 prop.width = prop.height = prop.weight = prop.slant 1349 prop.width = prop.height = prop.ascent = prop.weight = prop.slant
1342 = rxvt_fontprop::unset; 1350 = rxvt_fontprop::unset;
1343 1351
1344 for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) 1352 for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++)
1345 FONT_UNREF (*i); 1353 FONT_UNREF (*i);
1346 1354
1519 if (FROM_UNICODE (f->cs, unicode) == NOCHAR) 1527 if (FROM_UNICODE (f->cs, unicode) == NOCHAR)
1520 goto next_font; 1528 goto next_font;
1521 1529
1522 if (!realize_font (i)) 1530 if (!realize_font (i))
1523 goto next_font; 1531 goto next_font;
1532
1533 if (prop.ascent != rxvt_fontprop::unset)
1534 max_it (f->ascent, prop.ascent);
1524 } 1535 }
1525 1536
1526 if (f->cs == CS_UNKNOWN) 1537 if (f->cs == CS_UNKNOWN)
1527 goto next_font; 1538 goto next_font;
1528 1539

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines