… | |
… | |
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 | |
… | |
… | |
264 | bool load (const rxvt_fontprop &prop) |
268 | bool load (const rxvt_fontprop &prop) |
265 | { |
269 | { |
266 | width = 1; height = 1; |
270 | width = 1; height = 1; |
267 | ascent = 1; descent = 0; |
271 | ascent = 1; descent = 0; |
268 | |
272 | |
|
|
273 | set_name ("built-in pseudofont"); |
|
|
274 | |
269 | return true; |
275 | return true; |
270 | } |
276 | } |
271 | |
277 | |
272 | bool has_codepoint (uint32_t unicode) |
278 | bool has_codepoint (uint32_t unicode) |
273 | { |
279 | { |
274 | if (unicode <= 0x001f) |
280 | if (unicode <= 0x001f) |
275 | return true; |
281 | return true; |
|
|
282 | |
276 | if (unicode >= 0x0080 && unicode <= 0x009f) |
283 | if (unicode >= 0x0080 && unicode <= 0x009f) |
277 | return true; |
284 | return true; |
278 | |
285 | |
279 | if (unicode >= 0x2500 && unicode <= 0x257f |
286 | if (unicode >= 0x2500 && unicode <= 0x257f |
280 | && linedraw_cmds[unicode - 0x2500]) |
287 | && linedraw_cmds[unicode - 0x2500]) |
|
|
288 | return true; |
|
|
289 | |
|
|
290 | if (IS_COMPOSE (unicode)) |
281 | return true; |
291 | return true; |
282 | |
292 | |
283 | switch (unicode) |
293 | switch (unicode) |
284 | { |
294 | { |
285 | case ZERO_WIDTH_CHAR: |
295 | case ZERO_WIDTH_CHAR: |
… | |
… | |
303 | |
313 | |
304 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
314 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
305 | |
315 | |
306 | while (len--) |
316 | while (len--) |
307 | { |
317 | { |
|
|
318 | compose_char *cc; |
308 | text_t t = *text++; |
319 | text_t t = *text++; |
309 | |
320 | |
310 | // is it in our linedrawing table? |
321 | // is it in our linedrawing table? |
311 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
322 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
312 | { |
323 | { |
313 | const char *p = linedraw_cmds[t - 0x2500]; |
324 | const char *p = linedraw_cmds[t - 0x2500]; |
314 | |
325 | |
315 | 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; |
316 | 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; |
317 | |
328 | |
318 | XGCValues gcv; |
329 | XGCValues gcv; |
319 | |
330 | |
320 | while (*p) |
331 | while (*p) |
321 | { |
332 | { |
… | |
… | |
340 | } |
351 | } |
341 | } |
352 | } |
342 | |
353 | |
343 | gcv.line_width = 0; |
354 | gcv.line_width = 0; |
344 | 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 | } |
345 | } |
370 | } |
346 | else |
371 | else |
347 | switch (t) |
372 | switch (t) |
348 | { |
373 | { |
349 | case ZERO_WIDTH_CHAR: |
374 | case ZERO_WIDTH_CHAR: |
… | |
… | |
442 | |
467 | |
443 | bool |
468 | bool |
444 | rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) |
469 | rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) |
445 | { |
470 | { |
446 | int slashes = 0; |
471 | int slashes = 0; |
447 | const char *comp[12]; |
472 | const char *comp[13]; |
448 | |
473 | |
449 | for (const char *c = name; *c; c++) |
474 | for (const char *c = name; *c; c++) |
450 | if (*c == '-') |
475 | if (*c == '-') |
451 | { |
476 | { |
452 | comp[slashes++] = c + 1; |
477 | comp[slashes++] = c + 1; |
… | |
… | |
1013 | f = new rxvt_font_x11; |
1038 | f = new rxvt_font_x11; |
1014 | } |
1039 | } |
1015 | else |
1040 | else |
1016 | f = new rxvt_font_x11; |
1041 | f = new rxvt_font_x11; |
1017 | |
1042 | |
|
|
1043 | f->fs = this; |
1018 | f->set_term (r); |
1044 | f->set_term (r); |
1019 | f->set_name (strdup (name)); |
1045 | f->set_name (strdup (name)); |
1020 | |
1046 | |
1021 | f->cs = cs; |
1047 | f->cs = cs; |
1022 | f->loaded = false; |
1048 | f->loaded = false; |