diff --git a/gfx/thebes/gfxPlatformFontList.cpp b/gfx/thebes/gfxPlatformFontList.cpp index 6a93ea5e2492..4888673afeee 100644 --- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -244,16 +244,17 @@ gfxPlatformFontList::InitOtherFamilyNamesProc(nsStringHashKey::KeyType aKey, struct ReadFaceNamesData { ReadFaceNamesData(gfxPlatformFontList *aFontList, TimeStamp aStartTime) - : mFontList(aFontList), mStartTime(aStartTime), mTimedOut(false) + : mFontList(aFontList), mStartTime(aStartTime), mTimedOut(false), + mFirstChar(0) {} gfxPlatformFontList *mFontList; TimeStamp mStartTime; bool mTimedOut; - // if mFirstChar is not empty, only load facenames for families + // if mFirstChar is not 0, only load facenames for families // that start with this character - nsString mFirstChar; + char16_t mFirstChar; }; gfxFontEntry* @@ -265,8 +266,7 @@ gfxPlatformFontList::SearchFamiliesForFaceName(const nsAString& aFaceName) ReadFaceNamesData faceNameListsData(this, start); // iterate over familes starting with the same letter - faceNameListsData.mFirstChar.Assign(aFaceName.CharAt(0)); - ToLowerCase(faceNameListsData.mFirstChar); + faceNameListsData.mFirstChar = ToLowerCase(aFaceName.CharAt(0)); mFontFamilies.Enumerate(gfxPlatformFontList::ReadFaceNamesProc, &faceNameListsData); lookup = FindFaceName(aFaceName); @@ -299,14 +299,10 @@ gfxPlatformFontList::ReadFaceNamesProc(nsStringHashKey::KeyType aKey, gfxPlatformFontList *fc = data->mFontList; // when filtering, skip names that don't start with the filter character - if (!(data->mFirstChar.IsEmpty())) { - char16_t firstChar = aKey.CharAt(0); - nsAutoString firstCharStr(&firstChar, 1); - ToLowerCase(firstCharStr); - if (!firstCharStr.Equals(data->mFirstChar)) { - return PL_DHASH_NEXT; - } + if (data->mFirstChar && ToLowerCase(aKey.CharAt(0)) != data->mFirstChar) { + return PL_DHASH_NEXT; } + aFamilyEntry->ReadFaceNames(fc, fc->NeedFullnamePostscriptNames()); TimeDuration elapsed = TimeStamp::Now() - data->mStartTime;