bug 987357 - support .woff-format fonts installed in the system fonts directory on android/b2g devices. r=roc

This commit is contained in:
Jonathan Kew 2014-03-25 10:07:31 +00:00
parent eb0a2e7f1e
commit e53ad4cb65

View File

@ -1278,14 +1278,13 @@ gfxFT2FontList::FindFontsInDir(const nsCString& aDir, FontNameCache *aFNC)
struct dirent *ent = nullptr;
while ((ent = readdir(d)) != nullptr) {
int namelen = strlen(ent->d_name);
if (namelen <= 4) {
// cannot be a usable font filename
const char *ext = strrchr(ent->d_name, '.');
if (!ext) {
continue;
}
const char *ext = ent->d_name + namelen - 4;
if (strcasecmp(ext, ".ttf") == 0 ||
strcasecmp(ext, ".otf") == 0 ||
strcasecmp(ext, ".woff") == 0 ||
strcasecmp(ext, ".ttc") == 0) {
bool isStdFont = false;
for (unsigned int i = 0;
@ -1295,7 +1294,7 @@ gfxFT2FontList::FindFontsInDir(const nsCString& aDir, FontNameCache *aFNC)
nsCString s(aDir);
s.Append('/');
s.Append(ent->d_name, namelen);
s.Append(ent->d_name);
// Add the face(s) from this file to our font list;
// note that if we have cached info for this file in fnc,