Bug 385516 - "Console is spewed with WARNING: empty langgroup" (Add default constructor to gfxFontStyle and use it) [p=wasti.redl@gmx.net (Sebastian Redl) r=stuart a1.9=damons]
authorreed@reedloden.com
Wed, 12 Mar 2008 03:52:58 -0700
changeset 12929 801e5e37f6c5c37c6a91db1d2406398ac1ee5051
parent 12928 d76335209063bd8624d8c783255df0d1550060c8
child 12930 e413db0d01bc0cb61917f08bd98c1e07041cf8ae
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstuart
bugs385516
milestone1.9b5pre
Bug 385516 - "Console is spewed with WARNING: empty langgroup" (Add default constructor to gfxFontStyle and use it) [p=wasti.redl@gmx.net (Sebastian Redl) r=stuart a1.9=damons]
gfx/src/thebes/nsSystemFontsBeOS.cpp
gfx/src/thebes/nsSystemFontsGTK2.cpp
gfx/src/thebes/nsThebesDeviceContext.cpp
gfx/thebes/public/gfxFont.h
gfx/thebes/src/gfxFont.cpp
--- a/gfx/src/thebes/nsSystemFontsBeOS.cpp
+++ b/gfx/src/thebes/nsSystemFontsBeOS.cpp
@@ -40,31 +40,20 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include <Font.h>
 #include <Menu.h>
 
 #include "nsIDeviceContext.h"
 #include "nsSystemFontsBeOS.h"
 
-#define DEFAULT_PIXEL_FONT_SIZE 16.0f
-
 nsSystemFontsBeOS::nsSystemFontsBeOS()
   : mDefaultFontName(NS_LITERAL_STRING("sans-serif"))
   , mMenuFontName(NS_LITERAL_STRING("sans-serif"))
   , mCaptionFontName(NS_LITERAL_STRING("sans-serif"))
-  , mDefaultFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
-                 DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
-                 0.0f, PR_TRUE, PR_FALSE)
-  , mMenuFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
-               DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
-               0.0f, PR_TRUE, PR_FALSE)
-  , mCaptionFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
-               DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
-               0.0f, PR_TRUE, PR_FALSE)
 {
   menu_info info;
   get_menu_info(&info);
   BFont menuFont;
   menuFont.SetFamilyAndStyle(info.f_family, info.f_style);
   menuFont.SetSize(info.font_size);
 
   GetSystemFontInfo(be_plain_font, &mDefaultFontName, &mDefaultFontStyle);
--- a/gfx/src/thebes/nsSystemFontsGTK2.cpp
+++ b/gfx/src/thebes/nsSystemFontsGTK2.cpp
@@ -103,35 +103,21 @@ static inline void ShutdownPangoLib()
 
 static inline gboolean
 MOZ_pango_font_description_get_size_is_absolute(PangoFontDescription *desc)
 {
     pango_font_description_get_size_is_absolute(desc);
 }
 #endif
 
-#define DEFAULT_PIXEL_FONT_SIZE 16.0f
-
 nsSystemFontsGTK2::nsSystemFontsGTK2()
   : mDefaultFontName(NS_LITERAL_STRING("sans-serif"))
   , mButtonFontName(NS_LITERAL_STRING("sans-serif"))
   , mFieldFontName(NS_LITERAL_STRING("sans-serif"))
   , mMenuFontName(NS_LITERAL_STRING("sans-serif"))
-  , mDefaultFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
-                 DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
-                 0.0f, PR_TRUE, PR_FALSE)
-  , mButtonFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
-                DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
-                0.0f, PR_TRUE, PR_FALSE)
-  , mFieldFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
-               DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
-               0.0f, PR_TRUE, PR_FALSE)
-  , mMenuFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
-               DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
-               0.0f, PR_TRUE, PR_FALSE)
 {
     InitPangoLib();
 
     /*
      * Much of the widget creation code here is similar to the code in
      * nsLookAndFeel::InitColors().
      */
 
--- a/gfx/src/thebes/nsThebesDeviceContext.cpp
+++ b/gfx/src/thebes/nsThebesDeviceContext.cpp
@@ -389,19 +389,17 @@ nsThebesDeviceContext::GetSystemFont(nsS
 #elif XP_MACOSX
         gSystemFonts = new nsSystemFontsMac();
 #else
 #error Need to know how to create gSystemFonts, fix me!
 #endif
     }
 
     nsString fontName;
-    gfxFontStyle fontStyle(NS_FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, 16.0f,
-                           NS_LITERAL_CSTRING(""), 0.0f, PR_TRUE,
-                           PR_FALSE);
+    gfxFontStyle fontStyle;
     nsresult rv = gSystemFonts->GetSystemFont(aID, &fontName, &fontStyle);
     NS_ENSURE_SUCCESS(rv, rv);
 
     aFont->name = fontName;
     aFont->style = fontStyle.style;
     aFont->systemFont = fontStyle.systemFont;
     aFont->variant = NS_FONT_VARIANT_NORMAL;
     aFont->familyNameQuirks = fontStyle.familyNameQuirks;
--- a/gfx/thebes/public/gfxFont.h
+++ b/gfx/thebes/public/gfxFont.h
@@ -67,16 +67,17 @@ class gfxFontGroup;
 #define FONT_STYLE_OBLIQUE             2
 
 #define FONT_WEIGHT_NORMAL             400
 #define FONT_WEIGHT_BOLD               700
 
 #define FONT_MAX_SIZE                  2000.0
 
 struct THEBES_API gfxFontStyle {
+    gfxFontStyle();
     gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, gfxFloat aSize,
                  const nsACString& aLangGroup,
                  float aSizeAdjust, PRPackedBool aSystemFont,
                  PRPackedBool aFamilyNameQuirks);
     gfxFontStyle(const gfxFontStyle& aStyle);
 
     // The style of font (normal, italic, oblique)
     PRUint8 style : 7;
--- a/gfx/thebes/src/gfxFont.cpp
+++ b/gfx/thebes/src/gfxFont.cpp
@@ -868,16 +868,25 @@ gfxFontGroup::MakeSpaceTextRun(const Par
         textRun->SetSpaceGlyph(font, aParams->mContext, 0);
     }
     // Note that the gfxGlyphExtents glyph bounds storage for the font will
     // always contain an entry for the font's space glyph, so we don't have
     // to call FetchGlyphExtents here.
     return textRun.forget();
 }
 
+#define DEFAULT_PIXEL_FONT_SIZE 16.0f
+
+gfxFontStyle::gfxFontStyle() :
+    style(FONT_STYLE_NORMAL), systemFont(PR_TRUE), familyNameQuirks(PR_FALSE),
+    weight(FONT_WEIGHT_NORMAL), size(DEFAULT_PIXEL_FONT_SIZE),
+    langGroup(NS_LITERAL_CSTRING("x-western")), sizeAdjust(0.0f)
+{
+}
+
 gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, gfxFloat aSize,
                            const nsACString& aLangGroup,
                            float aSizeAdjust, PRPackedBool aSystemFont,
                            PRPackedBool aFamilyNameQuirks) :
     style(aStyle), systemFont(aSystemFont),
     familyNameQuirks(aFamilyNameQuirks), weight(aWeight),
     size(aSize), langGroup(aLangGroup), sizeAdjust(aSizeAdjust)
 {