b=328781, thebes gfxFont assumes lowercase generic family, r=bz

This commit is contained in:
vladimir%pobox.com 2006-02-28 07:36:01 +00:00
parent a86941f281
commit a7b7add772
2 changed files with 15 additions and 11 deletions

View File

@ -126,16 +126,19 @@ gfxFontGroup::ForEachFont(FontCreationCallback fc,
family = Substring(nameStart, p);
family.CompressWhitespace(PR_FALSE, PR_TRUE);
if (family.EqualsLiteral("serif") ||
family.EqualsLiteral("sans-serif") ||
family.EqualsLiteral("monospace") ||
family.EqualsLiteral("cursive") ||
family.EqualsLiteral("fantasy"))
if (family.LowerCaseEqualsLiteral("serif") ||
family.LowerCaseEqualsLiteral("sans-serif") ||
family.LowerCaseEqualsLiteral("monospace") ||
family.LowerCaseEqualsLiteral("cursive") ||
family.LowerCaseEqualsLiteral("fantasy"))
{
generic = PR_TRUE;
nsCAutoString lcFamily;
ToLowerCase(NS_LossyConvertUTF16toASCII(family), lcFamily);
nsCAutoString prefName("font.name.");
prefName.AppendWithConversion(family);
prefName.Append(lcFamily);
prefName.AppendLiteral(".");
prefName.Append(mStyle.langGroup);
@ -144,7 +147,7 @@ gfxFontGroup::ForEachFont(FontCreationCallback fc,
nsXPIDLCString value;
nsresult rv = prefs->GetCharPref(prefName.get(), getter_Copies(value));
if (NS_SUCCEEDED(rv)) {
genericFamily.Assign(family);
CopyASCIItoUTF16(lcFamily, genericFamily);
CopyUTF8toUTF16(value, family);
}
} else {

View File

@ -221,13 +221,14 @@ gfxPlatformGtk::GetFontList(const nsACString& aLangGroup,
// "monospace", slightly different from CSS's 5.
if (aGenericFamily.IsEmpty())
serif = sansSerif = monospace = 1;
else if (aGenericFamily.EqualsLiteral("serif"))
else if (aGenericFamily.LowerCaseEqualsLiteral("serif"))
serif = 1;
else if (aGenericFamily.EqualsLiteral("sans-serif"))
else if (aGenericFamily.LowerCaseEqualsLiteral("sans-serif"))
sansSerif = 1;
else if (aGenericFamily.EqualsLiteral("monospace"))
else if (aGenericFamily.LowerCaseEqualsLiteral("monospace"))
monospace = 1;
else if (aGenericFamily.EqualsLiteral("cursive") || aGenericFamily.EqualsLiteral("fantasy"))
else if (aGenericFamily.LowerCaseEqualsLiteral("cursive") ||
aGenericFamily.LowerCaseEqualsLiteral("fantasy"))
serif = sansSerif = 1;
else
NS_NOTREACHED("unexpected CSS generic font family");