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 .
This commit is contained in:
JackBurton 2015-02-21 21:32:31 +01:00
parent f88412ccda
commit 2a67595f1a

View File

@ -32,8 +32,10 @@
#include <NodeInfo.h>
#include <Path.h>
#include "Globals.h"
#include "TermConst.h"
#include <iostream>
/*
* 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;
}
}
}
}
}
}
}