ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtfont.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtfont.C (file contents):
Revision 1.223 by sf-exg, Sat Aug 19 17:44:35 2023 UTC vs.
Revision 1.224 by root, Thu Jan 4 19:52:37 2024 UTC

152 { CS_UNKNOWN, 0 } 152 { CS_UNKNOWN, 0 }
153}; 153};
154 154
155// these characters are used to guess the font height and width 155// these characters are used to guess the font height and width
156// pango uses a similar algorithm and doesn't trust the font either. 156// pango uses a similar algorithm and doesn't trust the font either.
157static uint16_t extent_test_chars[] = { 157static uint32_t extent_test_chars[] = {
158 '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_', 158 '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_',
159 0x00cd, 0x00d5, 0x0114, 0x0177, 0x0643, // ÍÕĔŷﻙ 159 0x00cd, 0x00d5, 0x0114, 0x0177, 0x0643, // ÍÕĔŷﻙ
160 0x304c, 0x672c, // が本 160 0x304c, 0x672c, // が本
161 0x1f600, // 😀
161}; 162};
162 163
163#define dTermDisplay Display *disp = term->dpy 164#define dTermDisplay Display *disp = term->dpy
164#define dTermGC GC gc = term->gc 165#define dTermGC GC gc = term->gc
165 166
936 } 937 }
937#endif 938#endif
938 939
939 width = 1; 940 width = 1;
940 941
941 for (uint16_t *t = extent_test_chars; t < extent_test_chars + ecb_array_length (extent_test_chars); t++) 942 for (uint32_t *t = extent_test_chars; t < extent_test_chars + ecb_array_length (extent_test_chars); t++)
942 { 943 {
943 if (FROM_UNICODE (cs, *t) == NOCHAR) 944 if (FROM_UNICODE (cs, *t) == NOCHAR)
944 continue; 945 continue;
945 946
946 // ignore characters we wouldn't use anyways 947 // ignore characters we wouldn't use anyways
1285 1286
1286 XftUnlockFace (f); 1287 XftUnlockFace (f);
1287 1288
1288 int glheight = height; 1289 int glheight = height;
1289 1290
1290 for (uint16_t *t = extent_test_chars; t < extent_test_chars + ecb_array_length (extent_test_chars); t++) 1291 for (uint32_t *t = extent_test_chars; t < extent_test_chars + ecb_array_length (extent_test_chars); t++)
1291 { 1292 {
1292 FcChar16 ch = *t; 1293 FcChar32 ch = *t;
1293 1294
1294 if (cs != CS_UNICODE 1295 if (cs != CS_UNICODE
1295 && ch > 0x100 1296 && ch > 0x100
1296 && FROM_UNICODE (cs, ch) == NOCHAR) 1297 && FROM_UNICODE (cs, ch) == NOCHAR)
1297 continue; 1298 continue;
1300 bool careful; 1301 bool careful;
1301 if (!has_char (*t, &prop, careful)) 1302 if (!has_char (*t, &prop, careful))
1302 continue; 1303 continue;
1303 1304
1304 XGlyphInfo g; 1305 XGlyphInfo g;
1305 XftTextExtents16 (disp, f, &ch, 1, &g); 1306 XftTextExtents32 (disp, f, &ch, 1, &g);
1306 1307
1307 g.width -= g.x; 1308 g.width -= g.x;
1308 1309
1309 int wcw = WCWIDTH (ch); 1310 int wcw = WCWIDTH (ch);
1310 if (wcw > 0) g.width = (g.width + wcw - 1) / wcw; 1311 if (wcw > 0) g.width = (g.width + wcw - 1) / wcw;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines