Bug 587395: Expose whether DWrite is enabled through nsIGfxInfo. r=joedrew
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Mon, 16 Aug 2010 09:15:03 +0200
changeset 50655 2a04d4e8ba195563fdf55fa1e75cddf8278ba8d6
parent 50654 16aa8f0aa149a86158961ebbc23a9cbe5f990464
child 50656 ad71fe3f1827d377961a14c6f69df23f72476a99
push idunknown
push userunknown
push dateunknown
reviewersjoedrew
bugs587395
milestone2.0b4pre
Bug 587395: Expose whether DWrite is enabled through nsIGfxInfo. r=joedrew
gfx/thebes/gfxWindowsPlatform.h
widget/public/nsIGfxInfo.idl
widget/src/windows/GfxInfo.cpp
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -208,16 +208,19 @@ public:
     };
 
     static PRInt32 WindowsOSVersion();
 
     virtual void FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref);
 
 #ifdef CAIRO_HAS_DWRITE_FONT
     IDWriteFactory *GetDWriteFactory() { return mDWriteFactory; }
+    inline PRBool DWriteEnabled() { return !!mDWriteFactory; }
+#else
+    inline PRBool DWriteEnabled() { return PR_FALSE; }
 #endif
 #ifdef CAIRO_HAS_D2D_SURFACE
     cairo_device_t *GetD2DDevice() { return mD2DDevice; }
 #endif
 
 #ifdef MOZ_FT2_FONTS
     FT_Library GetFTLibrary();
 #endif
--- a/widget/public/nsIGfxInfo.idl
+++ b/widget/public/nsIGfxInfo.idl
@@ -33,14 +33,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 
+/* NOTE: this interface is completely undesigned, not stable and likely to change */
+
 [scriptable, uuid(5C05E5B7-0FCC-4070-BF6B-58BC33ECA427)]
 interface nsIGfxInfo : nsISupports
 {
   readonly attribute boolean D2DEnabled;
+  readonly attribute boolean DWriteEnabled;
 };
 
--- a/widget/src/windows/GfxInfo.cpp
+++ b/widget/src/windows/GfxInfo.cpp
@@ -42,8 +42,14 @@ using namespace mozilla::widget;
 
 NS_IMPL_ISUPPORTS1(GfxInfo, nsIGfxInfo)
 
 nsresult GfxInfo::GetD2DEnabled(PRBool *aEnabled)
 {
   *aEnabled = gfxWindowsPlatform::GetPlatform()->GetRenderMode() == gfxWindowsPlatform::RENDER_DIRECT2D;
   return NS_OK;
 }
+
+nsresult GfxInfo::GetDWriteEnabled(PRBool *aEnabled)
+{
+  *aEnabled = gfxWindowsPlatform::GetPlatform()->DWriteEnabled();
+  return NS_OK;
+}