Terminal: use BFont::IsFullAndHalfFixed.
This commit is contained in:
@@ -17,28 +17,8 @@ BClipboard* gMouseClipboard = NULL;
|
|||||||
bool
|
bool
|
||||||
IsFontUsable(const BFont& font)
|
IsFontUsable(const BFont& font)
|
||||||
{
|
{
|
||||||
// TODO: If BFont::IsFullAndHalfFixed() was implemented, we could
|
if (font.IsFixed() || font.IsFullAndHalfFixed())
|
||||||
// use that. But I don't think it's easily implementable using
|
|
||||||
// Freetype.
|
|
||||||
|
|
||||||
if (font.IsFixed())
|
|
||||||
return true;
|
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 false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user