mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 13:45:46 +00:00
bug 825504 - fix gfxPangoFontGroup::FindFamilyNameAt for user fonts, to resolve MathML fonts breakage. r=roc
This commit is contained in:
parent
a74e52e0be
commit
531d3c6676
@ -1983,6 +1983,15 @@ nsString
|
||||
gfxPangoFontGroup::GetFamilyNameAt(int32_t i)
|
||||
{
|
||||
gfxFcFont* font = static_cast<gfxFcFont*>(GetFontAt(i));
|
||||
|
||||
if (font->GetFontEntry()->IsUserFont()) {
|
||||
gfxFontFamily* family =
|
||||
GetUserFontSet()->FindFamilyFor(font->GetFontEntry());
|
||||
if (family) { // should never fail, but just in case...
|
||||
return family->Name();
|
||||
}
|
||||
}
|
||||
|
||||
return font->GetFamilyName();
|
||||
}
|
||||
|
||||
|
@ -791,6 +791,33 @@ gfxUserFontSet::GetFamily(const nsAString& aFamilyName) const
|
||||
return mFontFamilies.GetWeak(key);
|
||||
}
|
||||
|
||||
struct FindFamilyCallbackData {
|
||||
gfxFontEntry *mFontEntry;
|
||||
gfxFontFamily *mFamily;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
FindFamilyCallback(const nsAString& aName,
|
||||
gfxMixedFontFamily* aFamily,
|
||||
void* aUserArg)
|
||||
{
|
||||
FindFamilyCallbackData *d = static_cast<FindFamilyCallbackData*>(aUserArg);
|
||||
if (aFamily->ContainsFace(d->mFontEntry)) {
|
||||
d->mFamily = aFamily;
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
gfxFontFamily*
|
||||
gfxUserFontSet::FindFamilyFor(gfxFontEntry* aFontEntry) const
|
||||
{
|
||||
FindFamilyCallbackData d = { aFontEntry, nullptr };
|
||||
mFontFamilies.EnumerateRead(FindFamilyCallback, &d);
|
||||
return d.mFamily;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// gfxUserFontSet::UserFontCache - re-use platform font entries for user fonts
|
||||
// across pages/fontsets rather than instantiating new platform fonts.
|
||||
|
@ -193,6 +193,12 @@ public:
|
||||
bool& aNeedsBold,
|
||||
bool& aWaitForUserFont);
|
||||
|
||||
// Find a family (possibly one of several!) that owns the given entry.
|
||||
// This may be somewhat expensive, as it enumerates all the fonts in
|
||||
// the set. Currently used only by the Linux (gfxPangoFontGroup) backend,
|
||||
// which does not directly track families in the font group's list.
|
||||
gfxFontFamily *FindFamilyFor(gfxFontEntry *aFontEntry) const;
|
||||
|
||||
// check whether the given source is allowed to be loaded
|
||||
virtual nsresult CheckFontLoad(const gfxFontFaceSrc *aFontFaceSrc,
|
||||
nsIPrincipal **aPrincipal) = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user