From: Yichao Yu <yyc1992@gmail.com>
To: 10867@debbugs.gnu.org
Cc: Xuetian Weng <wengxt@gmail.com>
Subject: bug#10867: 26.3; XIM preedit/status font handling
Date: Sun, 2 Aug 2020 16:07:26 -0400 [thread overview]
Message-ID: <CAMvDr+SOkjexcBgeiFbmU+Tb9XXgG=zmMmc4b=UK+2Dpcvcbrw@mail.gmail.com> (raw)
In-Reply-To: <CAMvDr+Q_T4RZt4QrR79bGoZWwmHE9ai6yhVDKDgb-3j77KqnPQ@mail.gmail.com>
> ## What other programs do
> * xterm seems to use "fixed" to lookup font
> * qt4 https://dreamswork.github.io/qt4/qximinputcontext__x11_8cpp_source.html
> AFAICT uses different fonts?
> * gtk I don't actually see where it set fonts...
> @Xuetian Weng dug deeper into this
>
> ## Fix
> I'm not sure what's the correct one. It seems that setting the fontSet
> is necessary although I'm not sure how/if gtk get away with it.
> According to @Xuetian Weng virtually no one use this setting anymore
> so setting a dummy value to comfort xlib might be good enough? It
> would avoid both issues at the same time.
And since it's basically a useless setting at this point, this fix seems to work
diff --git a/src/xfns.c b/src/xfns.c
index 2ab5080d97..fbbc429fe1 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2511,72 +2511,19 @@ xic_create_xfontset (struct frame *f)
if (! xfs)
{
- char buf[256];
char **missing_list;
int missing_count;
char *def_string;
- const char *xlfd_format = "-*-*-medium-r-normal--%d-*-*-*-*-*";
+ const char *last_resort = "fixed";
- sprintf (buf, xlfd_format, pixel_size);
missing_list = NULL;
- xfs = XCreateFontSet (FRAME_X_DISPLAY (f), buf,
+ xfs = XCreateFontSet (FRAME_X_DISPLAY (f), last_resort,
&missing_list, &missing_count, &def_string);
#ifdef DEBUG_XIC_FONTSET
- print_fontset_result (xfs, buf, missing_list, missing_count);
+ print_fontset_result (xfs, last_resort, missing_list, missing_count);
#endif
if (missing_list)
- XFreeStringList (missing_list);
- if (! xfs)
- {
- /* List of pixel sizes most likely available. Find one that
- is closest to pixel_size. */
- int sizes[] = {0, 8, 10, 11, 12, 14, 17, 18, 20, 24, 26, 34, 0};
- int *smaller, *larger;
-
- for (smaller = sizes; smaller[1]; smaller++)
- if (smaller[1] >= pixel_size)
- break;
- larger = smaller + 1;
- if (*larger == pixel_size)
- larger++;
- while (*smaller || *larger)
- {
- int this_size;
-
- if (! *larger)
- this_size = *smaller--;
- else if (! *smaller)
- this_size = *larger++;
- else if (pixel_size - *smaller < *larger - pixel_size)
- this_size = *smaller--;
- else
- this_size = *larger++;
- sprintf (buf, xlfd_format, this_size);
- missing_list = NULL;
- xfs = XCreateFontSet (FRAME_X_DISPLAY (f), buf,
- &missing_list, &missing_count, &def_string);
-#ifdef DEBUG_XIC_FONTSET
- print_fontset_result (xfs, buf, missing_list, missing_count);
-#endif
- if (missing_list)
- XFreeStringList (missing_list);
- if (xfs)
- break;
- }
- }
- if (! xfs)
- {
- const char *last_resort = "-*-*-*-r-normal--*-*-*-*-*-*";
-
- missing_list = NULL;
- xfs = XCreateFontSet (FRAME_X_DISPLAY (f), last_resort,
- &missing_list, &missing_count, &def_string);
-#ifdef DEBUG_XIC_FONTSET
- print_fontset_result (xfs, last_resort, missing_list, missing_count);
-#endif
- if (missing_list)
- XFreeStringList (missing_list);
- }
+ XFreeStringList (missing_list);
}
next prev parent reply other threads:[~2020-08-02 20:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-22 11:41 bug#10867: 23.4 must export LC_CTYPE to zh_CN.UTF-8 or similar CJK locale to use X input method Weng Xuetian
2020-08-02 19:03 ` bug#10867: 26.3; XIM preedit/status font handling Yichao Yu
2020-08-02 20:07 ` Yichao Yu [this message]
2020-08-08 8:00 ` Eli Zaretskii
2020-08-21 4:53 ` Yichao Yu
2020-10-07 4:20 ` Lars Ingebrigtsen
2020-12-28 3:19 ` Lars Ingebrigtsen
2020-12-28 3:26 ` Yichao Yu
2020-12-28 3:28 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMvDr+SOkjexcBgeiFbmU+Tb9XXgG=zmMmc4b=UK+2Dpcvcbrw@mail.gmail.com' \
--to=yyc1992@gmail.com \
--cc=10867@debbugs.gnu.org \
--cc=wengxt@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).