From 2a67595f1a4e2034ba82008bdadd8585da5a5a7a Mon Sep 17 00:00:00 2001 From: JackBurton Date: Sat, 21 Feb 2015 21:32:31 +0100 Subject: [PATCH] If a monospace font is not available, look for a full-and-half-fixed font. The minimal haiku image does not yet include a monospace font. In that case, be_fixed_font points to Bitstream Charter, which is a proportional font. Terminal isn't happy with that, so we try harder and we look if a full-and-half-fixed font is installed (which should be safe, since we always include VL-Gothic. Fixes #11764 . --- src/apps/terminal/PrefHandler.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/apps/terminal/PrefHandler.cpp b/src/apps/terminal/PrefHandler.cpp index 76508c94a4..99bf741ede 100644 --- a/src/apps/terminal/PrefHandler.cpp +++ b/src/apps/terminal/PrefHandler.cpp @@ -32,8 +32,10 @@ #include #include +#include "Globals.h" #include "TermConst.h" +#include /* * Startup preference settings. @@ -110,7 +112,31 @@ PrefHandler::PrefHandler(bool loadSettings) OpenText(path.Path()); } - _ConfirmFont(be_fixed_font); + // TODO: If no fixed font is available, be_fixed_font + // points to a proportional font. + if (IsFontUsable(be_fixed_font)) + _ConfirmFont(be_fixed_font); + else { + int32 numFamilies = count_font_families(); + for (int32 i = 0; i < numFamilies; i++) { + font_family family; + uint32 flags; + if (get_font_family(i, &family, &flags) == B_OK) { + font_style style; + int32 numStyles = count_font_styles(family); + for (int32 j = 0; j < numStyles; j++) { + if (get_font_style(family, j, &style) == B_OK) { + BFont fallBackFont; + fallBackFont.SetFamilyAndStyle(family, style); + if (IsFontUsable(fallBackFont)) { + _ConfirmFont(&fallBackFont); + return; + } + } + } + } + } + } }