Anonymous avatar Anonymous committed 501d328

#i108914# avoid construction of OutputDevice in SalGraphics layers
by splitting off ServerFont::SetFontOptions() from ServerFont constructor

Comments (0)

Files changed (3)

vcl/inc/vcl/glyphcache.hxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: glyphcache.hxx,v $
- * $Revision: 1.4 $
  *
  * This file is part of OpenOffice.org.
  *
 class ServerFontLayout;
 class ExtraKernInfo;
 struct ImplKernPairData;
+class ImplFontOptions;
 
 #include <tools/gen.hxx>
 #include <hash_map>
     virtual bool                TestFont() const            { return true; }
     virtual void*               GetFtFace() const { return 0; }
     virtual int                 GetLoadFlags() const { return 0; }
+    virtual void                SetFontOptions( const ImplFontOptions&) {}
     virtual bool                NeedsArtificialBold() const { return false; }
-    virtual bool		        NeedsArtificialItalic() const { return false; }
+    virtual bool                NeedsArtificialItalic() const { return false; }
 
     const ImplFontSelectData&   GetFontSelData() const      { return maFontSelData; }
 
 protected:
     friend class GlyphCache;
     friend class ServerFontLayout;
-                                ServerFont( const ImplFontSelectData& );
+    explicit                    ServerFont( const ImplFontSelectData& );
     virtual                     ~ServerFont();
 
     void                        AddRef() const      { ++mnRefCount; }

vcl/source/glyphs/gcach_ftyp.cxx

     mbArtItalic = (rFSD.meItalic != ITALIC_NONE && pFI->GetFontAttributes().GetSlant() == ITALIC_NONE);
     mbArtBold = (rFSD.meWeight > WEIGHT_MEDIUM && pFI->GetFontAttributes().GetWeight() <= WEIGHT_MEDIUM);
     mbUseGamma = false;
-    if (mbArtBold)
+    if( mbArtBold )
     {
 	    //static const int TT_CODEPAGE_RANGE_874  = (1L << 16); // Thai
 	    //static const int TT_CODEPAGE_RANGE_932  = (1L << 17); // JIS/Japan
 		mbUseGamma = true;
     }
 
-    ImplFontHints aHints;
-    VirtualDevice vdev( 1 );
-    vdev.ImplGetFontHints( pFI->GetFontAttributes(), mnWidth, aHints );
+    if( ((mnCos != 0) && (mnSin != 0)) || (mnPrioEmbedded <= 0) )
+        mnLoadFlags |= FT_LOAD_NO_BITMAP;
+}
 
-    FontAutoHint eHint = aHints.GetUseAutoHint();
-    if (eHint == AUTOHINT_DONTKNOW)
+void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions)
+{
+    FontAutoHint eHint = rFontOptions.GetUseAutoHint();
+    if( eHint == AUTOHINT_DONTKNOW )
         eHint = mbUseGamma ? AUTOHINT_TRUE : AUTOHINT_FALSE;
 
-    if (eHint == AUTOHINT_TRUE)
+    if( eHint == AUTOHINT_TRUE )
         mnLoadFlags |= FT_LOAD_FORCE_AUTOHINT;
 
     if( (mnSin != 0) && (mnCos != 0) ) // hinting for 0/90/180/270 degrees only
         mnLoadFlags |= FT_LOAD_NO_HINTING;
     mnLoadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; //#88334#
 
-    if (aHints.DontUseAntiAlias())
+    if( rFontOptions.DontUseAntiAlias() )
       mnPrioAntiAlias = 0;
-    if (aHints.DontUseEmbeddedBitmaps())
+    if( rFontOptions.DontUseEmbeddedBitmaps() )
       mnPrioEmbedded = 0;
-    if (aHints.DontUseHinting())
+    if( rFontOptions.DontUseHinting() )
       mnPrioAutoHint = 0;
 
 #if (FTVERSION >= 2005) || defined(TT_CONFIG_OPTION_BYTECODE_INTERPRETER)
     if( !(mnLoadFlags & FT_LOAD_NO_HINTING) && (nFTVERSION >= 2103))
     {
        mnLoadFlags |= FT_LOAD_TARGET_NORMAL;
-       switch (aHints.GetHintStyle())
+       switch( rFontOptions.GetHintStyle() )
        {
            case HINT_NONE:
                 mnLoadFlags |= FT_LOAD_NO_HINTING;
                 break;
        }
     }
-
 #endif
-
-    if( ((mnCos != 0) && (mnSin != 0)) || (mnPrioEmbedded <= 0) )
-        mnLoadFlags |= FT_LOAD_NO_BITMAP;
 }
 
 // -----------------------------------------------------------------------
         nLoadFlags |= FT_LOAD_NO_BITMAP;
 
 #if (FTVERSION >= 2002)
-    // for 0/90/180/270 degree fonts enable autohinting even if not advisable
+    // for 0/90/180/270 degree fonts enable hinting even if not advisable
     // non-hinted and non-antialiased bitmaps just look too ugly
     if( (mnCos==0 || mnSin==0) && (mnPrioAutoHint > 0) )
         nLoadFlags &= ~FT_LOAD_NO_HINTING;

vcl/source/glyphs/gcach_ftyp.hxx

 
 #include <ft2build.h>
 #include FT_FREETYPE_H
+
 class FreetypeServerFont;
 struct FT_GlyphRec_;
 
     virtual int                 GetFontFaceNum() const { return mpFontInfo->GetFaceNum(); }
     virtual bool                TestFont() const;
     virtual void*               GetFtFace() const;
-    virtual int               	GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
+    virtual void                SetFontOptions( const ImplFontOptions&);
+    virtual int                 GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
     virtual bool                NeedsArtificialBold() const { return mbArtBold; }
     virtual bool                NeedsArtificialItalic() const { return mbArtItalic; }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.