From: Stefan Kangas <stefan@marxist.se>
To: Robert Samal <samal@iuuk.mff.cuni.cz>
Cc: 33648@debbugs.gnu.org
Subject: bug#33648: 25.2; feature request: configurable position of strike-through line
Date: Mon, 31 Aug 2020 17:42:43 +0000 [thread overview]
Message-ID: <CADwFkmktHEyNufsgJXC5Gbw4oRVqHLs+C=kQ0ftOytNhRmpg6Q@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmk6+O0yxeGoo5AJmT5FJ6=F3EtuZz_rngxn0ZkTpKmrKw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
Stefan Kangas <stefan@marxist.se> writes:
> 2. The strike-through line is hard coded to 1 pixel in our case, whereas
> LibreOffice scales it up as the font size increases.
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.
Best regards,
Stefan Kangas
[-- Attachment #2: 0001-Make-strike-through-thicker-for-larger-font-sizes.patch --]
[-- Type: text/x-diff, Size: 2625 bytes --]
From 74b5091161890bc145034c5f2fd0c7e615b21d65 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Mon, 31 Aug 2020 13:39:51 +0200
Subject: [PATCH] Make strike-through thicker for larger font sizes
* src/nsterm.m (ns_draw_text_decoration):
* src/w32term.c (w32_draw_glyph_string):
* src/xterm.c (x_draw_glyph_string): Make strike-through thicker
for larger font sizes. (Bug#33648)
* src/dispextern.h (STRIKE_THROUGH_WIDTH_FACTOR): New constant.
---
src/dispextern.h | 4 ++++
src/nsterm.m | 2 +-
src/w32term.c | 2 +-
src/xterm.c | 2 +-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/dispextern.h b/src/dispextern.h
index 956ca96eb6..461526a7f8 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -656,6 +656,10 @@ #define GLYPH_INVALID_P(GLYPH) (GLYPH_CHAR (GLYPH) < 0)
#define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p
+/* Calculate the width of the strike-through line. */
+
+#define STRIKE_THROUGH_WIDTH(x) ceilf (x / 15.0)
+
\f
diff --git a/src/nsterm.m b/src/nsterm.m
index 26059ab67c..16575c066b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3706,7 +3706,7 @@ larger if there are taller display elements (e.g., characters
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;
dy = lrint ((glyph_height - h) / 2);
diff --git a/src/w32term.c b/src/w32term.c
index 1766b32514..1b8d9b811b 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -2636,7 +2636,7 @@ w32_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;
if (s->face->strike_through_color_defaulted_p)
diff --git a/src/xterm.c b/src/xterm.c
index 2e0407aff4..b17afdf225 100644
--- 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;
if (s->face->strike_through_color_defaulted_p)
--
2.28.0
next prev parent reply other threads:[~2020-08-31 17:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-06 8:20 bug#33648: 25.2; feature request: configurable position of strike-through line Robert Samal
2020-08-31 11:21 ` Stefan Kangas
2020-08-31 11:35 ` Stefan Kangas
2020-08-31 14:39 ` Eli Zaretskii
2020-08-31 14:40 ` Eli Zaretskii
2020-08-31 14:37 ` Eli Zaretskii
2020-08-31 17:42 ` Stefan Kangas [this message]
2020-08-31 18:43 ` Eli Zaretskii
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='CADwFkmktHEyNufsgJXC5Gbw4oRVqHLs+C=kQ0ftOytNhRmpg6Q@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=33648@debbugs.gnu.org \
--cc=samal@iuuk.mff.cuni.cz \
/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).