xterm/xterm-double_width_fonts.patch
Marcus Meissner 884b572c79 Accepting request 1114902 from home:polslinux:branches:X11:terminals
- update to 385:
  * fixes for ReGIS (report by Ben Wong).
    + correct conversion from HLS to RGB
    + improve font-caching performance.
  * update tables in wcwidth.c based on Unicode 15.1.0
  * improve fastScroll resource:
    + suppress screen-refreshes for carriage-returns
    + add -jf option to simplify use of this resource.
    + add a control sequence for enabling/disabling the resource.
    + enable this feature by default
  * extend  title-stack  feature  to  allow  an additional parameter to
    directly  access  the  stack, like the XTPUSHCOLORS and XTPOPCOLORS
    feature.
  * correct  size  and  position of box shown for double-cell character
    which  happens  to be missing from the bitmap font (report by Peter
    Fabinski).
  * improved configure script:
    + add  pattern for uClibc-ng to CF_XOPEN_SOURCE (report/patch by
      Waldemar Brodkorb).
    + add configure options --with-utmp-path and --with-wtmp-path to
      override  configure  script's  check  for  utmp/wtmp pathnames
      which are shown in the manual (Debian #1042767).
    + CF_XOPEN_SOURCE  provides  for  defining  _DEFAULT_SOURCE  for
      MinGW32 and MinGW64.
    + sed expression used to report gcc version now works with MinGW
  * ensure   that  line-attributes  are  reset  after  drawing  missing
    character (report by Christian Weisgerber).
  * update config.guess, config.sub
- rebased all patches

OBS-URL: https://build.opensuse.org/request/show/1114902
OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=226
2023-10-03 14:04:15 +00:00

82 lines
3.0 KiB
Diff

# HG changeset patch
# Parent 682df5267f4b25286ab78bfbbfd91fe664cbbd21
Index: xterm-385/fontutils.c
===================================================================
--- xterm-385.orig/fontutils.c
+++ xterm-385/fontutils.c
@@ -883,67 +883,19 @@ is_double_width_font(XFontStruct *fs)
#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