[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8863: 23.3; Strikethrough won't display on MacOS
From: |
Dave Abrahams |
Subject: |
bug#8863: 23.3; Strikethrough won't display on MacOS |
Date: |
Fri, 01 Jul 2011 22:03:12 -0400 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (darwin) |
on Sat Jun 18 2011, Chong Yidong <cyd-AT-stupidchicken.com> wrote:
> Dave Abrahams <dave@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?
--- 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 */
--- 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)
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
- bug#8863: 23.3; Strikethrough won't display on MacOS,
Dave Abrahams <=