From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yichao Yu Newsgroups: gmane.emacs.bugs Subject: bug#10867: 26.3; XIM preedit/status font handling Date: Sun, 2 Aug 2020 16:07:26 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26886"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Xuetian Weng To: 10867@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 02 22:08:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2KHF-0006tM-BU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Aug 2020 22:08:13 +0200 Original-Received: from localhost ([::1]:48460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2KHD-000720-T4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Aug 2020 16:08:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2KH6-00071Z-Uh for bug-gnu-emacs@gnu.org; Sun, 02 Aug 2020 16:08:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k2KH6-0006Lb-LC for bug-gnu-emacs@gnu.org; Sun, 02 Aug 2020 16:08:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k2KH6-00024W-Bk for bug-gnu-emacs@gnu.org; Sun, 02 Aug 2020 16:08:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yichao Yu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Aug 2020 20:08:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10867 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org, 10867@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15963988647925 (code B ref -1); Sun, 02 Aug 2020 20:08:04 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Aug 2020 20:07:44 +0000 Original-Received: from localhost ([127.0.0.1]:43544 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k2KGm-00023l-E0 for submit@debbugs.gnu.org; Sun, 02 Aug 2020 16:07:44 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k2KGk-00023d-42 for submit@debbugs.gnu.org; Sun, 02 Aug 2020 16:07:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2KGj-00070I-V4 for bug-gnu-emacs@gnu.org; Sun, 02 Aug 2020 16:07:41 -0400 Original-Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:46336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k2KGi-0006KB-AM for bug-gnu-emacs@gnu.org; Sun, 02 Aug 2020 16:07:41 -0400 Original-Received: by mail-lj1-x244.google.com with SMTP id h19so37478861ljg.13 for ; Sun, 02 Aug 2020 13:07:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=D/OsGfGNxq5B5200ehtGbYA9R14RuQ7F//sUODzH7vA=; b=B5UN0FNOZs3zAwZneRdCrcf5n99030kB6G3YL26r8V3Q+MGBtYCCoPuSR62hu/9tkb vsdXpGPcT2Gh2hT+C+SAlTqP92BSjDrPkJfSCzDFzC2XTHmLf2evSHbtx5L9MQAIQJ56 JXM3dMLyEkaj5kNT6EL4eOxZXEYcBHjMBvn/PFlu0SAcwj41LSoJJ4C2n7u5PxBnPwD5 SQnIxLrSc2kVSjtaOSPOoTy55UGhHlUpBmW8EWdrLyZyOSPNBW+xWe61sNYqwlBacqdZ 13mDPT5nvzfGGUNGYVU6s4KUe5ZOhoXHnk/phcWv9BQZFdUMtz/WmvRX0uJ6oYRWjDjB ZKRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=D/OsGfGNxq5B5200ehtGbYA9R14RuQ7F//sUODzH7vA=; b=KEXcD+R/VyH7+zbzeKdaMHehGQuGd+2J2ApMINqXGmQkoZXVBralr7oMHt2982NowJ 0S+n4rhYbe9OPW0ERP1PTOY0QFYgx6OIcy2WP+52vdDIioy7WY1shqB/2+o9U9U1cWWu jbiCjjJGbIfYBG4Vioag7ZNohEMfdWTXd9oqAibQkXXQU1XvswrEYKhPagHmd5UWoRpr UldCTilGx+DJE4sSsq2OSsjnurms9u0RIZ2bMo49Oyd2JqfPkOcYuHjpPWA1Zjca56Ww JDl2iYH6dWqu+acDZY6pW+T0Xx9bl9aIIM9jVd/WPfFWOIXX6wJAsU5XaDpwO61dGOVR qDGQ== X-Gm-Message-State: AOAM531RrK9huKLspI6P9fGSgo+l1TY7CyUtibrvyITEwcTCxgsUmEJt nHjEpKyEDKRYZ3DKS72D6WEwYH2K/qZ4eduFMJhDSoQTqgk= X-Google-Smtp-Source: ABdhPJxKeJP7lLzvB/R+jaLeMK5C5ImedZkkxvXIwIOacoZMjLpYHCW/Vu6Y8PVUPqd+qE1JnepbWgbd67muJb0mF0Y= X-Received: by 2002:a2e:96cb:: with SMTP id d11mr5641972ljj.239.1596398857652; Sun, 02 Aug 2020 13:07:37 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::244; envelope-from=yyc1992@gmail.com; helo=mail-lj1-x244.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:183885 Archived-At: > ## 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); }