if (face->strike_through_p)
{
NSRect r;
+ /* Y-coordinate and height of the glyph string's first glyph.
+ We cannot use s->y and s->height because those could be
+ larger if there are taller display elements (e.g., characters
+ displayed with a larger font) in the same glyph row. */
+ int glyph_y = s->ybase - s->first_glyph->ascent;
+ 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 dy;
- dy = lrint ((s->height - 1) / 2);
- r = NSMakeRect (x, s->y + dy, width, 1);
+ dy = lrint ((glyph_height - h) / 2);
+ r = NSMakeRect (x, glyph_y + dy, width, 1);
if (face->strike_through_color_defaulted_p)
[defaultCol set];
if (s->face->strike_through_p
&& !FONT_TEXTMETRIC (s->font).tmStruckOut)
{
+ /* Y-coordinate and height of the glyph string's first
+ glyph. We cannot use s->y and s->height because those
+ could be larger if there are taller display elements
+ (e.g., characters displayed with a larger font) in the
+ same glyph row. */
+ int glyph_y = s->ybase - s->first_glyph->ascent;
+ 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 dy = (s->height - h) / 2;
+ unsigned long dy = (glyph_height - h) / 2;
if (s->face->strike_through_color_defaulted_p)
{
- w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, s->y + dy,
- s->width, h);
+ w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
+ glyph_y + dy, s->width, h);
}
else
{
w32_fill_area (s->f, s->hdc, s->face->strike_through_color, s->x,
- s->y + dy, s->width, h);
+ glyph_y + dy, s->width, h);
}
}
/* Draw strike-through. */
if (s->face->strike_through_p)
{
- unsigned long h = 1;
- unsigned long dy = (s->height - h) / 2;
+ /* Y-coordinate and height of the glyph string's first
+ glyph. We cannot use s->y and s->height because those
+ could be larger if there are taller display elements
+ (e.g., characters displayed with a larger font) in the
+ same glyph row. */
+ int glyph_y = s->ybase - s->first_glyph->ascent;
+ 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 dy = (glyph_height - h) / 2;
if (s->face->strike_through_color_defaulted_p)
- x_fill_rectangle (s->f, s->gc, s->x, s->y + dy,
+ x_fill_rectangle (s->f, s->gc, s->x, glyph_y + dy,
s->width, h);
else
{
XGCValues xgcv;
XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
XSetForeground (s->display, s->gc, s->face->strike_through_color);
- x_fill_rectangle (s->f, s->gc, s->x, s->y + dy,
+ x_fill_rectangle (s->f, s->gc, s->x, glyph_y + dy,
s->width, h);
XSetForeground (s->display, s->gc, xgcv.foreground);
}