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.27 by pcg, Wed Mar 3 00:20:33 2004 UTC vs.
Revision 1.38 by pcg, Fri Mar 5 21:26:01 2004 UTC

72 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" }, 72 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" },
73 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" }, 73 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" },
74 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" }, 74 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" },
75 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" }, 75 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" },
76# endif 76# endif
77 { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5*-0" }, 77 { CS_BIG5, "-*-*-*-*-*-*-*-*-*-*-c-*-big5-0" },
78 { CS_BIG5_PLUS, "-*-*-*-*-*-*-*-*-*-*-c-*-big5p-0" },
79 { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5.eten-0" },
78 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" }, 80 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" },
79 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" }, 81 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" },
80 { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" }, 82 { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" },
81 { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" }, 83 { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" },
82 { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" }, 84 { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" },
94 { CS_UNICODE, "xft:FreeMono" }, 96 { CS_UNICODE, "xft:FreeMono" },
95 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, 97 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" },
96 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, 98 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" },
97 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, 99 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" },
98 100
101#if UNICODE_3 && XFT
102 { CS_UNICODE, "xft:Code2001" }, // contains many plane-1 characters
103#endif
104
99 { CS_UNKNOWN, 0 } 105 { CS_UNKNOWN, 0 }
100}; 106};
101 107
102///////////////////////////////////////////////////////////////////////////// 108/////////////////////////////////////////////////////////////////////////////
103 109
262 bool load (const rxvt_fontprop &prop) 268 bool load (const rxvt_fontprop &prop)
263 { 269 {
264 width = 1; height = 1; 270 width = 1; height = 1;
265 ascent = 1; descent = 0; 271 ascent = 1; descent = 0;
266 272
273 set_name ("built-in pseudofont");
274
267 return true; 275 return true;
268 } 276 }
269 277
270 bool has_codepoint (uint32_t unicode) 278 bool has_codepoint (uint32_t unicode)
271 { 279 {
272 if (unicode <= 0x001f) 280 if (unicode <= 0x001f)
273 return true; 281 return true;
282
274 if (unicode >= 0x0080 && unicode <= 0x009f) 283 if (unicode >= 0x0080 && unicode <= 0x009f)
275 return true; 284 return true;
276 285
277 if (unicode >= 0x2500 && unicode <= 0x257f 286 if (unicode >= 0x2500 && unicode <= 0x257f
278 && linedraw_cmds[unicode - 0x2500]) 287 && linedraw_cmds[unicode - 0x2500])
288 return true;
289
290 if (IS_COMPOSE (unicode))
279 return true; 291 return true;
280 292
281 switch (unicode) 293 switch (unicode)
282 { 294 {
283 case ZERO_WIDTH_CHAR: 295 case ZERO_WIDTH_CHAR:
301 313
302 XSetForeground (d.display->display, GC, r->PixColors[fg]); 314 XSetForeground (d.display->display, GC, r->PixColors[fg]);
303 315
304 while (len--) 316 while (len--)
305 { 317 {
318 compose_char *cc;
306 text_t t = *text++; 319 text_t t = *text++;
307 320
308 // is it in our linedrawing table? 321 // is it in our linedrawing table?
309 if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) 322 if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500])
310 { 323 {
311 const char *p = linedraw_cmds[t - 0x2500]; 324 const char *p = linedraw_cmds[t - 0x2500];
312 325
313 int x0 = x, x1 = x + r->TermWin.fwidth / 2, x2 = x + r->TermWin.fwidth - 1; 326 int x0 = x, x1 = x + (r->TermWin.fwidth - 1) / 2, x2 = x + r->TermWin.fwidth - 1;
314 int y0 = y, y1 = y + r->TermWin.fheight / 2, y2 = y + r->TermWin.fheight - 1; 327 int y0 = y, y1 = y + (r->TermWin.fheight - 1) / 2, y2 = y + r->TermWin.fheight - 1;
315 328
316 XGCValues gcv; 329 XGCValues gcv;
317 330
318 while (*p) 331 while (*p)
319 { 332 {
338 } 351 }
339 } 352 }
340 353
341 gcv.line_width = 0; 354 gcv.line_width = 0;
342 XChangeGC (d.display->display, GC, GCLineWidth, &gcv); 355 XChangeGC (d.display->display, GC, GCLineWidth, &gcv);
356 }
357 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t]))
358 {
359 rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)];
360 f1->draw (d, x, y, &(t = cc->c1), 1, fg, bg);
361 if (cc->c2 != NOCHAR)
362 {
363 // prefer font of first character, for no good reasons
364 rxvt_font *f2 = f1->has_codepoint (cc->c2)
365 ? f1
366 : (*fs)[fs->find_font (cc->c2)];
367
368 f2->draw (d, x, y, &(t = cc->c2), 1, fg, -1);
369 }
343 } 370 }
344 else 371 else
345 switch (t) 372 switch (t)
346 { 373 {
347 case ZERO_WIDTH_CHAR: 374 case ZERO_WIDTH_CHAR:
440 467
441bool 468bool
442rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) 469rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name)
443{ 470{
444 int slashes = 0; 471 int slashes = 0;
445 const char *comp[12]; 472 const char *comp[13];
446 473
447 for (const char *c = name; *c; c++) 474 for (const char *c = name; *c; c++)
448 if (*c == '-') 475 if (*c == '-')
449 { 476 {
450 comp[slashes++] = c + 1; 477 comp[slashes++] = c + 1;
1011 f = new rxvt_font_x11; 1038 f = new rxvt_font_x11;
1012 } 1039 }
1013 else 1040 else
1014 f = new rxvt_font_x11; 1041 f = new rxvt_font_x11;
1015 1042
1043 f->fs = this;
1016 f->set_term (r); 1044 f->set_term (r);
1017 f->set_name (strdup (name)); 1045 f->set_name (strdup (name));
1018 1046
1019 f->cs = cs; 1047 f->cs = cs;
1020 f->loaded = false; 1048 f->loaded = false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines