pango: upgrade to 0230520-e81f17d

This upgrades the pango patch to:
https://dwm.suckless.org/patches/pango/dwm-pango-20230520-e81f17d.diff

The changes are fixes for some vertical alignment issues that were obvious only for CJK fonts.

The implementation in dwm-flexipatch is still simplified compared to the original patch, e.g.
avoiding changes like drw->fonts to drw->font and many similar function signatures.
This commit is contained in:
bakkeby 2024-05-17 09:33:13 +02:00
parent dd1e34dbd6
commit 018bb8eb18

18
drw.c
View File

@ -436,10 +436,10 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
{ {
#if BAR_PANGO_PATCH #if BAR_PANGO_PATCH
char buf[1024]; char buf[1024];
int ty; int i, ty, th;
unsigned int ew; unsigned int ew, eh;
XftDraw *d = NULL; XftDraw *d = NULL;
size_t i, len; size_t len;
int render = x || y || w || h; int render = x || y || w || h;
if (!drw || (render && !drw->scheme) || !text || !drw->fonts) if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
@ -464,10 +464,14 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
len = strlen(text); len = strlen(text);
if (len) { if (len) {
drw_font_getexts(drw->fonts, text, len, &ew, NULL, markup); drw_font_getexts(drw->fonts, text, len, &ew, &eh, markup);
th = eh;
/* shorten text if necessary */ /* shorten text if necessary */
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--) for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--) {
drw_font_getexts(drw->fonts, text, len, &ew, NULL, markup); drw_font_getexts(drw->fonts, text, len, &ew, &eh, markup);
if (eh > th)
th = eh;
}
if (len) { if (len) {
memcpy(buf, text, len); memcpy(buf, text, len);
@ -477,7 +481,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
; /* NOP */ ; /* NOP */
if (render) { if (render) {
ty = y + (h - drw->fonts->h) / 2; ty = y + (h - th) / 2;
if (markup) if (markup)
pango_layout_set_markup(drw->fonts->layout, buf, len); pango_layout_set_markup(drw->fonts->layout, buf, len);
else else