From bba109e020aa4b9b23a210e594d92b40d0ae863c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 22 Mar 2011 13:01:33 +0000 Subject: [PATCH] Fix fontoptions cache --- ...an-Knot-of-who-owns-the-font-options.patch | 153 ++++++++++++++++++ libreoffice.spec | 6 +- 2 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 0001-Cut-Gordian-Knot-of-who-owns-the-font-options.patch diff --git a/0001-Cut-Gordian-Knot-of-who-owns-the-font-options.patch b/0001-Cut-Gordian-Knot-of-who-owns-the-font-options.patch new file mode 100644 index 0000000..9b70f72 --- /dev/null +++ b/0001-Cut-Gordian-Knot-of-who-owns-the-font-options.patch @@ -0,0 +1,153 @@ +From 22ec51681687c4d700336603f6f37e981ad37bf2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Tue, 22 Mar 2011 12:59:42 +0000 +Subject: [PATCH] Cut Gordian Knot of who owns the font options + +--- + vcl/inc/vcl/glyphcache.hxx | 8 +++++--- + vcl/source/glyphs/gcach_ftyp.cxx | 5 ++--- + vcl/source/glyphs/gcach_ftyp.hxx | 6 +++--- + vcl/source/glyphs/glyphcache.cxx | 2 -- + vcl/unx/source/gdi/salgdi3.cxx | 8 ++++---- + 5 files changed, 14 insertions(+), 15 deletions(-) + +diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx +index 351eb13..6a375a4 100644 +--- a/vcl/inc/vcl/glyphcache.hxx ++++ b/vcl/inc/vcl/glyphcache.hxx +@@ -45,6 +45,7 @@ class ImplFontOptions; + #include + #include + #include ++#include + + namespace basegfx { class B2DPolyPolygon; } + +@@ -186,8 +187,9 @@ public: + virtual bool TestFont() const { return true; } + virtual void* GetFtFace() const { return 0; } + virtual int GetLoadFlags() const { return 0; } +- virtual void SetFontOptions( const ImplFontOptions*) {} +- virtual const ImplFontOptions* GetFontOptions() const { return 0; } ++ virtual void SetFontOptions( boost::shared_ptr ) {} ++ virtual boost::shared_ptr GetFontOptions() const ++ { return boost::shared_ptr(); } + virtual bool NeedsArtificialBold() const { return false; } + virtual bool NeedsArtificialItalic() const { return false; } + +@@ -266,7 +268,7 @@ class VCL_PLUGIN_PUBLIC ImplServerFontEntry : public ImplFontEntry + { + private: + ServerFont* mpServerFont; +- ImplFontOptions* mpFontOptions; ++ boost::shared_ptr mpFontOptions; + bool mbGotFontOptions; + + public: +diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx +index 3de5082..d482916 100644 +--- a/vcl/source/glyphs/gcach_ftyp.cxx ++++ b/vcl/source/glyphs/gcach_ftyp.cxx +@@ -769,7 +769,6 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn + mpFontInfo( pFI ), + maFaceFT( NULL ), + maSizeFT( NULL ), +- mpFontOptions( NULL ), + mbFaceOk( false ), + maRecodeConverter( NULL ), + mpLayoutEngine( NULL ) +@@ -915,7 +914,7 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn + mnLoadFlags |= FT_LOAD_NO_BITMAP; + } + +-void FreetypeServerFont::SetFontOptions( const ImplFontOptions* pFontOptions) ++void FreetypeServerFont::SetFontOptions( boost::shared_ptr pFontOptions) + { + mpFontOptions = pFontOptions; + +@@ -970,7 +969,7 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions* pFontOptions) + mnLoadFlags |= FT_LOAD_NO_BITMAP; + } + +-const ImplFontOptions* FreetypeServerFont::GetFontOptions() const ++boost::shared_ptr FreetypeServerFont::GetFontOptions() const + { + return mpFontOptions; + } +diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx +index 8ebef45..0af4ed1 100644 +--- a/vcl/source/glyphs/gcach_ftyp.hxx ++++ b/vcl/source/glyphs/gcach_ftyp.hxx +@@ -191,8 +191,8 @@ public: + virtual int GetFontFaceNum() const { return mpFontInfo->GetFaceNum(); } + virtual bool TestFont() const; + virtual void* GetFtFace() const; +- virtual void SetFontOptions( const ImplFontOptions*); +- virtual const ImplFontOptions* GetFontOptions() const; ++ virtual void SetFontOptions( boost::shared_ptr ); ++ virtual boost::shared_ptr GetFontOptions() const; + virtual int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); } + virtual bool NeedsArtificialBold() const { return mbArtBold; } + virtual bool NeedsArtificialItalic() const { return mbArtItalic; } +@@ -239,7 +239,7 @@ private: + FT_FaceRec_* maFaceFT; + FT_SizeRec_* maSizeFT; + +- const ImplFontOptions* mpFontOptions; ++ boost::shared_ptr mpFontOptions; + + bool mbFaceOk; + bool mbArtItalic; +diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx +index 649ffb4..373c430 100644 +--- a/vcl/source/glyphs/glyphcache.cxx ++++ b/vcl/source/glyphs/glyphcache.cxx +@@ -534,7 +534,6 @@ bool ServerFont::IsGlyphInvisible( int nGlyphIndex ) + ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD ) + : ImplFontEntry( rFSD ) + , mpServerFont( NULL ) +-, mpFontOptions( NULL ) + , mbGotFontOptions( false ) + {} + +@@ -543,7 +542,6 @@ ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD ) + ImplServerFontEntry::~ImplServerFontEntry() + { + // TODO: remove the ServerFont here instead of in the GlyphCache +- delete mpFontOptions; + } + + // ======================================================================= +diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx +index 20fd3cd..4365356 100644 +--- a/vcl/unx/source/gdi/salgdi3.cxx ++++ b/vcl/unx/source/gdi/salgdi3.cxx +@@ -236,8 +236,8 @@ void ImplServerFontEntry::HandleFontOptions( void ) + { + // get and cache the font options + mbGotFontOptions = true; +- mpFontOptions = GetFCFontOptions( *maFontSelData.mpFontData, +- maFontSelData.mnHeight ); ++ mpFontOptions.reset(GetFCFontOptions( *maFontSelData.mpFontData, ++ maFontSelData.mnHeight )); + } + // apply the font options + mpServerFont->SetFontOptions( mpFontOptions ); +@@ -536,12 +536,12 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) + void* pFace = rFont.GetFtFace(); + CairoFontsCache::CacheId aId; + aId.mpFace = pFace; +- aId.mpOptions = rFont.GetFontOptions(); ++ aId.mpOptions = rFont.GetFontOptions().get(); + aId.mbEmbolden = rFont.NeedsArtificialBold(); + font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(aId); + if (!font_face) + { +- const ImplFontOptions *pOptions = rFont.GetFontOptions(); ++ const ImplFontOptions *pOptions = rFont.GetFontOptions().get(); + void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden) : NULL; + if (pPattern) + font_face = rCairo.ft_font_face_create_for_pattern(pPattern); +-- +1.7.4.1 + diff --git a/libreoffice.spec b/libreoffice.spec index 05f571b..2abb460 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -29,7 +29,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: 3.3.1.2 -Release: 11%{?dist} +Release: 12%{?dist} License: LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and (CDDL or GPLv2) and Public Domain Group: Applications/Productivity URL: http://www.documentfoundation.org/develop @@ -129,6 +129,7 @@ Patch40: 0001-add-cairo_ft_font_face_create_for_pattern-wrapper.patch Patch41: 0001-Related-rhbz-680460-reorganize-this-to-make-it-inher.patch Patch42: 0001-Related-rhbz-680460-don-t-bother-with-an-interim-Fon.patch Patch43: 0001-Resolves-rhbz-680460-honour-lcdfilter-subpixeling-et.patch +Patch44: 0001-Cut-Gordian-Knot-of-who-owns-the-font-options.patch %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %define instdir %{_libdir} @@ -2121,6 +2122,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %{basisinstdir}/program/kde-open-url %changelog +* Tue Mar 22 2011 Caolán McNamara 3.3.1.2-12 +- Fix fontoptions cache + * Mon Mar 21 2011 Caolán McNamara 3.3.1.2-11 - Resolves: rhbz#689268 autocorrs from OOo F14 not upgraded