diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-07-04 19:24:06 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-07-05 19:38:31 +0200 |
commit | 8e63934c398dd5065f3589c8a7d1b3008f5514d1 (patch) | |
tree | 67db199c97408f47fb3ebaf9f186b347de293db2 /vcl | |
parent | 7dd44125a9c184c21374a47005e303579179805f (diff) |
WIN separate LO shared and embedded fonts
This way we can get rid of the embedded fonts without the reqirement
to re-process all of LO's shared fonts.
Change-Id: I25661a611d43ae05052e5cb9cc21e74ccd06b172
Reviewed-on: https://gerrit.libreoffice.org/75101
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/win/saldata.hxx | 5 | ||||
-rw-r--r-- | vcl/win/app/salinst.cxx | 3 | ||||
-rw-r--r-- | vcl/win/gdi/salfont.cxx | 39 | ||||
-rw-r--r-- | vcl/win/gdi/salgdi.cxx | 7 |
4 files changed, 37 insertions, 17 deletions
diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx index 00f7c787bbea..dd08b7553734 100644 --- a/vcl/inc/win/saldata.hxx +++ b/vcl/inc/win/saldata.hxx @@ -108,7 +108,8 @@ public: DWORD mnAppThreadId; // Id from Application-Thread BOOL mbScrSvrEnabled; // ScreenSaver enabled SalIcon* mpFirstIcon; // icon cache, points to first icon, NULL if none - TempFontItem* mpTempFontItem; + TempFontItem* mpSharedTempFontItem; // LibreOffice shared fonts + TempFontItem* mpOtherTempFontItem; // other temporary fonts (embedded?) bool mbThemeChanged; // true if visual theme was changed: throw away theme handles bool mbThemeMenuSupport; @@ -156,7 +157,7 @@ void ImplClearHDCCache( SalData* pData ); HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp = nullptr ); void ImplReleaseCachedDC( sal_uLong nID ); -void ImplReleaseTempFonts( SalData& ); +void ImplReleaseTempFonts(SalData&, bool bAll); HCURSOR ImplLoadSalCursor( int nId ); HBITMAP ImplLoadSalBitmap( int nId ); diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index c4a290adb092..3a5fd78f743b 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -289,7 +289,8 @@ SalData::SalData() mnAppThreadId = 0; // Id from Application-Thread mbScrSvrEnabled = FALSE; // ScreenSaver enabled mpFirstIcon = nullptr; // icon cache, points to first icon, NULL if none - mpTempFontItem = nullptr; + mpSharedTempFontItem = nullptr; + mpOtherTempFontItem = nullptr; mbThemeChanged = false; // true if visual theme was changed: throw away theme handles mbThemeMenuSupport = false; diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 4ea93e96ce33..0dfd4fdc62a1 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1060,7 +1060,7 @@ struct TempFontItem TempFontItem* mpNextItem; }; -static int lcl_AddFontResource(SalData& rSalData, const OUString& rFontFileURL) +static int lcl_AddFontResource(SalData& rSalData, const OUString& rFontFileURL, bool bShared) { OUString aFontSystemPath; OSL_VERIFY(!osl::FileBase::getSystemPathFromFileURL(rFontFileURL, aFontSystemPath)); @@ -1071,19 +1071,36 @@ static int lcl_AddFontResource(SalData& rSalData, const OUString& rFontFileURL) { TempFontItem* pNewItem = new TempFontItem; pNewItem->maFontResourcePath = aFontSystemPath; - pNewItem->mpNextItem = rSalData.mpTempFontItem; - rSalData.mpTempFontItem = pNewItem; + if (bShared) + { + pNewItem->mpNextItem = rSalData.mpSharedTempFontItem; + rSalData.mpSharedTempFontItem = pNewItem; + } + else + { + pNewItem->mpNextItem = rSalData.mpOtherTempFontItem; + rSalData.mpOtherTempFontItem = pNewItem; + } } return nRet; } -void ImplReleaseTempFonts( SalData& rSalData ) +void ImplReleaseTempFonts(SalData& rSalData, bool bAll) { - while (TempFontItem* p = rSalData.mpTempFontItem) + while (TempFontItem* p = rSalData.mpOtherTempFontItem) + { + RemoveFontResourceExW(o3tl::toW(p->maFontResourcePath.getStr()), FR_PRIVATE, nullptr); + rSalData.mpOtherTempFontItem = p->mpNextItem; + delete p; + } + + if (!bAll) + return; + + while (TempFontItem* p = rSalData.mpSharedTempFontItem) { - RemoveFontResourceExW(o3tl::toW(p->maFontResourcePath.getStr()), - FR_PRIVATE, nullptr); - rSalData.mpTempFontItem = p->mpNextItem; + RemoveFontResourceExW(o3tl::toW(p->maFontResourcePath.getStr()), FR_PRIVATE, nullptr); + rSalData.mpSharedTempFontItem = p->mpNextItem; delete p; } } @@ -1196,7 +1213,7 @@ bool WinSalGraphics::AddTempDevFont(PhysicalFontCollection* pFontCollection, return false; } - int nFonts = lcl_AddFontResource(*GetSalData(), rFontFileURL); + int nFonts = lcl_AddFontResource(*GetSalData(), rFontFileURL, false); if (nFonts <= 0) return false; @@ -1252,7 +1269,7 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection ) osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL ); rcOSL = aDirItem.getFileStatus( aFileStatus ); if ( rcOSL == osl::FileBase::E_None ) - lcl_AddFontResource(*pSalData, aFileStatus.getFileURL()); + lcl_AddFontResource(*pSalData, aFileStatus.getFileURL(), true); } } } @@ -1282,7 +1299,7 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection ) void WinSalGraphics::ClearDevFontCache() { - //anything to do here ? + ImplReleaseTempFonts(*GetSalData(), false); } bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool) const diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx index e4b2eaf203a2..2d4a283bb818 100644 --- a/vcl/win/gdi/salgdi.cxx +++ b/vcl/win/gdi/salgdi.cxx @@ -134,8 +134,9 @@ void ImplInitSalGDI() pSalData->mpHDCCache = new HDCCache[ CACHESIZE_HDC ]; memset( pSalData->mpHDCCache, 0, CACHESIZE_HDC * sizeof( HDCCache ) ); - // initialize temporary font list - pSalData->mpTempFontItem = nullptr; + // initialize temporary font lists + pSalData->mpSharedTempFontItem = nullptr; + pSalData->mpOtherTempFontItem = nullptr; // support palettes for 256 color displays HDC hDC = GetDC( nullptr ); @@ -348,7 +349,7 @@ void ImplFreeSalGDI() } // delete temporary font list - ImplReleaseTempFonts( *pSalData ); + ImplReleaseTempFonts(*pSalData, true); pSalData->mbResourcesAlreadyFreed = true; } |