… | |
… | |
268 | bool load (const rxvt_fontprop &prop) |
268 | bool load (const rxvt_fontprop &prop) |
269 | { |
269 | { |
270 | width = 1; height = 1; |
270 | width = 1; height = 1; |
271 | ascent = 1; descent = 0; |
271 | ascent = 1; descent = 0; |
272 | |
272 | |
|
|
273 | set_name ("built-in pseudofont"); |
|
|
274 | |
273 | return true; |
275 | return true; |
274 | } |
276 | } |
275 | |
277 | |
276 | bool has_codepoint (uint32_t unicode) |
278 | bool has_codepoint (unicode_t unicode) |
277 | { |
279 | { |
278 | if (unicode <= 0x001f) |
280 | if (unicode <= 0x001f) |
279 | return true; |
281 | return true; |
280 | |
282 | |
281 | if (unicode >= 0x0080 && unicode <= 0x009f) |
283 | if (unicode >= 0x0080 && unicode <= 0x009f) |
… | |
… | |
283 | |
285 | |
284 | if (unicode >= 0x2500 && unicode <= 0x257f |
286 | if (unicode >= 0x2500 && unicode <= 0x257f |
285 | && linedraw_cmds[unicode - 0x2500]) |
287 | && linedraw_cmds[unicode - 0x2500]) |
286 | return true; |
288 | return true; |
287 | |
289 | |
288 | if (IS_PSEUDO (unicode)) |
290 | if (IS_COMPOSE (unicode)) |
289 | return true; |
291 | return true; |
290 | |
292 | |
291 | switch (unicode) |
293 | switch (unicode) |
292 | { |
294 | { |
293 | case ZERO_WIDTH_CHAR: |
295 | case ZERO_WIDTH_CHAR: |
… | |
… | |
311 | |
313 | |
312 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
314 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
313 | |
315 | |
314 | while (len--) |
316 | while (len--) |
315 | { |
317 | { |
|
|
318 | #if ENABLE_COMBINING |
|
|
319 | compose_char *cc; |
|
|
320 | #endif |
316 | text_t t = *text++; |
321 | text_t t = *text++; |
317 | |
322 | |
318 | // is it in our linedrawing table? |
323 | // is it in our linedrawing table? |
319 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
324 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
320 | { |
325 | { |
… | |
… | |
349 | } |
354 | } |
350 | |
355 | |
351 | gcv.line_width = 0; |
356 | gcv.line_width = 0; |
352 | XChangeGC (d.display->display, GC, GCLineWidth, &gcv); |
357 | XChangeGC (d.display->display, GC, GCLineWidth, &gcv); |
353 | } |
358 | } |
354 | else if (IS_PSEUDO (t)) |
359 | #if ENABLE_COMBINING |
355 | { |
360 | else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) |
356 | const compose_char &cc = r->composite (t); |
|
|
357 | (void)0; //D ADD pseudo handling here |
|
|
358 | } |
361 | { |
|
|
362 | rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)]; |
|
|
363 | f1->draw (d, x, y, &(t = cc->c1), 1, fg, bg); |
|
|
364 | if (cc->c2 != NOCHAR) |
|
|
365 | { |
|
|
366 | // prefer font of first character, for no good reasons |
|
|
367 | rxvt_font *f2 = f1->has_codepoint (cc->c2) |
|
|
368 | ? f1 |
|
|
369 | : (*fs)[fs->find_font (cc->c2)]; |
|
|
370 | |
|
|
371 | f2->draw (d, x, y, &(t = cc->c2), 1, fg, -1); |
|
|
372 | } |
|
|
373 | } |
|
|
374 | #endif |
359 | else |
375 | else |
360 | switch (t) |
376 | switch (t) |
361 | { |
377 | { |
362 | case ZERO_WIDTH_CHAR: |
378 | case ZERO_WIDTH_CHAR: |
363 | break; |
379 | break; |
… | |
… | |
388 | |
404 | |
389 | rxvt_fontprop properties (); |
405 | rxvt_fontprop properties (); |
390 | |
406 | |
391 | bool load (const rxvt_fontprop &prop); |
407 | bool load (const rxvt_fontprop &prop); |
392 | |
408 | |
393 | bool has_codepoint (uint32_t unicode); |
409 | bool has_codepoint (unicode_t unicode); |
394 | |
410 | |
395 | void draw (rxvt_drawable &d, int x, int y, |
411 | void draw (rxvt_drawable &d, int x, int y, |
396 | const text_t *text, int len, |
412 | const text_t *text, int len, |
397 | int fg, int bg); |
413 | int fg, int bg); |
398 | |
414 | |
… | |
… | |
645 | f = 0; |
661 | f = 0; |
646 | } |
662 | } |
647 | } |
663 | } |
648 | |
664 | |
649 | bool |
665 | bool |
650 | rxvt_font_x11::has_codepoint (uint32_t unicode) |
666 | rxvt_font_x11::has_codepoint (unicode_t unicode) |
651 | { |
667 | { |
652 | uint32_t ch = FROM_UNICODE (cs, unicode); |
668 | uint32_t ch = FROM_UNICODE (cs, unicode); |
653 | |
669 | |
654 | if (ch == NOCHAR) |
670 | if (ch == NOCHAR) |
655 | return false; |
671 | return false; |
… | |
… | |
797 | |
813 | |
798 | void draw (rxvt_drawable &d, int x, int y, |
814 | void draw (rxvt_drawable &d, int x, int y, |
799 | const text_t *text, int len, |
815 | const text_t *text, int len, |
800 | int fg, int bg); |
816 | int fg, int bg); |
801 | |
817 | |
802 | bool has_codepoint (uint32_t unicode); |
818 | bool has_codepoint (unicode_t unicode); |
803 | |
819 | |
804 | protected: |
820 | protected: |
805 | XftFont *f; |
821 | XftFont *f; |
806 | }; |
822 | }; |
807 | |
823 | |
… | |
… | |
920 | |
936 | |
921 | return true; |
937 | return true; |
922 | } |
938 | } |
923 | |
939 | |
924 | bool |
940 | bool |
925 | rxvt_font_xft::has_codepoint (uint32_t unicode) |
941 | rxvt_font_xft::has_codepoint (unicode_t unicode) |
926 | { |
942 | { |
927 | return XftCharExists (DISPLAY, f, unicode); |
943 | return XftCharExists (DISPLAY, f, unicode); |
928 | } |
944 | } |
929 | |
945 | |
930 | void |
946 | void |
… | |
… | |
1026 | f = new rxvt_font_x11; |
1042 | f = new rxvt_font_x11; |
1027 | } |
1043 | } |
1028 | else |
1044 | else |
1029 | f = new rxvt_font_x11; |
1045 | f = new rxvt_font_x11; |
1030 | |
1046 | |
|
|
1047 | f->fs = this; |
1031 | f->set_term (r); |
1048 | f->set_term (r); |
1032 | f->set_name (strdup (name)); |
1049 | f->set_name (strdup (name)); |
1033 | |
1050 | |
1034 | f->cs = cs; |
1051 | f->cs = cs; |
1035 | f->loaded = false; |
1052 | f->loaded = false; |
… | |
… | |
1132 | |
1149 | |
1133 | return true; |
1150 | return true; |
1134 | } |
1151 | } |
1135 | |
1152 | |
1136 | int |
1153 | int |
1137 | rxvt_fontset::find_font (uint32_t unicode) |
1154 | rxvt_fontset::find_font (unicode_t unicode) |
1138 | { |
1155 | { |
1139 | for (unsigned int i = 0; i < fonts.size (); i++) |
1156 | for (unsigned int i = 0; i < fonts.size (); i++) |
1140 | { |
1157 | { |
1141 | rxvt_font *f = fonts[i]; |
1158 | rxvt_font *f = fonts[i]; |
1142 | |
1159 | |