Commits

hdu  committed e185e71

#i88303# dynamically match the system's font options (thanks cmc!)

  • Participants
  • Parent commits 3ea09ab

Comments (0)

Files changed (7)

File vcl/inc/vcl/glyphcache.hxx

     struct IFSD_Hash{ size_t operator()( const ImplFontSelectData& ) const; };
     typedef ::std::hash_map<ImplFontSelectData,ServerFont*,IFSD_Hash,IFSD_Equal > FontList;
     FontList                    maFontList;
-
+public:
     ULONG                       mnMaxSize;      // max overall cache size in bytes
+private:
     mutable ULONG               mnBytesUsed;
     mutable long                mnLruIndex;
     mutable int                 mnGlyphCount;

File vcl/inc/vcl/settings.hxx

     ULONG                           mnPreferredSymbolsStyle;
     USHORT                          mnSkipDisabledInMenus;
     Wallpaper                       maWorkspaceGradient;
+    const void*                     mpFontOptions;
 };
 
 #define DEFAULT_WORKSPACE_GRADIENT_START_COLOR Color( 0xa3, 0xae, 0xb8 )
     BOOL							GetSkipDisabledInMenus() const
                                         { return (BOOL) mpData->mnSkipDisabledInMenus; }
 
+    void                            SetCairoFontOptions( const void *pOptions )
+                                        { CopyData(); mpData->mpFontOptions = pOptions;  }
+    const void*                     GetCairoFontOptions() const
+                                        { return mpData->mpFontOptions; }
+
     void                            SetAppFont( const Font& rFont )
                                         { CopyData(); mpData->maAppFont = rFont; }
     const Font&                     GetAppFont() const

File vcl/source/app/settings.cxx

     mnToolbarIconSize			= STYLE_TOOLBAR_ICONSIZE_UNKNOWN;
     mnSymbolsStyle				= STYLE_SYMBOLS_AUTO;
     mnPreferredSymbolsStyle			= STYLE_SYMBOLS_AUTO;
+    mpFontOptions              = NULL;
 
     SetStandardStyles();
 }
     mnToolbarIconSize			= rData.mnToolbarIconSize;
     mnSymbolsStyle				= rData.mnSymbolsStyle;
     mnPreferredSymbolsStyle			= rData.mnPreferredSymbolsStyle;
+    mpFontOptions               = rData.mpFontOptions;
 }
 
 // -----------------------------------------------------------------------

File vcl/source/window/winproc.cxx

 #include <vcl/dockwin.hxx>
 #include <vcl/salgdi.hxx>
 #include <vcl/menu.hxx>
+#include <vcl/glyphcache.hxx>
 
 #include <dndlcon.hxx>
 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
                 nType = DATACHANGED_DISPLAY;
                 break;
             case SALEVENT_FONTCHANGED:
+            {
+                ULONG nOldSize = GlyphCache::GetInstance().mnMaxSize;
+                GlyphCache::GetInstance().mnMaxSize = 0;
                 OutputDevice::ImplUpdateAllFontData( TRUE );
+                GlyphCache::GetInstance().mnMaxSize = nOldSize;
                 nType = DATACHANGED_FONTS;
                 break;
+            }
             case SALEVENT_DATETIMECHANGED:
                 nType = DATACHANGED_DATETIME;
                 break;

File vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx

     //  FIXME: need some way of fetching toolbar icon size.
 //	aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_SMALL );
 
+    const cairo_font_options_t *pNewOptions = 0;
+    if (GdkScreen* pScreen = gdk_display_get_screen( gdk_display_get_default(), m_nScreen ))
+        pNewOptions = gdk_screen_get_font_options(pScreen);
+    aStyleSet.SetCairoFontOptions( pNewOptions );
+
     // finally update the collected settings
     rSettings.SetStyleSettings( aStyleSet );
 

File vcl/unx/gtk/window/gtkframe.cxx

     // redraw itself to adjust to the new style
     // where there IS no new style resulting in tremendous unnecessary flickering
     if( pPrevious != NULL )
+    {
         // signalStyleSet does NOT usually have the gdk lock
         // so post user event to safely dispatch the SALEVENT_SETTINGSCHANGED
         // note: settings changed for multiple frames is avoided in winproc.cxx ImplHandleSettings
         pThis->getDisplay()->SendInternalEvent( pThis, NULL, SALEVENT_SETTINGSCHANGED );
+        pThis->getDisplay()->SendInternalEvent( pThis, NULL, SALEVENT_FONTCHANGED );
+    }
 
     /* #i64117# gtk sets a nice background pixmap
     *  but we actually don't really want that, so save

File vcl/unx/source/gdi/salgdi3.cxx

     cairo_t *cr = rCairo.create(surface);
     rCairo.surface_destroy(surface);
 
+    if (const void *pOptions = Application::GetSettings().GetStyleSettings().GetCairoFontOptions())
+        rCairo.set_font_options( cr, pOptions);
+
     if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
     {
 	for (long i = 0; i < pClipRegion_->numRects; ++i)