Now also sorts the font list - unlike the app_server, it could also take the
user's locale into account. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14827 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+16
-11
@@ -89,6 +89,17 @@ class FontList : public BLocker {
|
|||||||
static BPrivate::FontList sFontList;
|
static BPrivate::FontList sFontList;
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
compare_families(const family* a, const family* b)
|
||||||
|
{
|
||||||
|
// TODO: compare font names according to the user's locale settings
|
||||||
|
return strcmp(a->name.String(), b->name.String());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
FontList::FontList()
|
FontList::FontList()
|
||||||
@@ -179,7 +190,7 @@ FontList::_Update()
|
|||||||
family->styles.AddItem(style);
|
family->styles.AddItem(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
fFamilies.AddItem(family);
|
fFamilies.BinaryInsert(family, compare_families);
|
||||||
}
|
}
|
||||||
|
|
||||||
fRevision = revision;
|
fRevision = revision;
|
||||||
@@ -209,16 +220,10 @@ FontList::_FindFamily(font_family name)
|
|||||||
if (fLastFamily != NULL && fLastFamily->name == name)
|
if (fLastFamily != NULL && fLastFamily->name == name)
|
||||||
return fLastFamily;
|
return fLastFamily;
|
||||||
|
|
||||||
for (int32 i = 0; i < fFamilies.CountItems(); i++) {
|
::family family;
|
||||||
family* family = fFamilies.ItemAt(i);
|
family.name = name;
|
||||||
|
fLastFamily = const_cast< ::family*>(fFamilies.BinarySearch(family, compare_families));
|
||||||
if (family->name == name) {
|
return fLastFamily;
|
||||||
fLastFamily = family;
|
|
||||||
return family;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user