From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#33648: 25.2; feature request: configurable position of strike-through line Date: Mon, 31 Aug 2020 21:43:42 +0300 Message-ID: <83mu2awt9d.fsf@gnu.org> References: <2738781e-9dc8-01d1-1b88-13e9a684b53e@iuuk.mff.cuni.cz> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32542"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 33648@debbugs.gnu.org, samal@iuuk.mff.cuni.cz To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 31 20:52:52 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 1kCovD-0008Ny-TR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Aug 2020 20:52:51 +0200 Original-Received: from localhost ([::1]:55464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCovC-0004mX-Tc for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Aug 2020 14:52:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kConf-0002GZ-Ie for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2020 14:45:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42123) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCone-0007hr-5Q for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2020 14:45:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kCone-0008Vy-2j for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2020 14:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Aug 2020 18:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33648 X-GNU-PR-Package: emacs Original-Received: via spool by 33648-submit@debbugs.gnu.org id=B33648.159889944932657 (code B ref 33648); Mon, 31 Aug 2020 18:45:02 +0000 Original-Received: (at 33648) by debbugs.gnu.org; 31 Aug 2020 18:44:09 +0000 Original-Received: from localhost ([127.0.0.1]:53669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kComm-0008Uf-Lq for submit@debbugs.gnu.org; Mon, 31 Aug 2020 14:44:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kComk-0008U4-GA for 33648@debbugs.gnu.org; Mon, 31 Aug 2020 14:44:07 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33133) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kComd-0007dC-62; Mon, 31 Aug 2020 14:43:59 -0400 Original-Received: from [176.228.60.248] (port=3525 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kComc-0007CN-PB; Mon, 31 Aug 2020 14:43:58 -0400 In-Reply-To: (message from Stefan Kangas on Mon, 31 Aug 2020 17:42:43 +0000) 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:186788 Archived-At: > From: Stefan Kangas > Date: Mon, 31 Aug 2020 17:42:43 +0000 > Cc: 33648@debbugs.gnu.org > > I've attached a suggested patch to change the strike-through line > depending on the glyph size. The constant factor was found by > experimentation and produces reasonable results here. Which glyph, though? Emacs draws glyphs in series, called "glyph string". All the glyphs in a glyph string share the same face (and thus the same font), but that doesn't mean all the glyphs are of the same height. And here... > --- a/src/xterm.c > +++ b/src/xterm.c > @@ -3931,7 +3931,7 @@ x_draw_glyph_string (struct glyph_string *s) > int glyph_height = s->first_glyph->ascent + s->first_glyph->descent; > /* Strike-through width and offset from the glyph string's > top edge. */ > - unsigned long h = 1; > + unsigned long h = STRIKE_THROUGH_WIDTH (glyph_height); > unsigned long dy = (glyph_height - h) / 2; ..glyph_height is simply the height of the first glyph in the glyph string. Which could be anything, whereas you seem to assume that all of the glyphs in a glyph string are of the same height. IOW, you are repeating the same "mistake" we do now, just with a different fraction value. Wanna bet that it will break with some fonts? That is why I suggested a Lisp-exposed variable that could be set to the offset in pixels of the strike-through line from the base. (If you want to be fancy, the Lisp variable could also be a float, in which case it will be interpreted as a fraction of the first glyph's height.) This should be user-controlled, which will allow users (or Lisp programs) to set that as they see fit, without requiring us to second-guess up front what they would like. Thanks.