From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#51821: 29.0.50; Suggest add variable or frame parameter: line-height Date: Fri, 19 Nov 2021 08:26:57 +0800 Message-ID: <87lf1lour2.fsf@yahoo.com> References: <87bl2nhbyp.fsf@163.com> <83bl2nugao.fsf@gnu.org> <878rxq62qt.fsf@gnus.org> <83k0hatxjl.fsf@gnu.org> <875ysu2d18.fsf@gnus.org> <83y25pshaa.fsf@gnu.org> <874k8c8sg0.fsf@gnus.org> <83ilws16hj.fsf@gnu.org> <87wnl8qg8b.fsf@gnus.org> <83czn0123n.fsf@gnu.org> <83v90pwcab.fsf@gnu.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23648"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) Cc: tumashu@163.com, larsi@gnus.org, 51821@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 19 01:28:15 2021 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 1mnrlG-0005uo-VQ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Nov 2021 01:28:15 +0100 Original-Received: from localhost ([::1]:55822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnrlE-0002FA-SQ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 Nov 2021 19:28:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnrl4-0002En-UE for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2021 19:28:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54119) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnrl4-0002Q1-Lf for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2021 19:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mnrl4-0003pe-GF for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2021 19:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Nov 2021 00:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51821 X-GNU-PR-Package: emacs Original-Received: via spool by 51821-submit@debbugs.gnu.org id=B51821.163728163614661 (code B ref 51821); Fri, 19 Nov 2021 00:28:02 +0000 Original-Received: (at 51821) by debbugs.gnu.org; 19 Nov 2021 00:27:16 +0000 Original-Received: from localhost ([127.0.0.1]:37430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnrkJ-0003oM-Vu for submit@debbugs.gnu.org; Thu, 18 Nov 2021 19:27:16 -0500 Original-Received: from sonic317-33.consmr.mail.ne1.yahoo.com ([66.163.184.44]:45216) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnrkI-0003oA-BP for 51821@debbugs.gnu.org; Thu, 18 Nov 2021 19:27:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1637281628; bh=NQVht1P6pG9m4GMRUxkHCVRlnTfEnWsf20h1kTgpTSo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=XSTlJ4owlPD3+JrcW5c8HOn1kfcJ9VfFJmEylGxIj6rNxHSwiuCqviQFh9SAmtzI1bDBu7yLqQfVBFBlI69s0g4MjcQpNZo/gpXNFfUZTpsr1KgeLCogEnQvgipjCYGysmKVmd7u2xoaXBqc7OWX/IFmjxsKuAsm+ED8xCwUXbyFImtg2jPWp2uoTznLs7UaFq/YmoUcnMQ2pNW4r2fq8lwNWV808lE7br7YwcCJVvhAeaL9+NgjIOV19Ckb0boF60laiJQKwMoA361EWa8TBfEeFyvm3dtn4Ea5kiFAByuTTB5+2h5Rvtrxs5MYn2UyMQlVt9BWi0r2rh/dOxpYdw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1637281628; bh=+oxT+032HirNEsPepR743v0sZQSFG0PRLhDd9GPMEcq=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=S7ihBp9Zw5XP2uQGoW9e4RdOISIAL+A1sI6VGrbecahfRwyovgzzW1RtG/d2te8ysgAWNxLFeZuYcyD6AWdQEu0lz/0QOcOW8fyIZOPJR/l0mqS9zHKvWXMgtTiJA7NTb6O1vAtMuQ4HWvPdHEnOlDCQWimbKqZ0JDlMpzEFKAteT+Gz9oZeC/3d6nAVny/3sUdAxY8hjNXPV4Xu7I/WoOFBZLn36qJFUTMDWM1Httd2FsrHSeGnF3as35hWi5mz2pO1WGBH3tvc0fHmoVn+X+nAvz1B3Bkh34QzKWo5h9JgkgnPjpTvgK5lNUvH/Cnlj7liQ+BAzeBC5DNUXxRuow== X-YMail-OSG: VaPYeBYVM1kIB1ny5hmRX5DOwfntrfojg.XVGh2yFYsFHNufn9smILdiHIYINkc Dx9hXOS_CcVC1wxlCm6xr.JhXy17nuvuXd8fyr5Lqn4tun8CkjwL_ChPKB_g6mxveZejodoajhQh A_p.IUi4RCd3iMirNPnHkOg33iKxZJ.hyokdcDYkJNz1wnHV.ptL7gsxb6GRUURF49BGERoIFNz0 IE_fQN8DtFxJAZjnT8ruKkoyAOSP25cT_xOnIeZP59SYbHke9z59fpFy54ytvq8OfTvoHELlaD.J BOxsCBgeZieYcw78Zo6ZJjjfsdHp9osPYbNdkGo.p7e.RMm9Vjt5Kq4gFhFp6pWPKkpWdgv6MsRX dfvJZ5lAYINZ5rHGt7jhQRL4OlgP.yWcpisBrqqRLGl8cxEQRUhqK04uWwl0HPwxeorsgJNWXIbU FRQ._3tRmZEFTnxs7SqrKjRMRMCq0CsCsoMcBaL7Vr373PvPE3oZZhx.iFdnwlfgD7IUEFDAQmkH 8cBzdmIkjlvui7wQmEIhWT7MXyoRqbbP59cy56QP1I7dBThF.BcWFhzkDwy9azOkcJxDPQlDpUIb xwg7nekKw3eDVtdJRJEGunR95r2cwUb.SsLSA6_ZWEk2yCtfw6GDHJblBufGbRhtxtR.1ZUZJFUu .2D97CAUqRMG50xKcSnuXNdEk8bpix8Dt1ixO3GdrvTK49Z.nzwRPvw1nh5bZGvpbCUU5bCiyAyJ DSzjCDXb7iw9l.CJRWxhih3l4F4GOH3qyfl2vsYjxzf5ateESzJiu9PvTfAgR56CEw7HOcfd7EzV 4DeeZi8_XeZcOWk8D8xv3bgijWI2S.jlWPM2M7zfpL X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.ne1.yahoo.com with HTTP; Fri, 19 Nov 2021 00:27:08 +0000 Original-Received: by kubenode509.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID fba6d2154115cc1c9e48d29beddad552; Fri, 19 Nov 2021 00:27:01 +0000 (UTC) In-Reply-To: <83v90pwcab.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 18 Nov 2021 20:26:20 +0200") X-Mailer: WebService/1.1.19306 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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:220353 Archived-At: Eli Zaretskii writes: > Please try the patch below. I have a very limited number of cases > with which I can test it, so I think users of CJK scripts should say > what they think. Basically, set the new variable line-height-factor > to something like 1.2 (more if you enlarge the non-ASCII font to make > double-width characters take close to 2 columns), and see if you get > the desired effect. Thanks, it seems to work well for what it's intended to. > If this is what people want, I will install it and document it. As for this, I have no specific opinion, as I didn't find the old behavior problematic in the first place. But thanks again! > diff --git a/src/window.c b/src/window.c > index e801ff8..a368b6d 100644 > --- a/src/window.c > +++ b/src/window.c > @@ -5246,7 +5246,10 @@ grow_mini_window (struct window *w, int delta) > { > struct frame *f = XFRAME (w->frame); > int old_height = window_body_height (w, true); > - int min_height = FRAME_LINE_HEIGHT (f); > + int min_height = > + FLOATP (Vline_height_factor) > + ? FRAME_LINE_HEIGHT (f) * XFLOAT_DATA (Vline_height_factor) > + : FRAME_LINE_HEIGHT (f); > > eassert (MINI_WINDOW_P (w)); > > @@ -5279,7 +5282,11 @@ grow_mini_window (struct window *w, int delta) > shrink_mini_window (struct window *w) > { > struct frame *f = XFRAME (w->frame); > - int delta = window_body_height (w, true) - FRAME_LINE_HEIGHT (f); > + int min_line_height = > + FLOATP (Vline_height_factor) > + ? FRAME_LINE_HEIGHT (f) * XFLOAT_DATA (Vline_height_factor) > + : FRAME_LINE_HEIGHT (f); > + int delta = window_body_height (w, true) - min_line_height; > > eassert (MINI_WINDOW_P (w)); > > diff --git a/src/xdisp.c b/src/xdisp.c > index ef49297..d1f4043 100644 > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -22073,6 +22073,18 @@ append_space_for_newline (struct it *it, bool default_face_p) > it->descent = it->override_descent; > boff = it->override_boff; > } > + else > + { > + /* Enlarge the ascent to make the row higher by > + line-height-factor if needed. */ > + if (face == face->ascii_face && it->voffset == 0 > + && FLOATP (Vline_height_factor)) > + { > + int enlarged_height = ((it->ascent + it->descent) > + * XFLOAT_DATA (Vline_height_factor)); > + it->ascent = enlarged_height - it->descent; > + } > + } > if (EQ (height, Qt)) > extra_line_spacing = 0; > else > @@ -30587,9 +30599,9 @@ gui_produce_glyphs (struct it *it) > /* When no suitable font is found, display this character by > the method specified in the first extra slot of > Vglyphless_char_display. */ > - Lisp_Object acronym = lookup_glyphless_char_display (-1, it); > + Lisp_Object acronym = lookup_glyphless_char_display (-1, it); > > - eassert (it->what == IT_GLYPHLESS); > + eassert (it->what == IT_GLYPHLESS); > produce_glyphless_glyph (it, true, > STRINGP (acronym) ? acronym : Qnil); > goto done; > @@ -30613,6 +30625,15 @@ gui_produce_glyphs (struct it *it) > { > it->ascent = FONT_BASE (font) + boff; > it->descent = FONT_DESCENT (font) - boff; > + /* If this glyph uses the ASCII face, enlarge the ascent > + to make the row higher by line-height-factor. */ > + if (face == face->ascii_face && it->voffset == 0 > + && FLOATP (Vline_height_factor)) > + { > + int enlarged_height = ((it->ascent + it->descent) > + * XFLOAT_DATA (Vline_height_factor)); > + it->ascent = enlarged_height - it->descent; > + } > } > > if (get_char_glyph_code (it->char_to_display, font, &char2b)) > @@ -30763,6 +30784,13 @@ gui_produce_glyphs (struct it *it) > { > it->ascent = FONT_BASE (font) + boff; > it->descent = FONT_DESCENT (font) - boff; > + if (face == face->ascii_face && it->voffset == 0 > + && FLOATP (Vline_height_factor)) > + { > + int enlarged_height = ((it->ascent + it->descent) > + * XFLOAT_DATA (Vline_height_factor)); > + it->ascent = enlarged_height - it->descent; > + } > } > } > > @@ -30886,6 +30914,13 @@ gui_produce_glyphs (struct it *it) > { > it->ascent = FONT_BASE (font) + boff; > it->descent = FONT_DESCENT (font) - boff; > + if (face == face->ascii_face && it->voffset == 0 > + && FLOATP (Vline_height_factor)) > + { > + int enlarged_height = ((it->ascent + it->descent) > + * XFLOAT_DATA (Vline_height_factor)); > + it->ascent = enlarged_height - it->descent; > + } > } > it->phys_ascent = it->ascent; > it->phys_descent = it->descent; > @@ -31243,6 +31278,24 @@ gui_produce_glyphs (struct it *it) > if (it->glyph_row > && (metrics.lbearing < 0 || metrics.rbearing > metrics.width)) > it->glyph_row->contains_overlapping_glyphs_p = true; > + if (it->voffset == 0 && FLOATP (Vline_height_factor)) > + { > + Lisp_Object font_object = LGSTRING_FONT (gstring); > + struct font *gstring_font = XFONT_OBJECT (font_object); > + > + /* This is for when the grapheme cluster displays some > + ligature using ASCII font: if the height is smaller > + than line-height-factor says, enlarge the ascent. */ > + if (face == face->ascii_face > + && face->ascii_face->font == gstring_font) > + { > + int enlarged_height = > + ((FONT_BASE (gstring_font) + FONT_DESCENT (gstring_font)) > + * XFLOAT_DATA (Vline_height_factor)); > + if (metrics.ascent + metrics.descent < enlarged_height) > + metrics.ascent = enlarged_height - metrics.descent; > + } > + } > it->ascent = it->phys_ascent = metrics.ascent; > it->descent = it->phys_descent = metrics.descent; > } > @@ -35581,6 +35634,16 @@ syms_of_xdisp (void) > mini-window frame's default font's height. */); > Vmax_mini_window_height = make_float (0.25); > > + DEFVAR_LISP ("line-height-factor", Vline_height_factor, > + doc: /* Factor for enlarging the height of lines that use the default font. > +The value should be a float number greater than 1. It determines how > +much will Emacs enlarge the height of a screen line that shows only > +characters displayed with the default face's font for ASCII characters. > +This is to avoid differences in height between lines that use the > +ASCII font and those which use non-ASCII (for example, Chinese) > +font, which is typically higher than the ASCII one. */); > + Vline_height_factor = Qnil; > + > DEFVAR_LISP ("resize-mini-windows", Vresize_mini_windows, > doc: /* How to resize mini-windows (the minibuffer and the echo area). > A value of nil means don't automatically resize mini-windows.