summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2022-11-27 17:26:51 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2022-11-27 17:41:43 -0500
commit28b2983e684dbbfd5fa3636997fa671acb3703eb (patch)
tree0d439a43560790939ccf53a8ef215ed4c27aa932
parent309c2da98a4c739bcdabc3a80610d86a40ce12e6 (diff)
downloadxorg-lib-libXft-28b2983e684dbbfd5fa3636997fa671acb3703eb.tar.gz
issue 17: libxft-2.3.7: Bold fonts in urxvt missing leftmost pixels
Update for issue 16 replaced maximum advance with truncated offsets. However, in some cases (e.g., server providing a fake bold version of a font), the result may extend outside the bounding box for the glyph. To work around this, use the minimum of old/new values. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r--src/xftglyphs.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/xftglyphs.c b/src/xftglyphs.c
index bb9057e..e6f569f 100644
--- a/src/xftglyphs.c
+++ b/src/xftglyphs.c
@@ -844,14 +844,18 @@ XftFontLoadGlyphs (Display *dpy,
}
else
{
+ short maximum_x = (short)(font->public.max_advance_width);
+ short maximum_y = (short)(-font->public.max_advance_width);
+ short trimmed_x = (short)(TRUNC(ROUND(glyphslot->advance.x)));
+ short trimmed_y = (short)(-TRUNC(ROUND(glyphslot->advance.y)));
if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT)
{
xftg->metrics.xOff = 0;
- xftg->metrics.yOff = (short)(-TRUNC(ROUND(glyphslot->advance.y)));
+ xftg->metrics.yOff = min(maximum_y,trimmed_y);
}
else
{
- xftg->metrics.xOff = (short)(TRUNC(ROUND(glyphslot->advance.x)));
+ xftg->metrics.xOff = min(maximum_x,trimmed_x);
xftg->metrics.yOff = 0;
}
}