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.221 by root, Thu Aug 26 03:58:29 2021 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
517 } 518 }
518 519
519 bool load (const rxvt_fontprop &prop, bool force_prop) 520 bool load (const rxvt_fontprop &prop, bool force_prop)
520 { 521 {
521 width = 1; height = 1; 522 width = 1; height = 1;
522 ascent = 1; descent = 0; 523 ascent = 1;
524 descent = (*fs)[2]->descent;
523 525
524 set_name (strdup ("built-in rendition overflow font")); 526 set_name (strdup ("built-in rendition overflow font"));
525 527
526 return true; 528 return true;
527 } 529 }
935 } 937 }
936#endif 938#endif
937 939
938 width = 1; 940 width = 1;
939 941
940 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++)
941 { 943 {
942 if (FROM_UNICODE (cs, *t) == NOCHAR) 944 if (FROM_UNICODE (cs, *t) == NOCHAR)
943 continue; 945 continue;
944 946
945 // ignore characters we wouldn't use anyways 947 // ignore characters we wouldn't use anyways
1264 } 1266 }
1265 1267
1266 FT_Face face = XftLockFace (f); 1268 FT_Face face = XftLockFace (f);
1267 1269
1268 // fuck me plenty: XftLockFace can actually return 0. try not to crash. 1270 // fuck me plenty: XftLockFace can actually return 0. try not to crash.
1269 // we also assume blindly that if the first lock succeeeds, then subsequent 1271 // we also assume blindly that if the first lock succeeds, then subsequent
1270 // locks will also succeed. 1272 // locks will also succeed.
1271 if (!face) 1273 if (!face)
1272 { 1274 {
1273 XftFontClose (disp, f); 1275 XftFontClose (disp, f);
1274 success = false; 1276 success = false;
1284 1286
1285 XftUnlockFace (f); 1287 XftUnlockFace (f);
1286 1288
1287 int glheight = height; 1289 int glheight = height;
1288 1290
1289 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++)
1290 { 1292 {
1291 FcChar16 ch = *t; 1293 FcChar32 ch = *t;
1292 1294
1293 if (cs != CS_UNICODE 1295 if (cs != CS_UNICODE
1294 && ch > 0x100 1296 && ch > 0x100
1295 && FROM_UNICODE (cs, ch) == NOCHAR) 1297 && FROM_UNICODE (cs, ch) == NOCHAR)
1296 continue; 1298 continue;
1299 bool careful; 1301 bool careful;
1300 if (!has_char (*t, &prop, careful)) 1302 if (!has_char (*t, &prop, careful))
1301 continue; 1303 continue;
1302 1304
1303 XGlyphInfo g; 1305 XGlyphInfo g;
1304 XftTextExtents16 (disp, f, &ch, 1, &g); 1306 XftTextExtents32 (disp, f, &ch, 1, &g);
1305 1307
1306 g.width -= g.x; 1308 g.width -= g.x;
1307 1309
1308 int wcw = WCWIDTH (ch); 1310 int wcw = WCWIDTH (ch);
1309 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