Make GetDevFont() return a CFX_Font* instead of void*

Then we can remove a bunch of casts.

Review-Url: https://codereview.chromium.org/2033243004
diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp
index 8834bd8..8370b2f 100644
--- a/xfa/fde/fde_gedevice.cpp
+++ b/xfa/fde/fde_gedevice.cpp
@@ -110,10 +110,9 @@
                                       int32_t iCount,
                                       FX_FLOAT fFontSize,
                                       const CFX_Matrix* pMatrix) {
-  ASSERT(pBrush != NULL && pFont != NULL && pCharPos != NULL && iCount > 0);
+  ASSERT(pBrush && pFont && pCharPos && iCount > 0);
   CFX_FontCache* pCache = CFX_GEModule::Get()->GetFontCache();
-  CFX_Font* pFxFont = (CFX_Font*)pFont->GetDevFont();
-
+  CFX_Font* pFxFont = pFont->GetDevFont();
   FX_ARGB argb = pBrush->GetColor();
   if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 &&
       !pFxFont->IsItalic()) {
@@ -149,9 +148,8 @@
     pCP->m_GlyphIndex &= 0x00FFFFFF;
     pCP->m_bFontStyle = FALSE;
     if (pCurFont != pSTFont) {
-      if (pCurFont != NULL) {
-        pFxFont = (CFX_Font*)pCurFont->GetDevFont();
-
+      if (pCurFont) {
+        pFxFont = pCurFont->GetDevFont();
 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
         FxFont.SetFace(pFxFont->GetFace());
         m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, pCache,
@@ -171,9 +169,8 @@
     }
     pCP++;
   }
-  if (pCurFont != NULL && iCurCount) {
-    pFxFont = (CFX_Font*)pCurFont->GetDevFont();
-
+  if (pCurFont && iCurCount) {
+    pFxFont = pCurFont->GetDevFont();
 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
     FxFont.SetFace(pFxFont->GetFace());
     FX_BOOL bRet = m_pDevice->DrawNormalText(
diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h
index ea82ec1..5d3a440 100644
--- a/xfa/fgas/font/fgas_font.h
+++ b/xfa/fgas/font/fgas_font.h
@@ -88,7 +88,7 @@
   virtual int32_t GetItalicAngle() const = 0;
   virtual void Reset() = 0;
   virtual IFGAS_Font* GetSubstFont(int32_t iGlyphIndex) const = 0;
-  virtual void* GetDevFont() const = 0;
+  virtual CFX_Font* GetDevFont() const = 0;
   virtual void SetFontProvider(CXFA_PDFFontMgr* pProvider) = 0;
 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
   virtual void SetLogicalFontStyle(uint32_t dwLogFontStyle) = 0;
diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h
index 835fe2c..c818b62 100644
--- a/xfa/fgas/font/fgas_gefont.h
+++ b/xfa/fgas/font/fgas_gefont.h
@@ -49,7 +49,7 @@
   virtual int32_t GetItalicAngle() const;
   virtual void Reset();
   virtual IFGAS_Font* GetSubstFont(int32_t iGlyphIndex) const;
-  virtual void* GetDevFont() const { return (void*)m_pFont; }
+  virtual CFX_Font* GetDevFont() const { return m_pFont; }
   virtual void SetFontProvider(CXFA_PDFFontMgr* pProvider) {
     m_pProvider = pProvider;
   }
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index c19d44d..9ea37cf 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -813,7 +813,7 @@
   if (!pFont)
     return FALSE;
 
-  FXFT_Face pFace = ((CFX_Font*)pFont->GetDevFont())->GetFace();
+  FXFT_Face pFace = pFont->GetDevFont()->GetFace();
   FXFT_CharMap charmap = FXFT_Get_Face_Charmap(pFace);
   if (FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE) != 0)
     return FALSE;
@@ -889,7 +889,7 @@
     if (m_FileAccess2IFXFont.Lookup(dwHash, pFont)) {
       if (pFont) {
         if (pFaceCount)
-          *pFaceCount = ((CFX_Font*)pFont->GetDevFont())->GetFace()->num_faces;
+          *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces;
         return pFont->Retain();
       }
     }
@@ -918,7 +918,7 @@
 
   m_IFXFont2FileRead.SetAt(pFont, pFontStream);
   if (pFaceCount)
-    *pFaceCount = ((CFX_Font*)pFont->GetDevFont())->GetFace()->num_faces;
+    *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces;
 
   return pFont;
 }
@@ -958,7 +958,7 @@
 
   m_IFXFont2FileRead.SetAt(pFont, pFontStream);
   if (pFaceCount)
-    *pFaceCount = ((CFX_Font*)pFont->GetDevFont())->GetFace()->num_faces;
+    *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces;
 
   return pFont;
 }
diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp
index f780a22..1c55f5a 100644
--- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp
+++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp
@@ -113,8 +113,7 @@
   IFWL_ThemeProvider* pTheme = GetAvailableTheme();
   IFGAS_Font* pFont = static_cast<IFGAS_Font*>(
       pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Font));
-  CFX_Font* pCXFont =
-      pFont ? static_cast<CFX_Font*>(pFont->GetDevFont()) : nullptr;
+  CFX_Font* pCXFont = pFont ? pFont->GetDevFont() : nullptr;
   if (pCXFont) {
     m_pBarcodeEngine->SetFont(pCXFont);
   }