[Libreoffice-commits] .: vcl/inc vcl/unx

Caolán McNamara caolan at kemper.freedesktop.org
Fri Aug 19 04:20:09 PDT 2011


 vcl/inc/unx/glyphcache.hxx            |    2 +-
 vcl/inc/unx/salgdi.h                  |    6 ++++--
 vcl/unx/generic/gdi/salgdi3.cxx       |   32 +++++---------------------------
 vcl/unx/generic/glyphs/gcach_ftyp.cxx |    2 +-
 4 files changed, 11 insertions(+), 31 deletions(-)

New commits:
commit 1ee8a779c21e8d6f6a85a4e0bcefee227bff5a94
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 19 11:58:59 2011 +0100

    now cairo is the only way to render text under X

diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index d9c84c8..164bc0c 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -194,7 +194,7 @@ public:
     const ::rtl::OString* GetFontFileName() const;
     int                 GetFontFaceNumber() const;
     bool                TestFont() const;
-    void*               GetFtFace() const;
+    FT_Face             GetFtFace() const;
     int                 GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
     void                SetFontOptions( boost::shared_ptr<ImplFontOptions> );
     boost::shared_ptr<ImplFontOptions> GetFontOptions() const;
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index fba9240..a44a3f5 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -64,18 +64,20 @@ namespace basegfx {
 
 // -=-= SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+typedef struct FT_FaceRec_* FT_Face;
+
 class CairoFontsCache
 {
 public:
     struct CacheId
     {
-        const void *mpFace;
+        FT_Face maFace;
         const void *mpOptions;
         bool mbEmbolden;
         bool mbVerticalMetrics;
         bool operator ==(const CacheId& rOther) const
         {
-            return mpFace == rOther.mpFace &&
+            return maFace == rOther.maFace &&
                 mpOptions == rOther.mpOptions &&
                 mbEmbolden == rOther.mbEmbolden &&
                 mbVerticalMetrics == rOther.mbVerticalMetrics;
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index 1b33ba4..ca0385b 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -235,14 +235,6 @@ void ImplServerFontEntry::HandleFontOptions( void )
 
 //--------------------------------------------------------------------------
 
-namespace
-{
-    bool isCairoRenderable(const ServerFont& rFont)
-    {
-        return rFont.GetFtFace();
-    }
-} //namespace
-
 CairoFontsCache::LRUFonts CairoFontsCache::maLRUFonts;
 int CairoFontsCache::mnRefCount = 0;
 
@@ -370,9 +362,9 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
 
     ServerFont& rFont = rLayout.GetServerFont();
 
-    void* pFace = rFont.GetFtFace();
+    FT_Face aFace = rFont.GetFtFace();
     CairoFontsCache::CacheId aId;
-    aId.mpFace = pFace;
+    aId.maFace = aFace;
     aId.mpOptions = rFont.GetFontOptions().get();
     aId.mbEmbolden = rFont.NeedsArtificialBold();
 
@@ -398,11 +390,11 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
         if (!font_face)
         {
             const ImplFontOptions *pOptions = rFont.GetFontOptions().get();
-            void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden, aId.mbVerticalMetrics) : NULL;
+            void *pPattern = pOptions ? pOptions->GetPattern(aFace, aId.mbEmbolden, aId.mbVerticalMetrics) : NULL;
             if (pPattern)
                 font_face = cairo_ft_font_face_create_for_pattern(reinterpret_cast<FcPattern*>(pPattern));
             if (!font_face)
-                font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(pFace), rFont.GetLoadFlags());
+                font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(aFace), rFont.GetLoadFlags());
             m_aCairoFontsCache.CacheFont(font_face, aId);
         }
         cairo_set_font_face(cr, font_face);
@@ -427,7 +419,6 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
             cairo_matrix_init_identity(&em_square);
             cairo_get_matrix(cr, &em_square);
 
-            FT_Face aFace = reinterpret_cast<FT_Face>(pFace);
             cairo_matrix_scale(&em_square, aFace->units_per_EM,
                 aFace->units_per_EM);
             cairo_set_matrix(cr, &em_square);
@@ -832,20 +823,7 @@ void X11SalGraphics::DrawServerSimpleFontString( const ServerFontLayout& rSalLay
 
 void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
 {
-    // draw complex text
-    ServerFont& rFont = rLayout.GetServerFont();
-    if( isCairoRenderable(rFont) )
-        DrawCairoAAFontString( rLayout );
-    else
-    {
-        X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer();
-        if( rGlyphPeer.GetGlyphSet( rFont, m_nScreen ) )
-            DrawServerAAFontString( rLayout );
-        else if( !rGlyphPeer.ForcedAntialiasing( rFont, m_nScreen ) )
-            DrawServerSimpleFontString( rLayout );
-        else
-            DrawServerAAForcedString( rLayout );
-    }
+    DrawCairoAAFontString( rLayout );
 }
 
 //--------------------------------------------------------------------------
diff --git a/vcl/unx/generic/glyphs/gcach_ftyp.cxx b/vcl/unx/generic/glyphs/gcach_ftyp.cxx
index c110650..e2cf92d 100644
--- a/vcl/unx/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/unx/generic/glyphs/gcach_ftyp.cxx
@@ -577,7 +577,7 @@ FreetypeManager::FreetypeManager()
 
 // -----------------------------------------------------------------------
 
-void* ServerFont::GetFtFace() const
+FT_Face ServerFont::GetFtFace() const
 {
     if( maSizeFT )
         pFTActivateSize( maSizeFT );


More information about the Libreoffice-commits mailing list