GNU bug report logs -
#8863
23.3; Strikethrough won't display on MacOS
Previous Next
Reported by: Dave Abrahams <dave <at> boostpro.com>
Date: Tue, 14 Jun 2011 16:06:02 UTC
Severity: important
Found in version 23.3
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
on Sat Jun 18 2011, Chong Yidong <cyd-AT-stupidchicken.com> wrote:
> Dave Abrahams <dave <at> boostpro.com> writes:
>
>> Title says it all. Faces with the "strikethrough" property set show up
>> as un-struck-through.
>
> Does this (100% untested) patch do the right thing?
>
> *** src/nsfont.m 2011-01-02 23:50:46 +0000
> --- src/nsfont.m 2011-06-18 21:48:28 +0000
> ***************
> *** 1188,1193 ****
> --- 1188,1207 ----
> /*[context GSSetTextDrawingMode: GSTextFill]; /// not implemented yet */
> }
>
> + /* do strike-through */
> + if (face->strike_through_p)
> + {
> + float line_y = r.origin.y - 0.5 * font->height;
> + if (face->strike_through_color != 0)
> + [ns_lookup_indexed_color (face->strike_through_color, s->f) set];
> + else
> + [col set];
> + DPSmoveto (context, r.origin.x, line_y);
> + DPSlineto (context, r.origin.x + r.size.width, line_y);
> + if (face->strike_through_color != 0)
> + [col set];
> + }
> +
> /* do underline */
> if (face->underline_p)
> {
No, but the enclosed 2 patches, together, seem to. Would somebody apply
these, please?
[patch-src_nsterm.h.diff (text/x-patch, inline)]
--- src/nsterm.h 2011-01-08 17:45:14.000000000 +0000
+++ src/nsterm.h 2011-07-02 01:46:06.000000000 +0000
@@ -435,6 +435,7 @@
char bold, ital; /* convenience flags */
char synthItal;
float voffset; /* mean of ascender/descender offsets */
+ float xheight; /* used to position the strikethrough line */
XCharStruct max_bounds;
/* we compute glyph codes and metrics on-demand in blocks of 256 indexed
by hibyte, lobyte */
[patch-src_nsfont.m.diff (text/x-patch, inline)]
--- src/nsfont.m.old 2011-07-02 01:52:29.000000000 +0000
+++ src/nsfont.m 2011-07-02 01:53:51.000000000 +0000
@@ -840,6 +840,7 @@
font_info->underwidth = [sfont underlineThickness];
font_info->size = font->pixel_size;
font_info->voffset = lrint (hshrink * [sfont ascender] + expand * hd / 2);
+ font_info->xheight = lrint (hshrink * [sfont xHeight] + expand * hd / 2);
/* max bounds */
font_info->max_bounds.ascent =
@@ -1188,6 +1189,22 @@
/*[context GSSetTextDrawingMode: GSTextFill]; /// not implemented yet */
}
+ /* do strike-through */
+ if (face->strike_through_p)
+ {
+ float line_y = lrint (r.origin.y - 0.5 * font->xheight);
+ if (face->strike_through_color != 0)
+ [ns_lookup_indexed_color (face->strike_through_color, s->f) set];
+ else
+ [col set];
+ DPSmoveto (context, r.origin.x, line_y);
+ DPSlineto (context, r.origin.x + r.size.width, line_y);
+ if (face->strike_through_color != 0)
+ [col set];
+ }
+ else
+ [col set];
+
/* do underline */
if (face->underline_p)
{
@@ -1248,6 +1265,23 @@
CGContextSetTextDrawingMode (gcontext, kCGTextFill);
}
+ if (face->strike_through_p)
+ {
+ float line_y = lrint (r.origin.y - 0.5 * font->xheight);
+ if (face->strike_through_color != 0)
+ [ns_lookup_indexed_color (face->strike_through_color, s->f) set];
+ else
+ [col set];
+ CGContextBeginPath (gcontext);
+ CGContextMoveToPoint (gcontext, r.origin.x, line_y);
+ CGContextAddLineToPoint (gcontext, r.origin.x + r.size.width, line_y);
+ CGContextStrokePath (gcontext);
+ if (face->strike_through_color != 0)
+ [col set];
+ }
+ else
+ [col set];
+
if (face->underline_p)
{
if (face->underline_color != 0)
[Message part 4 (text/plain, inline)]
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
This bug report was last modified 14 years and 14 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.