346ba2ee12
- Patch #313 - 2014/11/28 * add regisScreenSize resource setting to allow custom screensizes for ReGIS graphics (prompted by discussion with Scott Froebe). * fix some minor issues in manpage (Jens Schweikhardt). * improve ReGIS font-handling (Ross Combs): + remove "random junk" generation for unknown characters + add xterm extension to load user glyphs for alphabet 0 + add xterm extension to specify loading an alphabet from a font by name + fix bug with use of empty alphabet slots which caused slot 0 to be clobbered + update/clarify ReGIS-related comments + add DECprint extension for printing/clearing the screen (only clearing is performed) * improve ReGIS colorspec conversion (Ross Combs): + avoid some floating point math for colorspace conversion + move two copies of colorspec parsing to a single function + change colorspec parsing to handle components being out of order or with spaces and commas between them + add support for an extension where RGB components can be given instead of HLS * improve use of const, e.g., for the LineData pointers (patch by Ross Combs). * clip of graphics that overlap the scrollback buffer and alt screen (patch by Ross Combs). * amend change to focus-change events in patch #287 to limit it to suppressing the reset of the urgency-hint, because some useful FocusOut events were lost (report by Joe Peterson). * modify dpkg build-script to configure xterm-dev as an OBS-URL: https://build.opensuse.org/request/show/279963 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=124
89 lines
3.1 KiB
Diff
89 lines
3.1 KiB
Diff
diff --git a/fontutils.c b/fontutils.c
|
|
--- a/fontutils.c
|
|
+++ b/fontutils.c
|
|
@@ -690,77 +690,29 @@ is_double_width_font(XFontStruct *fs)
|
|
{
|
|
return ((2 * fs->min_bounds.width) == fs->max_bounds.width);
|
|
}
|
|
#else
|
|
#define is_double_width_font(fs) 0
|
|
#endif
|
|
|
|
#if OPT_WIDE_CHARS && OPT_RENDERFONT && defined(HAVE_TYPE_FCCHAR32)
|
|
-#define HALF_WIDTH_TEST_STRING "1234567890"
|
|
-
|
|
-/* '1234567890' in Chinese characters in UTF-8 */
|
|
-#define FULL_WIDTH_TEST_STRING "\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89" \
|
|
- "\xe5\x9b\x9b\xe4\xba\x94" \
|
|
- "\xef\xa7\x91\xe4\xb8\x83\xe5\x85\xab" \
|
|
- "\xe4\xb9\x9d\xef\xa6\xb2"
|
|
-
|
|
-/* '1234567890' in Korean script in UTF-8 */
|
|
-#define FULL_WIDTH_TEST_STRING2 "\xec\x9d\xbc\xec\x9d\xb4\xec\x82\xbc" \
|
|
- "\xec\x82\xac\xec\x98\xa4" \
|
|
- "\xec\x9c\xa1\xec\xb9\xa0\xed\x8c\x94" \
|
|
- "\xea\xb5\xac\xec\x98\x81"
|
|
-
|
|
-#define HALF_WIDTH_CHAR1 0x0031 /* '1' */
|
|
-#define HALF_WIDTH_CHAR2 0x0057 /* 'W' */
|
|
+
|
|
#define FULL_WIDTH_CHAR1 0x4E00 /* CJK Ideograph 'number one' */
|
|
#define FULL_WIDTH_CHAR2 0xAC00 /* Korean script syllable 'Ka' */
|
|
|
|
static Bool
|
|
is_double_width_font_xft(Display *dpy, XftFont *font)
|
|
{
|
|
- XGlyphInfo gi1, gi2;
|
|
- FcChar32 c1 = HALF_WIDTH_CHAR1, c2 = HALF_WIDTH_CHAR2;
|
|
- String fwstr = FULL_WIDTH_TEST_STRING;
|
|
- String hwstr = HALF_WIDTH_TEST_STRING;
|
|
-
|
|
- /* Some Korean fonts don't have Chinese characters at all. */
|
|
- if (!XftCharExists(dpy, font, FULL_WIDTH_CHAR1)) {
|
|
- if (!XftCharExists(dpy, font, FULL_WIDTH_CHAR2))
|
|
- return False; /* Not a CJK font */
|
|
- else /* a Korean font without CJK Ideographs */
|
|
- fwstr = FULL_WIDTH_TEST_STRING2;
|
|
- }
|
|
-
|
|
- XftTextExtents32(dpy, font, &c1, 1, &gi1);
|
|
- XftTextExtents32(dpy, font, &c2, 1, &gi2);
|
|
- if (gi1.xOff != gi2.xOff) /* Not a fixed-width font */
|
|
- return False;
|
|
-
|
|
- XftTextExtentsUtf8(dpy,
|
|
- font,
|
|
- (_Xconst FcChar8 *) hwstr,
|
|
- (int) strlen(hwstr),
|
|
- &gi1);
|
|
- XftTextExtentsUtf8(dpy,
|
|
- font,
|
|
- (_Xconst FcChar8 *) fwstr,
|
|
- (int) strlen(fwstr),
|
|
- &gi2);
|
|
-
|
|
- /*
|
|
- * fontconfig and Xft prior to 2.2(?) set the width of half-width
|
|
- * characters identical to that of full-width character in CJK double-width
|
|
- * (bi-width / monospace) font even though the former is half as wide as
|
|
- * the latter. This was fixed sometime before the release of fontconfig
|
|
- * 2.2 in early 2003. See
|
|
- * http://bugzilla.mozilla.org/show_bug.cgi?id=196312
|
|
- * In the meantime, we have to check both possibilities.
|
|
- */
|
|
- return ((2 * gi1.xOff == gi2.xOff) || (gi1.xOff == gi2.xOff));
|
|
+ /* Some Korean fonts don't have Chinese characters at all. */
|
|
+ if (XftCharExists(dpy, font, FULL_WIDTH_CHAR1) ||
|
|
+ XftCharExists(dpy, font, FULL_WIDTH_CHAR2))
|
|
+ return True; /* CJK font */
|
|
+ else
|
|
+ return False; /* Not a CJK font */
|
|
}
|
|
#else
|
|
#define is_double_width_font_xft(dpy, xftfont) 0
|
|
#endif
|
|
|
|
#define EmptyFont(fs) (fs != 0 \
|
|
&& ((fs)->ascent + (fs)->descent == 0 \
|
|
|| (fs)->max_bounds.width == 0))
|