Terminal: use BFont::IsFullAndHalfFixed.
This commit is contained in:
parent
cd7bd43778
commit
ac2ed5cc13
@ -17,28 +17,8 @@ BClipboard* gMouseClipboard = NULL;
|
||||
bool
|
||||
IsFontUsable(const BFont& font)
|
||||
{
|
||||
// TODO: If BFont::IsFullAndHalfFixed() was implemented, we could
|
||||
// use that. But I don't think it's easily implementable using
|
||||
// Freetype.
|
||||
|
||||
if (font.IsFixed())
|
||||
if (font.IsFixed() || font.IsFullAndHalfFixed())
|
||||
return true;
|
||||
|
||||
// manually check if all applicable chars are the same width
|
||||
char buffer[2] = { ' ', 0 };
|
||||
int firstWidth = (int)ceilf(font.StringWidth(buffer));
|
||||
|
||||
// TODO: Workaround for broken fonts/font_subsystem
|
||||
if (firstWidth <= 0)
|
||||
return false;
|
||||
|
||||
for (int c = ' ' + 1; c <= 0x7e; c++) {
|
||||
buffer[0] = c;
|
||||
int width = (int)ceilf(font.StringWidth(buffer));
|
||||
|
||||
if (width != firstWidth)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user