Stop multifont fallback from crashing in GTK1.

I was tacitly assuming that mfont->fallback would always be non-NULL,
which is true in a world containing Pango, but untrue in GTK1 when
Pango isn't there. In that situation we fall back to just omitting the
characters that would be displayed in the fallback font, on the
grounds that that's better than dereferencing through a NULL vtable.
This commit is contained in:
Simon Tatham 2015-08-15 20:26:07 +01:00
Родитель f3f215423b
Коммит 0f60287f66
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -1631,6 +1631,7 @@ static void multifont_draw_text(GdkDrawable *target, GdkGC *gc, unifont *font,
int wide, int bold, int cellwidth)
{
struct multifont *mfont = (struct multifont *)font;
unifont *f;
int ok, i;
while (len > 0) {
@ -1647,8 +1648,10 @@ static void multifont_draw_text(GdkDrawable *target, GdkGC *gc, unifont *font,
/*
* Now display it.
*/
unifont_draw_text(target, gc, ok ? mfont->main : mfont->fallback,
x, y, string, i, wide, bold, cellwidth);
f = ok ? mfont->main : mfont->fallback;
if (f)
unifont_draw_text(target, gc, f, x, y, string, i, wide, bold,
cellwidth);
string += i;
len -= i;
x += i * cellwidth;