A patch from Caitlin Shaw (aka rogueeve) to fix #4715, some Terminal
improvements: * fixed text for "Use Text" radio button in Find dialog being cut off * more user friendly error messages for Find dialog: "no search string" becomes "No search string was entered.", or "Nothing is selected." as appropriate. * Preferences dialog opens unacceptably slow when a larger number of fonts are installed due to AppearPrefView's "IsFontUsuable" routine. But was able to cut opening time by about half with a minor optimization to the loop. * Fixed an ugly word-wrap of Takashi Murai's name in About dialog git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33428 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -24,31 +24,6 @@
|
||||
#include "TermConst.h"
|
||||
|
||||
|
||||
static 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())
|
||||
return true;
|
||||
|
||||
bool widthOk = true;
|
||||
int lastWidth = 0;
|
||||
char buffer[2] = {0, 0};
|
||||
for (int c = 0x20 ; c <= 0x7e; c++){
|
||||
buffer[0] = c;
|
||||
|
||||
int width = (int)ceilf(font.StringWidth(buffer));
|
||||
if (c > 0x20 && width != lastWidth)
|
||||
widthOk = false;
|
||||
lastWidth = width;
|
||||
}
|
||||
|
||||
return widthOk;
|
||||
}
|
||||
|
||||
|
||||
AppearancePrefView::AppearancePrefView(BRect frame, const char *name,
|
||||
BMessenger messenger)
|
||||
@@ -216,6 +191,32 @@ AppearancePrefView::MessageReceived(BMessage *msg)
|
||||
}
|
||||
|
||||
|
||||
static 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())
|
||||
return true;
|
||||
|
||||
// manually check if all applicable chars are the same width
|
||||
char buffer[2] = { ' ', 0 };
|
||||
int firstWidth = (int)ceilf(font.StringWidth(buffer));
|
||||
|
||||
for (int c = ' '+1; c <= 0x7e; c++) {
|
||||
buffer[0] = c;
|
||||
int width = (int)ceilf(font.StringWidth(buffer));
|
||||
|
||||
if (width != firstWidth)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
BMenu *
|
||||
AppearancePrefView::_MakeFontMenu(uint32 command, const char *defaultFontName)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user