Kaydet (Commit) 7a416820 authored tarafından Herbert Duerr [hdu]'s avatar Herbert Duerr [hdu]

#i110078# cache dynamic font options

üst 9fd50490
......@@ -51,6 +51,7 @@ class RawBitmap;
class CmapResult;
#include <vcl/outfont.hxx>
#include <vcl/impfont.hxx>
class ServerFontLayout;
#include <vcl/sallayout.hxx>
......@@ -258,11 +259,15 @@ class VCL_DLLPUBLIC ImplServerFontEntry : public ImplFontEntry
{
private:
ServerFont* mpServerFont;
ImplFontOptions maFontOptions;
bool mbGotFontOptions;
bool mbValidFontOptions;
public:
ImplServerFontEntry( ImplFontSelectData& );
virtual ~ImplServerFontEntry();
void SetServerFont( ServerFont* p) { mpServerFont = p; }
void HandleFontOptions();
};
// =======================================================================
......
......@@ -519,8 +519,10 @@ bool ServerFont::IsGlyphInvisible( int nGlyphIndex )
// =======================================================================
ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )
: ImplFontEntry( rFSD ),
mpServerFont( NULL )
: ImplFontEntry( rFSD )
, mpServerFont( NULL )
, mbGotFontOptions( false )
, mbValidFontOptions( false )
{}
// -----------------------------------------------------------------------
......
......@@ -641,13 +641,11 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
mpServerFont[ nFallbackLevel ] = pServerFont;
// apply font specific-hint settings if needed
// TODO: also disable it for reference devices
if( !bPrinter_ )
{
// TODO: is it worth it to cache the hint settings, e.g. in the ImplFontEntry?
ImplFontOptions aFontOptions;
bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions&);
if( GetFCFontOptions( *pEntry->mpFontData, pEntry->mnHeight, aFontOptions ) )
pServerFont->SetFontOptions( aFontOptions );
ImplServerFontEntry* pSFE = static_cast<ImplServerFontEntry*>( pEntry->mpFontEntry );
pSFE->HandleFontOptions();
}
return true;
......@@ -656,6 +654,24 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
return false;
}
void ImplServerFontEntry::HandleFontOptions( void )
{
bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions& );
if( !mpServerFont )
return;
if( !mbGotFontOptions )
{
// get and cache the font options
mbGotFontOptions = true;
mbValidFontOptions = GetFCFontOptions( *maFontSelData.mpFontData,
maFontSelData.mnHeight, maFontOptions );
}
// apply the font options
if( mbValidFontOptions )
mpServerFont->SetFontOptions( maFontOptions );
}
//--------------------------------------------------------------------------
inline sal_Unicode SwapBytes( const sal_Unicode nIn )
......@@ -1666,7 +1682,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
default:
aInfo.m_eItalic = psp::italic::Unknown;
break;
}
// set weight
switch( rFontAttributes.GetWeight() )
......@@ -1742,7 +1757,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
const psp::PrintFontManager& rPFM = psp::PrintFontManager::get();
bool bOK = rPFM.getFontOptions( aInfo, nSize, cairosubcallback, rFontOptions);
return bOK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment