mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
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:
parent
dd1e34dbd6
commit
018bb8eb18
18
drw.c
18
drw.c
@ -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
|
||||
char buf[1024];
|
||||
int ty;
|
||||
unsigned int ew;
|
||||
int i, ty, th;
|
||||
unsigned int ew, eh;
|
||||
XftDraw *d = NULL;
|
||||
size_t i, len;
|
||||
size_t len;
|
||||
int render = x || y || w || h;
|
||||
|
||||
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);
|
||||
|
||||
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 */
|
||||
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--)
|
||||
drw_font_getexts(drw->fonts, text, len, &ew, NULL, markup);
|
||||
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--) {
|
||||
drw_font_getexts(drw->fonts, text, len, &ew, &eh, markup);
|
||||
if (eh > th)
|
||||
th = eh;
|
||||
}
|
||||
|
||||
if (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 */
|
||||
|
||||
if (render) {
|
||||
ty = y + (h - drw->fonts->h) / 2;
|
||||
ty = y + (h - th) / 2;
|
||||
if (markup)
|
||||
pango_layout_set_markup(drw->fonts->layout, buf, len);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user