… | |
… | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
15 | * GNU General Public License for more details. |
16 | * |
16 | * |
17 | * You should have received a copy of the GNU General Public License |
17 | * You should have received a copy of the GNU General Public License |
18 | * along with this program; if not, write to the Free Software |
18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 "rxvtutil.h" |
24 | #include "rxvtutil.h" |
… | |
… | |
27 | #include <cstdlib> |
27 | #include <cstdlib> |
28 | #include <wchar.h> |
28 | #include <wchar.h> |
29 | #include <inttypes.h> |
29 | #include <inttypes.h> |
30 | |
30 | |
31 | #define DISPLAY r->display->display |
31 | #define DISPLAY r->display->display |
32 | #define TGC r->TermWin.gc |
32 | #define TGC r->gc |
33 | |
33 | |
34 | #define MAX_OVERLAP (4 + 1) // max. character width in 4ths of the base width |
34 | #define MAX_OVERLAP (4 + 1) // max. character width in 4ths of the base width |
35 | |
35 | |
36 | const struct rxvt_fallback_font { |
36 | const struct rxvt_fallback_font { |
37 | codeset cs; |
37 | codeset cs; |
… | |
… | |
130 | { CS_UNICODE, "-*-lucidatypewriter-*-*-*-*-*-*-*-*-m-*-iso10646-1" }, |
130 | { CS_UNICODE, "-*-lucidatypewriter-*-*-*-*-*-*-*-*-m-*-iso10646-1" }, |
131 | { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, |
131 | { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, |
132 | { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, |
132 | { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, |
133 | { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, |
133 | { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, |
134 | #if XFT |
134 | #if XFT |
135 | { CS_UNICODE, "xft:Bitstream Vera Sans Mono:antialias=false:autohint=true"}, |
135 | { CS_UNICODE, "xft:Bitstream Vera Sans Mono:antialias=false:autohint=true" }, |
136 | { CS_UNICODE, "xft:Courier New:antialias=false:autohint=true" }, |
136 | { CS_UNICODE, "xft:Courier New:antialias=false:autohint=true" }, |
137 | { CS_UNICODE, "xft:Andale Mono:antialias=false" }, |
137 | { CS_UNICODE, "xft:Andale Mono:antialias=false:autohint=false" }, |
138 | { CS_UNICODE, "xft:Arial Unicode MS:antialias=false" }, |
138 | { CS_UNICODE, "xft:Arial Unicode MS:antialias=false:autohint=false" }, |
139 | |
139 | |
140 | // FreeMono is usually uglier than x fonts, so try last only. |
140 | // FreeMono is usually uglier than x fonts, so try last only. |
141 | { CS_UNICODE, "xft:FreeMono:autohint=true" }, |
141 | { CS_UNICODE, "xft:FreeMono:autohint=true" }, |
142 | #endif |
142 | #endif |
143 | |
143 | |
… | |
… | |
333 | const text_t *text, int len, |
333 | const text_t *text, int len, |
334 | int fg, int bg) |
334 | int fg, int bg) |
335 | { |
335 | { |
336 | Display *disp = d.display->display; |
336 | Display *disp = d.display->display; |
337 | |
337 | |
338 | clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
338 | clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); |
339 | |
339 | |
340 | XSetForeground (disp, TGC, r->pix_colors[fg]); |
340 | XSetForeground (disp, TGC, r->pix_colors[fg]); |
341 | |
341 | |
342 | while (len) |
342 | while (len) |
343 | { |
343 | { |
… | |
… | |
349 | |
349 | |
350 | while (++text, --len && *text == NOCHAR) |
350 | while (++text, --len && *text == NOCHAR) |
351 | ; |
351 | ; |
352 | |
352 | |
353 | int width = text - tp; |
353 | int width = text - tp; |
354 | int fwidth = r->TermWin.fwidth * width; |
354 | int fwidth = r->fwidth * width; |
355 | |
355 | |
356 | if (0x2500 <= t && t <= 0x259f) |
356 | if (0x2500 <= t && t <= 0x259f) |
357 | { |
357 | { |
358 | uint16_t offs = linedraw_offs[t - 0x2500]; |
358 | uint16_t offs = linedraw_offs[t - 0x2500]; |
359 | uint32_t *a = linedraw_command + (offs >> 4); |
359 | uint32_t *a = linedraw_command + (offs >> 4); |
360 | uint32_t *b = a + (offs & 15); |
360 | uint32_t *b = a + (offs & 15); |
361 | |
361 | |
362 | int W = fwidth; |
362 | int W = fwidth; |
363 | int H = r->TermWin.fheight; |
363 | int H = r->fheight; |
364 | |
364 | |
365 | int x_[16]; |
365 | int x_[16]; |
366 | int y_[16]; |
366 | int y_[16]; |
367 | |
367 | |
368 | for (int i = 0; i <= 8; i++) |
368 | for (int i = 0; i <= 8; i++) |
… | |
… | |
464 | case NOCHAR: |
464 | case NOCHAR: |
465 | break; |
465 | break; |
466 | |
466 | |
467 | default: |
467 | default: |
468 | XDrawRectangle (disp, d, TGC, x + 2, y + 2, |
468 | XDrawRectangle (disp, d, TGC, x + 2, y + 2, |
469 | fwidth - 4, r->TermWin.fheight - 4); |
469 | fwidth - 4, r->fheight - 4); |
470 | } |
470 | } |
471 | |
471 | |
472 | x += fwidth; |
472 | x += fwidth; |
473 | } |
473 | } |
474 | } |
474 | } |
… | |
… | |
716 | |
716 | |
717 | int diff = 0; |
717 | int diff = 0; |
718 | |
718 | |
719 | if (replace_field (fname, list[i], 6, '0', field_str)) |
719 | if (replace_field (fname, list[i], 6, '0', field_str)) |
720 | diff += 10; // slightly penalize scalable fonts |
720 | diff += 10; // slightly penalize scalable fonts |
|
|
721 | else if (replace_field (fname, list[i], 11, '0', "0")) |
|
|
722 | diff += 300; // more heavily penalize what looks like scaled bitmap fotns |
721 | |
723 | |
722 | if (!set_properties (p, fname)) |
724 | if (!set_properties (p, fname)) |
723 | continue; |
725 | continue; |
724 | |
726 | |
725 | if (prop.height != rxvt_fontprop::unset |
727 | if (prop.height != rxvt_fontprop::unset |
… | |
… | |
741 | for (;;) |
743 | for (;;) |
742 | { |
744 | { |
743 | font_weight *best = fonts + count - 1; |
745 | font_weight *best = fonts + count - 1; |
744 | |
746 | |
745 | for (font_weight *w = best; w-- > fonts; ) |
747 | for (font_weight *w = best; w-- > fonts; ) |
746 | if (w->diff < best->diff) |
748 | if (w->diff <= best->diff) |
747 | best = w; |
749 | best = w; |
748 | |
750 | |
749 | if (!best->name |
751 | if (!best->name |
750 | || !(f = XLoadQueryFont (disp, best->name))) |
752 | || !(f = XLoadQueryFont (disp, best->name))) |
751 | break; |
753 | break; |
… | |
… | |
849 | |
851 | |
850 | XCharStruct g; |
852 | XCharStruct g; |
851 | int dir_ret, asc_ret, des_ret; |
853 | int dir_ret, asc_ret, des_ret; |
852 | XTextExtents16 (f, &ch, 1, &dir_ret, &asc_ret, &des_ret, &g); |
854 | XTextExtents16 (f, &ch, 1, &dir_ret, &asc_ret, &des_ret, &g); |
853 | |
855 | |
854 | int wcw = wcwidth (*t); if (wcw > 0) g.width = g.width / wcw; |
856 | int wcw = wcwidth (*t); if (wcw > 0) g.width = (g.width + wcw - 1) / wcw; |
855 | |
857 | |
856 | if (width < g.width) width = g.width; |
858 | if (width < g.width) width = g.width; |
857 | } |
859 | } |
858 | |
860 | |
859 | if (cs == CS_UNKNOWN) |
861 | if (cs == CS_UNKNOWN) |
… | |
… | |
934 | return true; |
936 | return true; |
935 | |
937 | |
936 | // check character against base font bounding box |
938 | // check character against base font bounding box |
937 | int w = xcs->width; |
939 | int w = xcs->width; |
938 | int wcw = wcwidth (unicode); |
940 | int wcw = wcwidth (unicode); |
939 | if (wcw > 0) w /= wcw; |
941 | if (wcw > 0) w = (w + wcw - 1) / wcw; |
940 | |
942 | |
941 | careful = w > prop->width; |
943 | careful = w > prop->width; |
942 | if (careful && w > prop->width * MAX_OVERLAP >> 2) |
944 | if (careful && w > prop->width * MAX_OVERLAP >> 2) |
943 | return false; |
945 | return false; |
944 | |
946 | |
… | |
… | |
954 | // and it is a mess /. |
956 | // and it is a mess /. |
955 | // yet we are trying to be perfect /. |
957 | // yet we are trying to be perfect /. |
956 | // but the result still isn't perfect /. |
958 | // but the result still isn't perfect /. |
957 | |
959 | |
958 | bool slow = this->slow |
960 | bool slow = this->slow |
959 | || width != r->TermWin.fwidth |
961 | || width != r->fwidth |
960 | || height != r->TermWin.fheight; |
962 | || height != r->fheight; |
961 | |
963 | |
962 | int base = ascent; // sorry, incorrect: r->TermWin.fbase; |
964 | int base = ascent; // sorry, incorrect: r->fbase; |
963 | |
965 | |
964 | XGCValues v; |
966 | XGCValues v; |
965 | v.foreground = r->pix_colors[fg]; |
967 | v.foreground = r->pix_colors[fg]; |
966 | v.font = f->fid; |
968 | v.font = f->fid; |
967 | |
969 | |
… | |
… | |
975 | XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v); |
977 | XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v); |
976 | XDrawImageString16 (d.display->display, d, TGC, x, y + base, xc, len); |
978 | XDrawImageString16 (d.display->display, d, TGC, x, y + base, xc, len); |
977 | } |
979 | } |
978 | else |
980 | else |
979 | { |
981 | { |
980 | clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
982 | clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); |
981 | |
983 | |
982 | XChangeGC (d.display->display, TGC, GCForeground | GCFont, &v); |
984 | XChangeGC (d.display->display, TGC, GCForeground | GCFont, &v); |
983 | |
985 | |
984 | if (slow) |
986 | if (slow) |
985 | { |
987 | { |
986 | do |
988 | do |
987 | { |
989 | { |
988 | if (xc->byte1 || xc->byte2) |
990 | if (xc->byte1 || xc->byte2) |
989 | XDrawString16 (d.display->display, d, TGC, x, y + base, xc, 1); |
991 | XDrawString16 (d.display->display, d, TGC, x, y + base, xc, 1); |
990 | |
992 | |
991 | x += r->TermWin.fwidth; |
993 | x += r->fwidth; |
992 | xc++; len--; |
994 | xc++; len--; |
993 | } |
995 | } |
994 | while (len); |
996 | while (len); |
995 | } |
997 | } |
996 | else |
998 | else |
… | |
… | |
1007 | XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v); |
1009 | XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v); |
1008 | XDrawImageString (d.display->display, d, TGC, x, y + base, xc, len); |
1010 | XDrawImageString (d.display->display, d, TGC, x, y + base, xc, len); |
1009 | } |
1011 | } |
1010 | else |
1012 | else |
1011 | { |
1013 | { |
1012 | clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
1014 | clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); |
1013 | |
1015 | |
1014 | XChangeGC (d.display->display, TGC, GCForeground | GCFont, &v); |
1016 | XChangeGC (d.display->display, TGC, GCForeground | GCFont, &v); |
1015 | |
1017 | |
1016 | if (slow) |
1018 | if (slow) |
1017 | { |
1019 | { |
1018 | do |
1020 | do |
1019 | { |
1021 | { |
1020 | if (*xc) |
1022 | if (*xc) |
1021 | XDrawString (d.display->display, d, TGC, x, y + base, xc, 1); |
1023 | XDrawString (d.display->display, d, TGC, x, y + base, xc, 1); |
1022 | |
1024 | |
1023 | x += r->TermWin.fwidth; |
1025 | x += r->fwidth; |
1024 | xc++; len--; |
1026 | xc++; len--; |
1025 | } |
1027 | } |
1026 | while (len); |
1028 | while (len); |
1027 | } |
1029 | } |
1028 | else |
1030 | else |
… | |
… | |
1096 | return false; |
1098 | return false; |
1097 | |
1099 | |
1098 | FcValue v; |
1100 | FcValue v; |
1099 | |
1101 | |
1100 | if (prop.height != rxvt_fontprop::unset |
1102 | if (prop.height != rxvt_fontprop::unset |
1101 | || (FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch |
1103 | && (FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch |
1102 | && FcPatternGet (p, FC_SIZE, 0, &v) != FcResultMatch)) |
1104 | && FcPatternGet (p, FC_SIZE, 0, &v) != FcResultMatch)) |
1103 | FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height); |
1105 | FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height); |
1104 | |
1106 | |
1105 | if (prop.weight != rxvt_fontprop::unset |
1107 | if (prop.weight != rxvt_fontprop::unset |
1106 | && FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch) |
1108 | && FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch) |
… | |
… | |
1152 | |
1154 | |
1153 | bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE; |
1155 | bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE; |
1154 | |
1156 | |
1155 | XftUnlockFace (f); |
1157 | XftUnlockFace (f); |
1156 | |
1158 | |
|
|
1159 | int glheight = height; |
|
|
1160 | |
1157 | for (uint16_t *t = extent_test_chars + NUM_EXTENT_TEST_CHARS; t-- > extent_test_chars; ) |
1161 | for (uint16_t *t = extent_test_chars + NUM_EXTENT_TEST_CHARS; t-- > extent_test_chars; ) |
1158 | { |
1162 | { |
1159 | FcChar16 ch = *t; |
1163 | FcChar16 ch = *t; |
1160 | |
1164 | |
1161 | if (cs != CS_UNICODE |
1165 | if (cs != CS_UNICODE |
… | |
… | |
1169 | continue; |
1173 | continue; |
1170 | |
1174 | |
1171 | XGlyphInfo g; |
1175 | XGlyphInfo g; |
1172 | XftTextExtents16 (disp, f, &ch, 1, &g); |
1176 | XftTextExtents16 (disp, f, &ch, 1, &g); |
1173 | |
1177 | |
|
|
1178 | g.width -= g.x; |
|
|
1179 | |
1174 | int wcw = wcwidth (ch); |
1180 | int wcw = wcwidth (ch); |
1175 | if (wcw > 0) g.width = g.width / wcw; |
1181 | if (wcw > 0) g.width = (g.width + wcw - 1) / wcw; |
1176 | |
1182 | |
1177 | if (width < g.width) width = g.width; |
1183 | if (width < g.width ) width = g.width; |
1178 | if (height < g.height) height = g.height; |
1184 | if (height < g.height ) height = g.height; |
|
|
1185 | if (glheight < g.height - g.y) glheight = g.height - g.y; |
|
|
1186 | } |
|
|
1187 | |
|
|
1188 | if (!width) |
|
|
1189 | { |
|
|
1190 | rxvt_warn ("unable to calculate font width for '%s', ignoring.\n", name); |
|
|
1191 | |
|
|
1192 | XftFontClose (disp, f); |
|
|
1193 | f = 0; |
|
|
1194 | |
|
|
1195 | success = false; |
|
|
1196 | break; |
1179 | } |
1197 | } |
1180 | |
1198 | |
1181 | if (prop.height == rxvt_fontprop::unset |
1199 | if (prop.height == rxvt_fontprop::unset |
1182 | || height <= prop.height |
1200 | || (height <= prop.height && glheight <= prop.height) |
1183 | || height <= 2 |
1201 | || height <= 2 |
1184 | || !scalable) |
1202 | || !scalable) |
1185 | break; |
1203 | break; |
1186 | |
1204 | |
1187 | if (ftheight) |
1205 | if (ftheight) |
… | |
… | |
1194 | ftheight -= height - prop.height; |
1212 | ftheight -= height - prop.height; |
1195 | } |
1213 | } |
1196 | else |
1214 | else |
1197 | ftheight = prop.height - 1; |
1215 | ftheight = prop.height - 1; |
1198 | |
1216 | |
1199 | XftFontClose (disp, f); |
1217 | XftFontClose (disp, f); |
1200 | FcPatternDel (match, FC_PIXEL_SIZE); |
1218 | FcPatternDel (match, FC_PIXEL_SIZE); |
1201 | FcPatternAddInteger (match, FC_PIXEL_SIZE, ftheight); |
1219 | FcPatternAddInteger (match, FC_PIXEL_SIZE, ftheight); |
1202 | } |
1220 | } |
1203 | |
1221 | |
1204 | FcPatternDestroy (match); |
1222 | FcPatternDestroy (match); |
1205 | |
1223 | |
1206 | #if 0 // do it per-character |
1224 | #if 0 // do it per-character |
… | |
… | |
1228 | // check character against base font bounding box |
1246 | // check character against base font bounding box |
1229 | FcChar32 ch = unicode; |
1247 | FcChar32 ch = unicode; |
1230 | XGlyphInfo g; |
1248 | XGlyphInfo g; |
1231 | XftTextExtents32 (DISPLAY, f, &ch, 1, &g); |
1249 | XftTextExtents32 (DISPLAY, f, &ch, 1, &g); |
1232 | |
1250 | |
1233 | int w = g.width; |
1251 | int w = g.width - g.x; |
1234 | int wcw = wcwidth (unicode); |
1252 | int wcw = wcwidth (unicode); |
1235 | if (wcw > 0) w /= wcw; |
1253 | if (wcw > 0) w = (w + wcw - 1) / wcw; |
1236 | |
1254 | |
1237 | careful = w > prop->width; |
1255 | careful = w > prop->width; |
1238 | if (careful && w > prop->width * MAX_OVERLAP >> 2) |
1256 | if (careful && w > prop->width * MAX_OVERLAP >> 2) |
1239 | return false; |
1257 | return false; |
1240 | |
1258 | |
… | |
… | |
1244 | void |
1262 | void |
1245 | rxvt_font_xft::draw (rxvt_drawable &d, int x, int y, |
1263 | rxvt_font_xft::draw (rxvt_drawable &d, int x, int y, |
1246 | const text_t *text, int len, |
1264 | const text_t *text, int len, |
1247 | int fg, int bg) |
1265 | int fg, int bg) |
1248 | { |
1266 | { |
1249 | clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
1267 | clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); |
1250 | |
1268 | |
1251 | int base = ascent; // should be fbase, but that is incorrect |
1269 | int base = ascent; // should be fbase, but that is incorrect |
1252 | |
1270 | |
1253 | XGlyphInfo extents; |
1271 | XGlyphInfo extents; |
1254 | FcChar32 *enc = (FcChar32 *) get_enc_buf (len * sizeof (FcChar32)); |
1272 | FcChar32 *enc = (FcChar32 *) get_enc_buf (len * sizeof (FcChar32)); |
1255 | FcChar32 *ep = enc; |
1273 | FcChar32 *ep = enc; |
1256 | int ewidth = 0; |
1274 | int ewidth = 0; |
1257 | int xoff = 0; |
|
|
1258 | |
1275 | |
1259 | while (len) |
1276 | while (len) |
1260 | { |
1277 | { |
1261 | int cwidth = r->TermWin.fwidth; |
1278 | int cwidth = r->fwidth; |
1262 | FcChar32 fc = *text++; len--; |
1279 | FcChar32 fc = *text++; len--; |
1263 | FT_UInt gl; |
|
|
1264 | |
1280 | |
1265 | while (len && *text == NOCHAR) |
1281 | while (len && *text == NOCHAR) |
1266 | text++, len--, cwidth += r->TermWin.fwidth; |
1282 | text++, len--, cwidth += r->fwidth; |
1267 | |
1283 | |
1268 | gl = XftCharIndex (d.display->display, f, fc); |
|
|
1269 | XftGlyphExtents (d.display->display, f, &gl, 1, &extents); |
|
|
1270 | |
|
|
1271 | if (extents.xOff != cwidth && ep != enc) |
|
|
1272 | { |
|
|
1273 | if (xoff > ewidth) xoff = ewidth; |
|
|
1274 | XftDrawGlyphs (d, &r->pix_colors[fg].c, f, |
|
|
1275 | x + (ewidth - xoff >> 1), |
|
|
1276 | y + base, enc, ep - enc); |
|
|
1277 | x += ewidth; |
|
|
1278 | |
|
|
1279 | ep = enc; |
|
|
1280 | ewidth = 0; |
|
|
1281 | xoff = 0; |
|
|
1282 | } |
|
|
1283 | |
|
|
1284 | if (fc == ' ' && ep == enc) // skip leading spaces |
1284 | if (fc == ' ' && ep == enc) // skip leading spaces |
1285 | { |
|
|
1286 | x += cwidth; |
1285 | x += cwidth; |
1287 | continue; |
|
|
1288 | } |
|
|
1289 | |
|
|
1290 | else |
1286 | else |
1291 | { |
1287 | { |
|
|
1288 | FT_UInt gl = XftCharIndex (d.display->display, f, fc); |
|
|
1289 | XftGlyphExtents (d.display->display, f, &gl, 1, &extents); |
|
|
1290 | |
|
|
1291 | if (extents.xOff != cwidth) |
|
|
1292 | { |
|
|
1293 | if (ewidth) |
|
|
1294 | { |
|
|
1295 | XftDrawGlyphs (d, &r->pix_colors[fg].c, f, |
|
|
1296 | x, y + base, enc, ep - enc); |
|
|
1297 | x += ewidth; |
|
|
1298 | |
|
|
1299 | ep = enc; |
|
|
1300 | ewidth = 0; |
|
|
1301 | } |
|
|
1302 | |
|
|
1303 | if (extents.xOff > cwidth) |
|
|
1304 | extents.xOff = cwidth; |
|
|
1305 | |
|
|
1306 | XftDrawGlyphs (d, &r->pix_colors[fg].c, f, |
|
|
1307 | x + (cwidth - extents.xOff >> 1), |
|
|
1308 | y + base, &gl, 1); |
|
|
1309 | x += cwidth; |
|
|
1310 | } |
|
|
1311 | else |
|
|
1312 | { |
1292 | *ep++ = gl; |
1313 | *ep++ = gl; |
1293 | ewidth += cwidth; |
1314 | ewidth += cwidth; |
1294 | xoff += extents.xOff; |
1315 | } |
1295 | } |
1316 | } |
1296 | } |
1317 | } |
1297 | |
1318 | |
1298 | if (ep != enc) |
1319 | if (ep != enc) |
1299 | { |
|
|
1300 | if (xoff > ewidth) xoff = ewidth; |
|
|
1301 | XftDrawGlyphs (d, &r->pix_colors[fg].c, f, |
1320 | XftDrawGlyphs (d, &r->pix_colors[fg].c, f, |
1302 | x + (ewidth - xoff >> 1), |
|
|
1303 | y + base, enc, ep - enc); |
1321 | x, y + base, enc, ep - enc); |
1304 | } |
|
|
1305 | } |
1322 | } |
1306 | #endif |
1323 | #endif |
1307 | |
1324 | |
1308 | ///////////////////////////////////////////////////////////////////////////// |
1325 | ///////////////////////////////////////////////////////////////////////////// |
1309 | |
1326 | |
1310 | rxvt_fontset::rxvt_fontset (rxvt_t r) |
1327 | rxvt_fontset::rxvt_fontset (rxvt_t r) |
1311 | : r (r), fontdesc (0) |
1328 | : fontdesc (0), r (r) |
1312 | { |
1329 | { |
1313 | clear (); |
1330 | clear (); |
1314 | } |
1331 | } |
1315 | |
1332 | |
1316 | rxvt_fontset::~rxvt_fontset () |
1333 | rxvt_fontset::~rxvt_fontset () |