mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 05:30:29 +00:00
Add an interim workaround for xft font match priority problems to fix the problem where changing the serif generic font in preferences changes the UI font as well. This adds an extra bit to the nsFont struct for system fonts that we can use as an indicator to not add a generic fallback. Bug 228518, r=blizzard, sr=dbaron.
This commit is contained in:
parent
830d774612
commit
55c69981f6
@ -70,7 +70,11 @@ struct NS_GFX nsFont {
|
||||
nsString name;
|
||||
|
||||
// The style of font (normal, italic, oblique)
|
||||
PRUint8 style;
|
||||
unsigned int style : 7;
|
||||
|
||||
// Force this font to not be considered a 'generic' font, even if
|
||||
// the name is the same as a CSS generic font family.
|
||||
unsigned int systemFont : 1;
|
||||
|
||||
// The variant of the font (normal, small-caps)
|
||||
PRUint8 variant : 7;
|
||||
|
@ -953,12 +953,20 @@ nsSystemFontsGTK::GetSystemFontInfo(GtkWidget *aWidget, nsFont* aFont,
|
||||
PangoFontDescription *desc;
|
||||
desc = pango_font_description_from_string(fontname);
|
||||
|
||||
// Even if this font family happens to have the same name as a CSS
|
||||
// generic font family, we don't want to use the user's pref for that
|
||||
// CSS family.
|
||||
|
||||
aFont->systemFont = PR_TRUE;
|
||||
|
||||
g_free(fontname);
|
||||
|
||||
aFont->name.Truncate();
|
||||
#ifdef MOZ_ENABLE_XFT
|
||||
if (NS_IsXftEnabled()) {
|
||||
aFont->name.Assign(PRUnichar('"'));
|
||||
aFont->name.AppendWithConversion(pango_font_description_get_family(desc));
|
||||
aFont->name.Assign(PRUnichar('"'));
|
||||
}
|
||||
#endif /* MOZ_ENABLE_XFT */
|
||||
|
||||
|
@ -1041,7 +1041,7 @@ nsFontMetricsXft::SetupFCPattern(void)
|
||||
|
||||
// If there's a generic add a pref for the generic if there's one
|
||||
// set.
|
||||
if (mGenericFont) {
|
||||
if (mGenericFont && !mFont->systemFont) {
|
||||
nsCString name;
|
||||
name += "font.name.";
|
||||
name += mGenericFont->get();
|
||||
@ -1076,12 +1076,12 @@ nsFontMetricsXft::SetupFCPattern(void)
|
||||
}
|
||||
|
||||
// Add the generic if there is one.
|
||||
if (mGenericFont)
|
||||
if (mGenericFont && !mFont->systemFont)
|
||||
AddFFRE(mPattern, mGenericFont, PR_FALSE);
|
||||
|
||||
if (PR_LOG_TEST(gXftFontLoad, PR_LOG_DEBUG)) {
|
||||
// generic font
|
||||
if (mGenericFont) {
|
||||
if (mGenericFont && !mFont->systemFont) {
|
||||
printf("\tadding generic family: %s\n", mGenericFont->get());
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
|
||||
{
|
||||
name.AssignWithConversion(aName);
|
||||
style = aStyle;
|
||||
systemFont = PR_FALSE;
|
||||
variant = aVariant;
|
||||
familyNameQuirks = PR_FALSE;
|
||||
weight = aWeight;
|
||||
@ -61,6 +62,7 @@ nsFont::nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant,
|
||||
: name(aName)
|
||||
{
|
||||
style = aStyle;
|
||||
systemFont = PR_FALSE;
|
||||
variant = aVariant;
|
||||
familyNameQuirks = PR_FALSE;
|
||||
weight = aWeight;
|
||||
@ -73,6 +75,7 @@ nsFont::nsFont(const nsFont& aOther)
|
||||
: name(aOther.name)
|
||||
{
|
||||
style = aOther.style;
|
||||
systemFont = aOther.systemFont;
|
||||
variant = aOther.variant;
|
||||
familyNameQuirks = aOther.familyNameQuirks;
|
||||
weight = aOther.weight;
|
||||
@ -92,6 +95,7 @@ nsFont::~nsFont()
|
||||
PRBool nsFont::Equals(const nsFont& aOther) const
|
||||
{
|
||||
if ((style == aOther.style) &&
|
||||
(systemFont == aOther.systemFont) &&
|
||||
(variant == aOther.variant) &&
|
||||
(familyNameQuirks == aOther.familyNameQuirks) &&
|
||||
(weight == aOther.weight) &&
|
||||
@ -108,6 +112,7 @@ nsFont& nsFont::operator=(const nsFont& aOther)
|
||||
{
|
||||
name = aOther.name;
|
||||
style = aOther.style;
|
||||
systemFont = aOther.systemFont;
|
||||
variant = aOther.variant;
|
||||
familyNameQuirks = aOther.familyNameQuirks;
|
||||
weight = aOther.weight;
|
||||
|
Loading…
x
Reference in New Issue
Block a user