xterm/xterm-double_width_fonts.patch

89 lines
3.1 KiB
Diff
Raw Normal View History

diff --git a/fontutils.c b/fontutils.c
--- a/fontutils.c
+++ b/fontutils.c
@@ -702,77 +702,29 @@ is_double_width_font(XFontStruct *fs)
Accepting request 85817 from home:pcerny:factory - Patch #275 - 2011/09/11 * add ash, zsh to known shells for resize. * modify resize to reuse the logic from xterm which determines the actual logon-user's shell if $SHELL is not set. * revert the unsetenv("SHELL") added in patch #272. * an unsetenv("SHELL") added in patch #272 to help ensure that luit would get the user's shell consistently did not work as expected for cases where multiple names are in the password-file for a given uid. That was because changes in patch #157 to handle this situation did not take into account that repeated calls to getpwnam and getpwuid return a pointer to the same static buffer. Fixed the older logic to work as intended, by ensuring that the passwd-data from each call is stored separately (report by Paul Keusemann). * adjust ifdef's for putenv and unsetenv in case only one of those is provided on a given platform. * correct comparison used in ExposeContains macro from patch #274 changes, to handle window-dragging (patch by Todd Eigenschink). - Patch #274 - 2011/09/05 * portability fixes for cygwin: do not define SVR4, and work around nonstandard header location. * ifdef'd use of unsetenv from patch #273 changes to work with Solaris 9 (report by Waldemar Rachwal). * modify logic for XtAppPending to merge adjacent Expose and ConfigureNotify events which are redundant (report by Edward McGuire). * fix an unneeded warning message when -r option is given. * remove a few redundant entries from table used for helping OBS-URL: https://build.opensuse.org/request/show/85817 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=25
2011-10-12 07:21:46 +00:00
{
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"
Accepting request 232778 from home:pcerny:factory - Patch #304 - 2014/05/03 * add debugging check for parsing table entries, fixed a few inconsistencies. * handle utmp/utmpx strings consistently with new function that null-pads unused locations. * build-fix for imake configuration with FreeBSD 9 and later, to account for replacing utmp with utmpx. * improve handling of the fontsel (font-selection) menu item: + initialize the menu entry differently if the toolbar configuration is used, i.e., enabling it without attempting to use the current selection as a font name. Because of the way in which the toolbar is setup, this attempt usually failed, and would result in a warning. + if the menu action fails, e.g., no font can be loaded for the given selected name, then recover by resuming with the current font. Before, the recovery went to the default font. That was done to work around missing bitmap font in patch #276. * document OSC 119 in the control sequences listing (report by Egmont Koblinger). * modify special handling of XF86Paste or SunPaste keysyms (see patch #227) to use the standard shift/lock modifiers in case those are, for example, used in level 3 in an XKB file (patch by Matthieu Herrb). * configure macro updates: + drop the -no-gcc option from CF_INTEL_COMPILER + modify CF_XOPEN_SOURCE to suppress the check for defining _XOPEN_SOURCE on Solaris * reduce bss storage used for ReGIS/Sixel modules, as well as cleanup storage usage in other modules. OBS-URL: https://build.opensuse.org/request/show/232778 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=92
2014-05-05 22:05:44 +00:00
-
-/* '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' */
Accepting request 232778 from home:pcerny:factory - Patch #304 - 2014/05/03 * add debugging check for parsing table entries, fixed a few inconsistencies. * handle utmp/utmpx strings consistently with new function that null-pads unused locations. * build-fix for imake configuration with FreeBSD 9 and later, to account for replacing utmp with utmpx. * improve handling of the fontsel (font-selection) menu item: + initialize the menu entry differently if the toolbar configuration is used, i.e., enabling it without attempting to use the current selection as a font name. Because of the way in which the toolbar is setup, this attempt usually failed, and would result in a warning. + if the menu action fails, e.g., no font can be loaded for the given selected name, then recover by resuming with the current font. Before, the recovery went to the default font. That was done to work around missing bitmap font in patch #276. * document OSC 119 in the control sequences listing (report by Egmont Koblinger). * modify special handling of XF86Paste or SunPaste keysyms (see patch #227) to use the standard shift/lock modifiers in case those are, for example, used in level 3 in an XKB file (patch by Matthieu Herrb). * configure macro updates: + drop the -no-gcc option from CF_INTEL_COMPILER + modify CF_XOPEN_SOURCE to suppress the check for defining _XOPEN_SOURCE on Solaris * reduce bss storage used for ReGIS/Sixel modules, as well as cleanup storage usage in other modules. OBS-URL: https://build.opensuse.org/request/show/232778 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=92
2014-05-05 22:05:44 +00:00
+
#define FULL_WIDTH_CHAR1 0x4E00 /* CJK Ideograph 'number one' */
#define FULL_WIDTH_CHAR2 0xAC00 /* Korean script syllable 'Ka' */
static Bool
Accepting request 232778 from home:pcerny:factory - Patch #304 - 2014/05/03 * add debugging check for parsing table entries, fixed a few inconsistencies. * handle utmp/utmpx strings consistently with new function that null-pads unused locations. * build-fix for imake configuration with FreeBSD 9 and later, to account for replacing utmp with utmpx. * improve handling of the fontsel (font-selection) menu item: + initialize the menu entry differently if the toolbar configuration is used, i.e., enabling it without attempting to use the current selection as a font name. Because of the way in which the toolbar is setup, this attempt usually failed, and would result in a warning. + if the menu action fails, e.g., no font can be loaded for the given selected name, then recover by resuming with the current font. Before, the recovery went to the default font. That was done to work around missing bitmap font in patch #276. * document OSC 119 in the control sequences listing (report by Egmont Koblinger). * modify special handling of XF86Paste or SunPaste keysyms (see patch #227) to use the standard shift/lock modifiers in case those are, for example, used in level 3 in an XKB file (patch by Matthieu Herrb). * configure macro updates: + drop the -no-gcc option from CF_INTEL_COMPILER + modify CF_XOPEN_SOURCE to suppress the check for defining _XOPEN_SOURCE on Solaris * reduce bss storage used for ReGIS/Sixel modules, as well as cleanup storage usage in other modules. OBS-URL: https://build.opensuse.org/request/show/232778 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=92
2014-05-05 22:05:44 +00:00
is_double_width_font_xft(Display *dpy, XftFont *font)
{
- XGlyphInfo gi1, gi2;
- FcChar32 c1 = HALF_WIDTH_CHAR1, c2 = HALF_WIDTH_CHAR2;
Accepting request 85817 from home:pcerny:factory - Patch #275 - 2011/09/11 * add ash, zsh to known shells for resize. * modify resize to reuse the logic from xterm which determines the actual logon-user's shell if $SHELL is not set. * revert the unsetenv("SHELL") added in patch #272. * an unsetenv("SHELL") added in patch #272 to help ensure that luit would get the user's shell consistently did not work as expected for cases where multiple names are in the password-file for a given uid. That was because changes in patch #157 to handle this situation did not take into account that repeated calls to getpwnam and getpwuid return a pointer to the same static buffer. Fixed the older logic to work as intended, by ensuring that the passwd-data from each call is stored separately (report by Paul Keusemann). * adjust ifdef's for putenv and unsetenv in case only one of those is provided on a given platform. * correct comparison used in ExposeContains macro from patch #274 changes, to handle window-dragging (patch by Todd Eigenschink). - Patch #274 - 2011/09/05 * portability fixes for cygwin: do not define SVR4, and work around nonstandard header location. * ifdef'd use of unsetenv from patch #273 changes to work with Solaris 9 (report by Waldemar Rachwal). * modify logic for XtAppPending to merge adjacent Expose and ConfigureNotify events which are redundant (report by Edward McGuire). * fix an unneeded warning message when -r option is given. * remove a few redundant entries from table used for helping OBS-URL: https://build.opensuse.org/request/show/85817 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=25
2011-10-12 07:21:46 +00:00
- String fwstr = FULL_WIDTH_TEST_STRING;
- String hwstr = HALF_WIDTH_TEST_STRING;
-
Accepting request 232778 from home:pcerny:factory - Patch #304 - 2014/05/03 * add debugging check for parsing table entries, fixed a few inconsistencies. * handle utmp/utmpx strings consistently with new function that null-pads unused locations. * build-fix for imake configuration with FreeBSD 9 and later, to account for replacing utmp with utmpx. * improve handling of the fontsel (font-selection) menu item: + initialize the menu entry differently if the toolbar configuration is used, i.e., enabling it without attempting to use the current selection as a font name. Because of the way in which the toolbar is setup, this attempt usually failed, and would result in a warning. + if the menu action fails, e.g., no font can be loaded for the given selected name, then recover by resuming with the current font. Before, the recovery went to the default font. That was done to work around missing bitmap font in patch #276. * document OSC 119 in the control sequences listing (report by Egmont Koblinger). * modify special handling of XF86Paste or SunPaste keysyms (see patch #227) to use the standard shift/lock modifiers in case those are, for example, used in level 3 in an XKB file (patch by Matthieu Herrb). * configure macro updates: + drop the -no-gcc option from CF_INTEL_COMPILER + modify CF_XOPEN_SOURCE to suppress the check for defining _XOPEN_SOURCE on Solaris * reduce bss storage used for ReGIS/Sixel modules, as well as cleanup storage usage in other modules. OBS-URL: https://build.opensuse.org/request/show/232778 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=92
2014-05-05 22:05:44 +00:00
- /* 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;
-
Accepting request 85817 from home:pcerny:factory - Patch #275 - 2011/09/11 * add ash, zsh to known shells for resize. * modify resize to reuse the logic from xterm which determines the actual logon-user's shell if $SHELL is not set. * revert the unsetenv("SHELL") added in patch #272. * an unsetenv("SHELL") added in patch #272 to help ensure that luit would get the user's shell consistently did not work as expected for cases where multiple names are in the password-file for a given uid. That was because changes in patch #157 to handle this situation did not take into account that repeated calls to getpwnam and getpwuid return a pointer to the same static buffer. Fixed the older logic to work as intended, by ensuring that the passwd-data from each call is stored separately (report by Paul Keusemann). * adjust ifdef's for putenv and unsetenv in case only one of those is provided on a given platform. * correct comparison used in ExposeContains macro from patch #274 changes, to handle window-dragging (patch by Todd Eigenschink). - Patch #274 - 2011/09/05 * portability fixes for cygwin: do not define SVR4, and work around nonstandard header location. * ifdef'd use of unsetenv from patch #273 changes to work with Solaris 9 (report by Waldemar Rachwal). * modify logic for XtAppPending to merge adjacent Expose and ConfigureNotify events which are redundant (report by Edward McGuire). * fix an unneeded warning message when -r option is given. * remove a few redundant entries from table used for helping OBS-URL: https://build.opensuse.org/request/show/85817 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=25
2011-10-12 07:21:46 +00:00
- 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));
Accepting request 232778 from home:pcerny:factory - Patch #304 - 2014/05/03 * add debugging check for parsing table entries, fixed a few inconsistencies. * handle utmp/utmpx strings consistently with new function that null-pads unused locations. * build-fix for imake configuration with FreeBSD 9 and later, to account for replacing utmp with utmpx. * improve handling of the fontsel (font-selection) menu item: + initialize the menu entry differently if the toolbar configuration is used, i.e., enabling it without attempting to use the current selection as a font name. Because of the way in which the toolbar is setup, this attempt usually failed, and would result in a warning. + if the menu action fails, e.g., no font can be loaded for the given selected name, then recover by resuming with the current font. Before, the recovery went to the default font. That was done to work around missing bitmap font in patch #276. * document OSC 119 in the control sequences listing (report by Egmont Koblinger). * modify special handling of XF86Paste or SunPaste keysyms (see patch #227) to use the standard shift/lock modifiers in case those are, for example, used in level 3 in an XKB file (patch by Matthieu Herrb). * configure macro updates: + drop the -no-gcc option from CF_INTEL_COMPILER + modify CF_XOPEN_SOURCE to suppress the check for defining _XOPEN_SOURCE on Solaris * reduce bss storage used for ReGIS/Sixel modules, as well as cleanup storage usage in other modules. OBS-URL: https://build.opensuse.org/request/show/232778 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=92
2014-05-05 22:05:44 +00:00
+ /* 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
Accepting request 85817 from home:pcerny:factory - Patch #275 - 2011/09/11 * add ash, zsh to known shells for resize. * modify resize to reuse the logic from xterm which determines the actual logon-user's shell if $SHELL is not set. * revert the unsetenv("SHELL") added in patch #272. * an unsetenv("SHELL") added in patch #272 to help ensure that luit would get the user's shell consistently did not work as expected for cases where multiple names are in the password-file for a given uid. That was because changes in patch #157 to handle this situation did not take into account that repeated calls to getpwnam and getpwuid return a pointer to the same static buffer. Fixed the older logic to work as intended, by ensuring that the passwd-data from each call is stored separately (report by Paul Keusemann). * adjust ifdef's for putenv and unsetenv in case only one of those is provided on a given platform. * correct comparison used in ExposeContains macro from patch #274 changes, to handle window-dragging (patch by Todd Eigenschink). - Patch #274 - 2011/09/05 * portability fixes for cygwin: do not define SVR4, and work around nonstandard header location. * ifdef'd use of unsetenv from patch #273 changes to work with Solaris 9 (report by Waldemar Rachwal). * modify logic for XtAppPending to merge adjacent Expose and ConfigureNotify events which are redundant (report by Edward McGuire). * fix an unneeded warning message when -r option is given. * remove a few redundant entries from table used for helping OBS-URL: https://build.opensuse.org/request/show/85817 OBS-URL: https://build.opensuse.org/package/show/X11:terminals/xterm?expand=0&rev=25
2011-10-12 07:21:46 +00:00
#endif
#define EmptyFont(fs) (fs != 0 \
&& ((fs)->ascent + (fs)->descent == 0 \
|| (fs)->max_bounds.width == 0))