diff -urN a/source/highlightData.c b/source/highlightData.c --- a/source/highlightData.c 2018-03-13 08:42:40.930188154 +0100 +++ b/source/highlightData.c 2018-03-13 08:44:59.651196431 +0100 @@ -1280,7 +1280,7 @@ XFontStruct *font; if (styleNo<0) - return GetDefaultFontStruct(window->fontList); + return GetDefaultFontStruct(TheDisplay, window->fontList); fontNum = HighlightStyles[styleNo]->font; if (fontNum == BOLD_FONT) font = window->boldFontStruct; @@ -1289,10 +1289,10 @@ else if (fontNum == BOLD_ITALIC_FONT) font = window->boldItalicFontStruct; else /* fontNum == PLAIN_FONT */ - font = GetDefaultFontStruct(window->fontList); + font = GetDefaultFontStruct(TheDisplay, window->fontList); /* If font isn't loaded, silently substitute primary font */ - return font == NULL ? GetDefaultFontStruct(window->fontList) : font; + return font == NULL ? GetDefaultFontStruct(TheDisplay, window->fontList) : font; } int FontOfNamedStyleIsBold(char *styleName) diff -urN a/source/text.c b/source/text.c --- a/source/text.c 2018-03-13 08:42:40.931188154 +0100 +++ b/source/text.c 2018-03-13 08:46:37.785202286 +0100 @@ -778,9 +778,13 @@ textBuffer *buf; Pixel white, black; int textLeft; - int charWidth = fs->max_bounds.width; - int marginWidth = new->text.marginWidth; - int lineNumCols = new->text.lineNumCols; + int charWidth; + int marginWidth; + int lineNumCols; + + charWidth = fs->max_bounds.width; + marginWidth = new->text.marginWidth; + lineNumCols = new->text.lineNumCols; /* Set the initial window size based on the rows and columns resources */ if (request->core.width == 0) diff -urN a/source/window.c b/source/window.c --- a/source/window.c 2018-03-13 08:42:40.937188155 +0100 +++ b/source/window.c 2018-03-13 08:48:07.727207652 +0100 @@ -1839,7 +1839,7 @@ /* Change the primary font in all the widgets */ if (primaryChanged) { - font = GetDefaultFontStruct(window->fontList); + font = GetDefaultFontStruct(TheDisplay, window->fontList); XtVaSetValues(window->textArea, textNfont, font, NULL); for (i=0; inPanes; i++) XtVaSetValues(window->textPanes[i], textNfont, font, NULL); @@ -1861,7 +1861,7 @@ size appropriate for the new font, but only do so if there's only _one_ document in the window, in order to avoid growing-window bug */ if (NDocuments(window) == 1) { - fontWidth = GetDefaultFontStruct(window->fontList)->max_bounds.width; + fontWidth = GetDefaultFontStruct(TheDisplay, window->fontList)->max_bounds.width; fontHeight = textD->ascent + textD->descent; newWindowWidth = (oldTextWidth*fontWidth) / oldFontWidth + borderWidth; newWindowHeight = (oldTextHeight*fontHeight) / oldFontHeight + @@ -2244,7 +2244,7 @@ textNrows, rows, textNcolumns, cols, textNlineNumCols, lineNumCols, textNemulateTabs, emTabDist, - textNfont, GetDefaultFontStruct(window->fontList), + textNfont, GetDefaultFontStruct(TheDisplay, window->fontList), textNhScrollBar, hScrollBar, textNvScrollBar, vScrollBar, textNreadOnly, IS_ANY_LOCKED(window->lockReasons), textNwordDelimiters, delimiters, --- a/util/misc.c 2018-03-13 08:50:54.892217626 +0100 +++ b/util/misc.c 2018-03-13 08:56:50.346238834 +0100 @@ -1018,7 +1018,7 @@ ** a Motif font list. Since Motif stores this, it saves us from storing ** it or querying it from the X server. */ -XFontStruct *GetDefaultFontStruct(XmFontList font) +XFontStruct *GetDefaultFontStruct(Display *d, XmFontList font) { XFontStruct *fs; XmFontContext context; @@ -1028,6 +1028,17 @@ XmFontListGetNextFont(context, &charset, &fs); XmFontListFreeFontContext(context); XtFree(charset); + + /* FontList might be a render table with no only XFT fonts */ + if (fs == NULL) { + fs = XLoadQueryFont(d, "fixed"); + } + + if (fs == NULL) { + fprintf(stderr, "Unabled to load any fallback fonts.\n"); + exit(EXIT_FAILURE); + } + return fs; } diff -urN a/util/misc.h b/util/misc.h --- a/util/misc.h 2018-03-13 08:50:54.890217626 +0100 +++ b/util/misc.h 2018-03-13 08:55:52.790235400 +0100 @@ -65,7 +65,7 @@ void AccelLockBugPatch(Widget topWidget, Widget topMenuContainer); void UpdateAccelLockPatch(Widget topWidget, Widget newButton); char *GetXmStringText(XmString fromString); -XFontStruct *GetDefaultFontStruct(XmFontList font); +XFontStruct *GetDefaultFontStruct(Display *d, XmFontList font); XmString* StringTable(int count, ...); void FreeStringTable(XmString *table); void SimulateButtonPress(Widget widget);