From 5a633fc5ed1e936da427e73746f856277d2f9c2f Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 13 Apr 2011 08:28:34 +0100 Subject: [PATCH] bug 636957 - ensure DWrite font list is initialized in GetFontFamilyList(). r=jdaggett --- gfx/thebes/gfxDWriteFontList.cpp | 11 +++++++++++ gfx/thebes/gfxDWriteFontList.h | 2 ++ gfx/thebes/gfxPlatformFontList.h | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index 66dc00fe5d0..cee077d3482 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -1102,6 +1102,17 @@ gfxFontFamily* gfxDWriteFontList::FindFamily(const nsAString& aFamily) return gfxPlatformFontList::FindFamily(aFamily); } +void +gfxDWriteFontList::GetFontFamilyList(nsTArray >& aFamilyArray) +{ + if (!mInitialized) { + mInitialized = PR_TRUE; + DelayedInitFontList(); + } + + return gfxPlatformFontList::GetFontFamilyList(aFamilyArray); +} + PRBool gfxDWriteFontList::ResolveFontName(const nsAString& aFontName, nsAString& aResolvedFontName) diff --git a/gfx/thebes/gfxDWriteFontList.h b/gfx/thebes/gfxDWriteFontList.h index fa9cb0609ac..ed2d309f884 100644 --- a/gfx/thebes/gfxDWriteFontList.h +++ b/gfx/thebes/gfxDWriteFontList.h @@ -225,6 +225,8 @@ public: virtual gfxFontFamily* FindFamily(const nsAString& aFamily); + virtual void GetFontFamilyList(nsTArray >& aFamilyArray); + private: friend class gfxDWriteFontFamily; diff --git a/gfx/thebes/gfxPlatformFontList.h b/gfx/thebes/gfxPlatformFontList.h index 3c51a1de47d..0f1f7ecad81 100644 --- a/gfx/thebes/gfxPlatformFontList.h +++ b/gfx/thebes/gfxPlatformFontList.h @@ -93,7 +93,7 @@ public: void ClearPrefFonts() { mPrefFonts.Clear(); } - void GetFontFamilyList(nsTArray >& aFamilyArray); + virtual void GetFontFamilyList(nsTArray >& aFamilyArray); gfxFontEntry* FindFontForChar(const PRUint32 aCh, gfxFont *aPrevFont);