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.28 by pcg, Wed Mar 3 02:59:53 2004 UTC vs.
Revision 1.37 by pcg, Fri Mar 5 05:52:02 2004 UTC

96 { CS_UNICODE, "xft:FreeMono" }, 96 { CS_UNICODE, "xft:FreeMono" },
97 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, 97 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" },
98 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, 98 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" },
99 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, 99 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" },
100 100
101#if UNICODE_3 && XFT
102 { CS_UNICODE, "xft:Code2001" }, // contains many plane-1 characters
103#endif
104
101 { CS_UNKNOWN, 0 } 105 { CS_UNKNOWN, 0 }
102}; 106};
103 107
104///////////////////////////////////////////////////////////////////////////// 108/////////////////////////////////////////////////////////////////////////////
105 109
271 275
272 bool has_codepoint (uint32_t unicode) 276 bool has_codepoint (uint32_t unicode)
273 { 277 {
274 if (unicode <= 0x001f) 278 if (unicode <= 0x001f)
275 return true; 279 return true;
280
276 if (unicode >= 0x0080 && unicode <= 0x009f) 281 if (unicode >= 0x0080 && unicode <= 0x009f)
277 return true; 282 return true;
278 283
279 if (unicode >= 0x2500 && unicode <= 0x257f 284 if (unicode >= 0x2500 && unicode <= 0x257f
280 && linedraw_cmds[unicode - 0x2500]) 285 && linedraw_cmds[unicode - 0x2500])
286 return true;
287
288 if (IS_COMPOSE (unicode))
281 return true; 289 return true;
282 290
283 switch (unicode) 291 switch (unicode)
284 { 292 {
285 case ZERO_WIDTH_CHAR: 293 case ZERO_WIDTH_CHAR:
303 311
304 XSetForeground (d.display->display, GC, r->PixColors[fg]); 312 XSetForeground (d.display->display, GC, r->PixColors[fg]);
305 313
306 while (len--) 314 while (len--)
307 { 315 {
316 compose_char *cc;
308 text_t t = *text++; 317 text_t t = *text++;
309 318
310 // is it in our linedrawing table? 319 // is it in our linedrawing table?
311 if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) 320 if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500])
312 { 321 {
313 const char *p = linedraw_cmds[t - 0x2500]; 322 const char *p = linedraw_cmds[t - 0x2500];
314 323
315 int x0 = x, x1 = x + r->TermWin.fwidth / 2, x2 = x + r->TermWin.fwidth - 1; 324 int x0 = x, x1 = x + (r->TermWin.fwidth - 1) / 2, x2 = x + r->TermWin.fwidth - 1;
316 int y0 = y, y1 = y + r->TermWin.fheight / 2, y2 = y + r->TermWin.fheight - 1; 325 int y0 = y, y1 = y + (r->TermWin.fheight - 1) / 2, y2 = y + r->TermWin.fheight - 1;
317 326
318 XGCValues gcv; 327 XGCValues gcv;
319 328
320 while (*p) 329 while (*p)
321 { 330 {
340 } 349 }
341 } 350 }
342 351
343 gcv.line_width = 0; 352 gcv.line_width = 0;
344 XChangeGC (d.display->display, GC, GCLineWidth, &gcv); 353 XChangeGC (d.display->display, GC, GCLineWidth, &gcv);
354 }
355 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t]))
356 {
357 rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)];
358 f1->draw (d, x, y, &(t = cc->c1), 1, fg, bg);
359 if (cc->c2 != NOCHAR)
360 {
361 // prefer font of first character, for no good reasons
362 rxvt_font *f2 = f1->has_codepoint (cc->c2)
363 ? f1
364 : (*fs)[fs->find_font (cc->c2)];
365
366 f2->draw (d, x, y, &(t = cc->c2), 1, fg, -1);
367 }
345 } 368 }
346 else 369 else
347 switch (t) 370 switch (t)
348 { 371 {
349 case ZERO_WIDTH_CHAR: 372 case ZERO_WIDTH_CHAR:
442 465
443bool 466bool
444rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) 467rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name)
445{ 468{
446 int slashes = 0; 469 int slashes = 0;
447 const char *comp[12]; 470 const char *comp[13];
448 471
449 for (const char *c = name; *c; c++) 472 for (const char *c = name; *c; c++)
450 if (*c == '-') 473 if (*c == '-')
451 { 474 {
452 comp[slashes++] = c + 1; 475 comp[slashes++] = c + 1;
1013 f = new rxvt_font_x11; 1036 f = new rxvt_font_x11;
1014 } 1037 }
1015 else 1038 else
1016 f = new rxvt_font_x11; 1039 f = new rxvt_font_x11;
1017 1040
1041 f->fs = this;
1018 f->set_term (r); 1042 f->set_term (r);
1019 f->set_name (strdup (name)); 1043 f->set_name (strdup (name));
1020 1044
1021 f->cs = cs; 1045 f->cs = cs;
1022 f->loaded = false; 1046 f->loaded = false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines