b=597147 part 2: rename gfxFcPangoFontSet to gfxFcFontSet, add GetBaseFont to return a gfxFcFont r=jfkthame
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 08 Nov 2010 11:44:50 +1300
changeset 57260 8ad44f07b1ed1a62c1f7b65898dd1e0e25f0c997
parent 57259 fe434322269b94afd342250847cdb29fdb797328
child 57261 ed65851c96c91460c7676437acb2d08eaef3dbf7
push id16852
push userktomlinson@mozilla.com
push dateWed, 10 Nov 2010 20:06:29 +0000
treeherdermozilla-central@85b93f3ea9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs597147
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
b=597147 part 2: rename gfxFcPangoFontSet to gfxFcFontSet, add GetBaseFont to return a gfxFcFont r=jfkthame
gfx/thebes/gfxPangoFonts.cpp
gfx/thebes/gfxPangoFonts.h
--- a/gfx/thebes/gfxPangoFonts.cpp
+++ b/gfx/thebes/gfxPangoFonts.cpp
@@ -935,37 +935,37 @@ SetFontGroup(PangoContext *aContext, gfx
 static gfxPangoFontGroup *
 GetFontGroup(PangoContext *aContext)
 {
     return static_cast<gfxPangoFontGroup*>
         (g_object_get_qdata(G_OBJECT(aContext), GetFontGroupQuark()));
 }
 
 /**
- * gfxFcPangoFontSet:
+ * gfxFcFontSet:
  *
  * Translation from a desired FcPattern to a sorted set of font references
  * (fontconfig cache data) and (when needed) PangoFonts.
  */
 
-class gfxFcPangoFontSet {
+class gfxFcFontSet {
 public:
-    NS_INLINE_DECL_REFCOUNTING(gfxFcPangoFontSet)
+    NS_INLINE_DECL_REFCOUNTING(gfxFcFontSet)
     
-    explicit gfxFcPangoFontSet(FcPattern *aPattern,
+    explicit gfxFcFontSet(FcPattern *aPattern,
                                gfxUserFontSet *aUserFontSet)
         : mSortPattern(aPattern), mUserFontSet(aUserFontSet),
           mFcFontSet(SortPreferredFonts()), mFcFontsTrimmed(0),
           mHaveFallbackFonts(PR_FALSE)
     {
     }
 
     // A reference is held by the FontSet.
     // The caller may add a ref to keep the font alive longer than the FontSet.
-    PangoFont *GetFontAt(PRUint32 i)
+    PangoFont *GetPangoFontAt(PRUint32 i)
     {
         if (i >= mFonts.Length() || !mFonts[i].mFont) { 
             // GetFontPatternAt sets up mFonts
             FcPattern *fontPattern = GetFontPatternAt(i);
             if (!fontPattern)
                 return NULL;
 
             mFonts[i].mFont =
@@ -1122,17 +1122,17 @@ SizeIsAcceptable(FcPattern *aFont, doubl
 
     // No size means scalable
     return v == 0;
 }
 
 // Sorting only the preferred fonts first usually saves having to sort through
 // every font on the system.
 nsReturnRef<FcFontSet>
-gfxFcPangoFontSet::SortPreferredFonts()
+gfxFcFontSet::SortPreferredFonts()
 {
     gfxFontconfigUtils *utils = gfxFontconfigUtils::GetFontconfigUtils();
     if (!utils)
         return nsReturnRef<FcFontSet>();
 
     // The list of families in mSortPattern has values with both weak and
     // strong bindings.  Values with strong bindings should be preferred.
     // Values with weak bindings are default fonts that should be considered
@@ -1343,34 +1343,34 @@ gfxFcPangoFontSet::SortPreferredFonts()
 
         fontSet.steal(truncatedSet);
     }
 
     return fontSet.out();
 }
 
 nsReturnRef<FcFontSet>
-gfxFcPangoFontSet::SortFallbackFonts()
+gfxFcFontSet::SortFallbackFonts()
 {
     // Setting trim to FcTrue would provide a much smaller (~ 1/10) FcFontSet,
     // but would take much longer due to comparing all the character sets.
     //
     // The references to fonts in this FcFontSet are almost free
     // as they are pointers into mmaped cache files.
     //
     // GetFontPatternAt() will trim lazily if and as needed, which will also
     // remove duplicates of preferred fonts.
     FcResult result;
     return nsReturnRef<FcFontSet>(FcFontSort(NULL, mSortPattern,
                                              FcFalse, NULL, &result));
 }
 
-// GetFontAt relies on this setting up all patterns up to |i|.
+// GetPangoFontAt relies on this setting up all patterns up to |i|.
 FcPattern *
-gfxFcPangoFontSet::GetFontPatternAt(PRUint32 i)
+gfxFcFontSet::GetFontPatternAt(PRUint32 i)
 {
     while (i >= mFonts.Length()) {
         while (!mFcFontSet) {
             if (mHaveFallbackFonts)
                 return nsnull;
 
             mFcFontSet = SortFallbackFonts();
             mHaveFallbackFonts = PR_TRUE;
@@ -1436,17 +1436,17 @@ GType gfx_pango_fontset_get_type (void);
 #define GFX_IS_PANGO_FONTSET_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GFX_TYPE_PANGO_FONTSET))
 #define GFX_PANGO_FONTSET_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GFX_TYPE_PANGO_FONTSET, gfxPangoFontsetClass))
 
 // This struct is POD so that it can be used as a GObject.
 struct gfxPangoFontset {
     PangoFontset parent_instance;
 
     PangoLanguage *mLanguage;
-    gfxFcPangoFontSet *mGfxFontSet;
+    gfxFcFontSet *mGfxFontSet;
     PangoFont *mBaseFont;
     gfxPangoFontGroup *mFontGroup;
 
     static PangoFontset *
     NewFontset(gfxPangoFontGroup *aFontGroup,
                PangoLanguage *aLanguage)
     {
         gfxPangoFontset *fontset = static_cast<gfxPangoFontset *>
@@ -1518,17 +1518,17 @@ gfx_pango_fontset_finalize(GObject *obje
 
 static PangoLanguage *
 gfx_pango_fontset_get_language(PangoFontset *fontset)
 {
     gfxPangoFontset *self = GFX_PANGO_FONTSET(fontset);
     return self->mLanguage;
 }
 
-static gfxFcPangoFontSet *
+static gfxFcFontSet *
 GetGfxFontSet(gfxPangoFontset *self)
 {
     if (!self->mGfxFontSet && self->mFontGroup) {
         self->mGfxFontSet = self->mFontGroup->GetFontSet(self->mLanguage);
         // Finished with the font group
         NS_RELEASE(self->mFontGroup);
 
         if (!self->mGfxFontSet)
@@ -1549,28 +1549,28 @@ gfx_pango_fontset_foreach(PangoFontset *
     if (self->mBaseFont) {
         if ((*func)(fontset, self->mBaseFont, data))
             return;
 
         baseFontPattern = PANGO_FC_FONT(self->mBaseFont)->font_pattern;
     }        
 
     // Falling back to secondary fonts
-    gfxFcPangoFontSet *gfxFontSet = GetGfxFontSet(self);
+    gfxFcFontSet *gfxFontSet = GetGfxFontSet(self);
     if (!gfxFontSet)
         return;
 
     for (PRUint32 i = 0;
          FcPattern *pattern = gfxFontSet->GetFontPatternAt(i);
          ++i) {
         // Skip this font if it is the same face as the base font
         if (pattern == baseFontPattern) {
             continue;
         }
-        PangoFont *font = gfxFontSet->GetFontAt(i);
+        PangoFont *font = gfxFontSet->GetPangoFontAt(i);
         if (font) {
             if ((*func)(fontset, font, data))
                 return;
         }
     }
 }
 
 static PRBool HasChar(FcPattern *aFont, FcChar32 wc)
@@ -1594,40 +1594,40 @@ gfx_pango_fontset_get_font(PangoFontset 
 
         if (HasChar(baseFontPattern, wc)) {
             result = self->mBaseFont;
         }
     }
 
     if (!result) {
         // Falling back to secondary fonts
-        gfxFcPangoFontSet *gfxFontSet = GetGfxFontSet(self);
+        gfxFcFontSet *gfxFontSet = GetGfxFontSet(self);
 
         if (gfxFontSet) {
             for (PRUint32 i = 0;
                  FcPattern *pattern = gfxFontSet->GetFontPatternAt(i);
                  ++i) {
                 // Skip this font if it is the same face as the base font
                 if (pattern == baseFontPattern) {
                     continue;
                 }
 
                 if (HasChar(pattern, wc)) {
-                    result = gfxFontSet->GetFontAt(i);
+                    result = gfxFontSet->GetPangoFontAt(i);
                     break;
                 }
             }
         }
 
         if (!result) {
             // Nothing found.  Return the first font.
             if (self->mBaseFont) {
                 result = self->mBaseFont;
             } else if (gfxFontSet) {
-                result = gfxFontSet->GetFontAt(0);
+                result = gfxFontSet->GetPangoFontAt(0);
             }
         }
     }
 
     if (!result)
         return NULL;
 
     g_object_ref(result);
@@ -1652,17 +1652,17 @@ gfx_pango_fontset_class_init (gfxPangoFo
 /**
  * gfxPangoFontMap: An implementation of a PangoFontMap.
  *
  * This is passed to pango_itemize() through the PangoContext parameter, and
  * provides font selection through the gfxPangoFontGroup.
  *
  * It is intended that the font group is recorded on the PangoContext with
  * SetFontGroup().  The font group is then queried for fonts, with
- * gfxFcPangoFontSet doing the font selection.
+ * gfxFcFontSet doing the font selection.
  */
 
 #define GFX_TYPE_PANGO_FONT_MAP              (gfx_pango_font_map_get_type())
 #define GFX_PANGO_FONT_MAP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GFX_TYPE_PANGO_FONT_MAP, gfxPangoFontMap))
 #define GFX_IS_PANGO_FONT_MAP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GFX_TYPE_PANGO_FONT_MAP))
 
 GType gfx_pango_font_map_get_type (void);
 
@@ -1938,37 +1938,43 @@ gfxPangoFontGroup::GetFcFamilies(nsTArra
     // best match.
     ForEachFontInternal(mFamilies, aLanguage, PR_TRUE, PR_FALSE,
                         FamilyCallback, &data);
 }
 
 PangoFont *
 gfxPangoFontGroup::GetBasePangoFont()
 {
-    return GetBaseFontSet()->GetFontAt(0);
+    return GetBaseFontSet()->GetPangoFontAt(0);
+}
+
+gfxFcFont *
+gfxPangoFontGroup::GetBaseFont()
+{
+    if (!mFonts[0]) {
+        PangoFont *pangoFont = GetBasePangoFont();
+        mFonts[0] = gfxPangoFcFont::GfxFont(GFX_PANGO_FC_FONT(pangoFont));
+    }
+
+    return static_cast<gfxFcFont*>(mFonts[0].get());
 }
 
 gfxFont *
 gfxPangoFontGroup::GetFontAt(PRInt32 i) {
     // If it turns out to be hard for all clients that cache font
     // groups to call UpdateFontList at appropriate times, we could
     // instead consider just calling UpdateFontList from someplace
     // more central (such as here).
     NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
                  "Whoever was caching this font group should have "
                  "called UpdateFontList on it");
 
     NS_PRECONDITION(i == 0, "Only have one font");
 
-    if (!mFonts[0]) {
-        PangoFont *pangoFont = GetBasePangoFont();
-        mFonts[0] = gfxPangoFcFont::GfxFont(GFX_PANGO_FC_FONT(pangoFont));
-    }
-
-    return mFonts[0];
+    return GetBaseFont();
 }
 
 void
 gfxPangoFontGroup::UpdateFontList()
 {
     if (!mUserFontSet)
         return;
 
@@ -1977,17 +1983,17 @@ gfxPangoFontGroup::UpdateFontList()
         return;
 
     mFonts[0] = NULL;
     mFontSets.Clear();
     mUnderlineOffset = UNDERLINE_OFFSET_NOT_SET;
     mCurrGeneration = newGeneration;
 }
 
-already_AddRefed<gfxFcPangoFontSet>
+already_AddRefed<gfxFcFontSet>
 gfxPangoFontGroup::MakeFontSet(PangoLanguage *aLang, gfxFloat aSizeAdjustFactor,
                                nsAutoRef<FcPattern> *aMatchPattern)
 {
     const char *lang = pango_language_to_string(aLang);
 
     nsIAtom *langGroup = nsnull;
     if (aLang != mPangoLanguage) {
         // Set up langGroup for Mozilla's font prefs.
@@ -2005,46 +2011,46 @@ gfxPangoFontGroup::MakeFontSet(PangoLang
     // To consider: A fontset cache here could be helpful.
 
     // Get a pattern suitable for matching.
     nsAutoRef<FcPattern> pattern
         (gfxFontconfigUtils::NewPattern(fcFamilyList, mStyle, lang));
 
     PrepareSortPattern(pattern, mStyle.size, aSizeAdjustFactor, mStyle.printerFont);
 
-    nsRefPtr<gfxFcPangoFontSet> fontset =
-        new gfxFcPangoFontSet(pattern, mUserFontSet);
+    nsRefPtr<gfxFcFontSet> fontset =
+        new gfxFcFontSet(pattern, mUserFontSet);
 
     if (aMatchPattern)
         aMatchPattern->steal(pattern);
 
     return fontset.forget();
 }
 
 gfxPangoFontGroup::
 FontSetByLangEntry::FontSetByLangEntry(PangoLanguage *aLang,
-                                       gfxFcPangoFontSet *aFontSet)
+                                       gfxFcFontSet *aFontSet)
     : mLang(aLang), mFontSet(aFontSet)
 {
 }
 
-gfxFcPangoFontSet *
+gfxFcFontSet *
 gfxPangoFontGroup::GetFontSet(PangoLanguage *aLang)
 {
     GetBaseFontSet(); // sets mSizeAdjustFactor and mFontSets[0]
 
     if (!aLang)
         return mFontSets[0].mFontSet;
 
     for (PRUint32 i = 0; i < mFontSets.Length(); ++i) {
         if (mFontSets[i].mLang == aLang)
             return mFontSets[i].mFontSet;
     }
 
-    nsRefPtr<gfxFcPangoFontSet> fontSet =
+    nsRefPtr<gfxFcFontSet> fontSet =
         MakeFontSet(aLang, mSizeAdjustFactor);
     mFontSets.AppendElement(FontSetByLangEntry(aLang, fontSet));
 
     return fontSet;
 }
 
 /**
  ** gfxFcFont
@@ -2127,34 +2133,34 @@ gfxPangoFontGroup::NewFontEntry(const gf
 
         if (fonts.Length() != 0)
             return new gfxLocalFcFontEntry(aProxyEntry, fonts);
     }
 
     return nsnull;
 }
 
-static FT_Library
-GetFTLibrary()
+/* static */ FT_Library
+gfxPangoFontGroup::GetFTLibrary()
 {
     if (!gFTLibrary) {
         // Use cairo's FT_Library so that cairo takes care of shutdown of the
         // FT_Library after it has destroyed its font_faces, and FT_Done_Face
         // has been called on each FT_Face, at least until this bug is fixed:
         // https://bugs.freedesktop.org/show_bug.cgi?id=18857
         //
         // Cairo's FT_Library can be obtained from any cairo_scaled_font.  The
         // font properties requested here are chosen to get an FT_Face that is
         // likely to be also used elsewhere.
         gfxFontStyle style;
         nsRefPtr<gfxPangoFontGroup> fontGroup =
             new gfxPangoFontGroup(NS_LITERAL_STRING("sans-serif"),
                                   &style, nsnull);
 
-        gfxFcFont *font = static_cast<gfxFcFont*>(fontGroup->GetFontAt(0));
+        gfxFcFont *font = fontGroup->GetBaseFont();
         if (!font)
             return NULL;
 
         gfxFT2LockedFace face(font);
         if (!face.get())
             return NULL;
 
         gFTLibrary = face.get()->glyph->library;
@@ -2192,21 +2198,21 @@ GetPixelSize(FcPattern *aPattern)
                            FC_PIXEL_SIZE, 0, &size) == FcResultMatch)
         return size;
 
     NS_NOTREACHED("No size on pattern");
     return 0.0;
 }
 
 /**
- * The following gfxPangoFonts are accessed from the PangoFont, not from the
- * gfxFontCache hash table.  The gfxFontCache hash table is keyed by desired
- * family and style, whereas here we only know actual family and style.  There
- * may be more than one of these fonts with the same family and style, but
- * different PangoFont and actual font face.
+ * The following gfxFcFonts are accessed from the cairo_scaled_font or created
+ * from the FcPattern, not from the gfxFontCache hash table.  The gfxFontCache
+ * hash table is keyed by desired family and style, whereas here we only know
+ * actual family and style.  There may be more than one of these fonts with
+ * the same family and style, but different PangoFont and actual font face.
  * 
  * The point of this is to record the exact font face for gfxTextRun glyph
  * indices.  The style of this font does not necessarily represent the exact
  * gfxFontStyle used to build the text run.  Notably, the language is not
  * recorded.
  */
 
 /* static */
@@ -2294,46 +2300,46 @@ GetPangoFontMap()
 static PangoContext *
 GetPangoContext()
 {
     PangoContext *context = pango_context_new();
     pango_context_set_font_map(context, GetPangoFontMap());
     return context;
 }
 
-gfxFcPangoFontSet *
+gfxFcFontSet *
 gfxPangoFontGroup::GetBaseFontSet()
 {
     if (mFontSets.Length() > 0)
         return mFontSets[0].mFontSet;
 
     mSizeAdjustFactor = 1.0; // will be adjusted below if necessary
     nsAutoRef<FcPattern> pattern;
-    nsRefPtr<gfxFcPangoFontSet> fontSet =
+    nsRefPtr<gfxFcFontSet> fontSet =
         MakeFontSet(mPangoLanguage, mSizeAdjustFactor, &pattern);
 
     double size = GetPixelSize(pattern);
     if (size != 0.0 && mStyle.sizeAdjust != 0.0) {
-        gfxFcFont *font =
-            gfxPangoFcFont::GfxFont(GFX_PANGO_FC_FONT(fontSet->GetFontAt(0)));
+        gfxFcFont *font = gfxPangoFcFont::
+            GfxFont(GFX_PANGO_FC_FONT(fontSet->GetPangoFontAt(0)));
         if (font) {
             const gfxFont::Metrics& metrics = font->GetMetrics();
 
             // The factor of 0.1 ensures that xHeight is sane so fonts don't
             // become huge.  Strictly ">" ensures that xHeight and emHeight are
             // not both zero.
             if (metrics.xHeight > 0.1 * metrics.emHeight) {
                 mSizeAdjustFactor =
                     mStyle.sizeAdjust * metrics.emHeight / metrics.xHeight;
 
                 size *= mSizeAdjustFactor;
                 FcPatternDel(pattern, FC_PIXEL_SIZE);
                 FcPatternAddDouble(pattern, FC_PIXEL_SIZE, size);
 
-                fontSet = new gfxFcPangoFontSet(pattern, mUserFontSet);
+                fontSet = new gfxFcFontSet(pattern, mUserFontSet);
             }
         }
     }
 
     PangoLanguage *pangoLang = mPangoLanguage;
     FcChar8 *fcLang;
     if (!pangoLang &&
         FcPatternGetString(pattern, FC_LANG, 0, &fcLang) == FcResultMatch) {
@@ -2401,17 +2407,17 @@ gfxPangoFontGroup::MakeTextRun(const PRU
 PRBool
 gfxPangoFontGroup::CanTakeFastPath(PRUint32 aFlags)
 {
     // Can take fast path only if OPTIMIZE_SPEED is set and IS_RTL isn't.
     // We need to always use Pango for RTL text, in case glyph mirroring is
     // required.
     PRBool speed = aFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED;
     PRBool isRTL = aFlags & gfxTextRunFactory::TEXT_IS_RTL;
-    return speed && !isRTL && PANGO_IS_FC_FONT(GetBasePangoFont());
+    return speed && !isRTL;
 }
 #endif
 
 gfxTextRun *
 gfxPangoFontGroup::MakeTextRun(const PRUnichar *aString, PRUint32 aLength,
                                const Parameters *aParams, PRUint32 aFlags)
 {
     NS_ASSERTION(aLength > 0, "should use MakeEmptyTextRun for zero-length text");
@@ -2954,18 +2960,17 @@ gfxPangoFontGroup::SetMissingGlyphs(gfxT
 }
 
 #if defined(ENABLE_FAST_PATH_8BIT) || defined(ENABLE_FAST_PATH_ALWAYS)
 nsresult
 gfxPangoFontGroup::CreateGlyphRunsFast(gfxTextRun *aTextRun,
                                        const gchar *aUTF8, PRUint32 aUTF8Length)
 {
     const gchar *p = aUTF8;
-    PangoFont *pangofont = GetBasePangoFont();
-    gfxFcFont *gfxFont = gfxPangoFcFont::GfxFont(GFX_PANGO_FC_FONT(pangofont));
+    gfxFcFont *gfxFont = GetBaseFont();
     PRUint32 utf16Offset = 0;
     gfxTextRun::CompressedGlyph g;
     const PRUint32 appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit();
 
     aTextRun->AddGlyphRun(gfxFont, 0);
 
     while (p < aUTF8 + aUTF8Length) {
         // glib-2.12.9: "If p does not point to a valid UTF-8 encoded
@@ -3025,17 +3030,17 @@ gfxPangoFontGroup::CreateGlyphRunsItemiz
                                             PRUint32 aUTF8HeaderLen)
 {
     // This font group and gfxPangoFontMap are recorded on the PangoContext
     // passed to pango_itemize_with_base_dir().
     //
     // pango_itemize_with_base_dir() divides the string into substrings for
     // each language, and queries gfxPangoFontMap::load_fontset() to provide
     // ordered lists of fonts for each language.  gfxPangoFontMap passes the
-    // request back to this font group, which returns a gfxFcPangoFontSet
+    // request back to this font group, which returns a gfxFcFontSet
     // handling the font sorting/selection.
     //
     // For each character, pango_itemize_with_base_dir searches through these
     // lists of fonts for a font with support for the character.  The
     // PangoItems returned represent substrings (or runs) of consectutive
     // characters to be shaped with the same PangoFont and having the same
     // script.
     //
--- a/gfx/thebes/gfxPangoFonts.h
+++ b/gfx/thebes/gfxPangoFonts.h
@@ -52,20 +52,22 @@
 // Enable this to use FreeType to glyph-convert 8bit-only textruns, but use Pango
 // to shape any textruns with non-8bit characters
 // XXX
 #define ENABLE_FAST_PATH_8BIT
 // Enable this to bypass Pango shaping for all textruns.  Don't expect
 // anything other than simple Latin work though!
 //#define ENABLE_FAST_PATH_ALWAYS
 
-class gfxFcPangoFontSet;
+class gfxFcFontSet;
+class gfxFcFont;
 class gfxProxyFontEntry;
 typedef struct _FcPattern FcPattern;
 typedef struct FT_FaceRec_* FT_Face;
+typedef struct FT_LibraryRec_  *FT_Library;
 
 class THEBES_API gfxPangoFontGroup : public gfxFontGroup {
 public:
     gfxPangoFontGroup (const nsAString& families,
                        const gfxFontStyle *aStyle,
                        gfxUserFontSet *aUserFontSet);
     virtual ~gfxPangoFontGroup ();
 
@@ -98,24 +100,24 @@ public:
     PangoFont *GetBasePangoFont();
 
     // A language guessed from the gfxFontStyle
     PangoLanguage *GetPangoLanguage() { return mPangoLanguage; }
 
     // @param aLang [in] language to use for pref fonts and system default font
     //        selection, or NULL for the language guessed from the gfxFontStyle.
     // The FontGroup holds a reference to this set.
-    gfxFcPangoFontSet *GetFontSet(PangoLanguage *aLang = NULL);
+    gfxFcFontSet *GetFontSet(PangoLanguage *aLang = NULL);
 
-protected:
+private:
     class FontSetByLangEntry {
     public:
-        FontSetByLangEntry(PangoLanguage *aLang, gfxFcPangoFontSet *aFontSet);
+        FontSetByLangEntry(PangoLanguage *aLang, gfxFcFontSet *aFontSet);
         PangoLanguage *mLang;
-        nsRefPtr<gfxFcPangoFontSet> mFontSet;
+        nsRefPtr<gfxFcFontSet> mFontSet;
     };
     // There is only one of entry in this array unless characters from scripts
     // of other languages are measured.
     nsAutoTArray<FontSetByLangEntry,1> mFontSets;
 
     gfxFloat mSizeAdjustFactor;
     PangoLanguage *mPangoLanguage;
 
@@ -150,23 +152,26 @@ protected:
 #endif
 
     void GetFcFamilies(nsTArray<nsString> *aFcFamilyList,
                        nsIAtom *aLanguage);
 
     // @param aLang [in] language to use for pref fonts and system font
     //        resolution, or NULL to guess a language from the gfxFontStyle.
     // @param aMatchPattern [out] if non-NULL, will return the pattern used.
-    already_AddRefed<gfxFcPangoFontSet>
+    already_AddRefed<gfxFcFontSet>
     MakeFontSet(PangoLanguage *aLang, gfxFloat aSizeAdjustFactor,
                 nsAutoRef<FcPattern> *aMatchPattern = NULL);
 
-    gfxFcPangoFontSet *GetBaseFontSet();
+    gfxFcFontSet *GetBaseFontSet();
+    gfxFcFont *GetBaseFont();
 
     gfxFloat GetSizeAdjustFactor()
     {
         if (mFontSets.Length() == 0)
             GetBaseFontSet();
         return mSizeAdjustFactor;
     }
+
+    static FT_Library GetFTLibrary();
 };
 
 #endif /* GFX_PANGOFONTS_H */