[Libreoffice-commits] core.git: officecfg/registry vcl/inc vcl/source

2023-03-17 Thread Khaled Hosny (via logerrit)
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |6 ++-
 vcl/inc/impfontmetricdata.hxx  |2 -
 vcl/source/font/fontmetric.cxx |   20 +++--
 3 files changed, 11 insertions(+), 17 deletions(-)

New commits:
commit 6f54b54ec3dc51fb8824adb08620fde4c70d10f2
Author: Khaled Hosny 
AuthorDate: Sat Mar 18 00:52:04 2023 +0200
Commit: خالد حسني 
CommitDate: Sat Mar 18 02:08:39 2023 +

tdf#154235: Ignore underline metrics for all Liberation fonts

They all have bad metrics and we are better off synthesising metrics for
them instead. Also simplify the exception list to only use family name.

Change-Id: I9e13bc05bdf56a31e9805fcd348439d191ed3a3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149072
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index fb262b8e7ab3..714fa8ccc485 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5613,8 +5613,10 @@
   
 
 
-  
-  Liberation Serif,100,-123,100,420
+  
+  Liberation Serif
+  Liberation Sans
+  Liberation Mono
 
   
   
diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx
index 5625cfa726b5..63394a93eb23 100644
--- a/vcl/inc/impfontmetricdata.hxx
+++ b/vcl/inc/impfontmetricdata.hxx
@@ -102,7 +102,7 @@ public:
 voidImplInitBaselines(LogicalFontInstance *pFontInstance);
 
 private:
-boolShouldNotUseUnderlineMetrics(int, int, int, int) const;
+boolShouldNotUseUnderlineMetrics() const;
 boolImplInitTextLineSizeHarfBuzz(LogicalFontInstance 
*pFontInstance);
 boolShouldUseWinMetrics(int, int, int, int, int, int) const;
 
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 3f87950d5314..8a998c6815c6 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -176,23 +176,16 @@ ImplFontMetricData::ImplFontMetricData( const 
vcl::font::FontSelectPattern& rFon
 SetStyleName( rFontSelData.GetStyleName() );
 }
 
-bool ImplFontMetricData::ShouldNotUseUnderlineMetrics(int nUnderlineSize, int 
nUnderlineOffset,
-  int nStrikeoutSize,
-  int nStrikeoutOffset) 
const
+bool ImplFontMetricData::ShouldNotUseUnderlineMetrics() const
 {
 if (utl::ConfigManager::IsFuzzing())
 return false;
 
-OUString aFontIdentifier(GetFamilyName() + "," + 
OUString::number(nUnderlineSize) + ","
- + OUString::number(nUnderlineOffset) + ","
- + OUString::number(nStrikeoutSize) + ","
- + OUString::number(nStrikeoutOffset));
-
 css::uno::Sequence rNoUnderlineMetricsList(
 officecfg::Office::Common::Misc::FontsDontUseUnderlineMetrics::get());
-if (comphelper::findValue(rNoUnderlineMetricsList, aFontIdentifier) != -1)
+if (comphelper::findValue(rNoUnderlineMetricsList, GetFamilyName()) != -1)
 {
-SAL_INFO("vcl.gdi.fontmetric", "Not using underline metrics for: " << 
aFontIdentifier);
+SAL_INFO("vcl.gdi.fontmetric", "Not using underline metrics for: " << 
GetFamilyName());
 return true;
 }
 return false;
@@ -200,6 +193,9 @@ bool ImplFontMetricData::ShouldNotUseUnderlineMetrics(int 
nUnderlineSize, int nU
 
 bool ImplFontMetricData::ImplInitTextLineSizeHarfBuzz(LogicalFontInstance* 
pFont)
 {
+if (ShouldNotUseUnderlineMetrics())
+return false;
+
 auto* pHbFont = pFont->GetHbFont();
 
 hb_position_t nUnderlineSize;
@@ -215,10 +211,6 @@ bool 
ImplFontMetricData::ImplInitTextLineSizeHarfBuzz(LogicalFontInstance* pFont
 if (!hb_ot_metrics_get_position(pHbFont, 
HB_OT_METRICS_TAG_STRIKEOUT_OFFSET, ))
 return false;
 
-if (ShouldNotUseUnderlineMetrics(nUnderlineSize, nUnderlineOffset, 
nStrikeoutSize,
- nStrikeoutOffset))
-return false;
-
 double fScale = 0;
 pFont->GetScale(nullptr, );
 


[Libreoffice-commits] core.git: officecfg/registry vcl/inc vcl/source

2022-12-10 Thread Khaled Hosny (via logerrit)
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   12 ++
 vcl/inc/impfontmetricdata.hxx  |1 
 vcl/source/font/fontmetric.cxx |   23 +
 3 files changed, 36 insertions(+)

New commits:
commit 840904c05f4799986d78033f05b4d38f58a59994
Author: Khaled Hosny 
AuthorDate: Sat Dec 10 20:44:03 2022 +0200
Commit: خالد حسني 
CommitDate: Sat Dec 10 21:22:32 2022 +

tdf#152267: Strike out changed to underline in small zoom

The font has bogus value in the regular style. Add configuration
support for ignoring metrics of such fonts, similar to what we do with
line metrics.

Change-Id: Ia7cfb44400601e89b8425c9a1144f630f67569f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143648
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 4214307173da..e85864df367d 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5443,6 +5443,18 @@
   DIN Light,1509,-503,1509,-483,1997,483
 
   
+  
+
+  
+Fonts where the underline or striketout metrics need to be ignored 
in order to draw the underline or strikeout correctly.
+Fonts are identified by their name and the underline metrics (see 
fontmetric.cxx:ShouldNotUseUnderlineMetrics).
+  
+
+
+  
+  Liberation Serif,100,-123,100,420
+
+  
   
 
 
diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx
index a94e41540755..5625cfa726b5 100644
--- a/vcl/inc/impfontmetricdata.hxx
+++ b/vcl/inc/impfontmetricdata.hxx
@@ -102,6 +102,7 @@ public:
 voidImplInitBaselines(LogicalFontInstance *pFontInstance);
 
 private:
+boolShouldNotUseUnderlineMetrics(int, int, int, int) const;
 boolImplInitTextLineSizeHarfBuzz(LogicalFontInstance 
*pFontInstance);
 boolShouldUseWinMetrics(int, int, int, int, int, int) const;
 
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index a0959dfc6900..4ee3020b23f4 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -176,6 +176,25 @@ ImplFontMetricData::ImplFontMetricData( const 
vcl::font::FontSelectPattern& rFon
 SetStyleName( rFontSelData.GetStyleName() );
 }
 
+bool ImplFontMetricData::ShouldNotUseUnderlineMetrics(int nUnderlineSize, int 
nUnderlineOffset,
+  int nStrikeoutSize,
+  int nStrikeoutOffset) 
const
+{
+OUString aFontIdentifier(GetFamilyName() + "," + 
OUString::number(nUnderlineSize) + ","
+ + OUString::number(nUnderlineOffset) + ","
+ + OUString::number(nStrikeoutSize) + ","
+ + OUString::number(nStrikeoutOffset));
+
+css::uno::Sequence rNoUnderlineMetricsList(
+officecfg::Office::Common::Misc::FontsDontUseUnderlineMetrics::get());
+if (comphelper::findValue(rNoUnderlineMetricsList, aFontIdentifier) != -1)
+{
+SAL_INFO("vcl.gdi.fontmetric", "Not using underline metrics for: " << 
aFontIdentifier);
+return true;
+}
+return false;
+}
+
 bool ImplFontMetricData::ImplInitTextLineSizeHarfBuzz(LogicalFontInstance* 
pFont)
 {
 auto* pHbFont = pFont->GetHbFont();
@@ -193,6 +212,10 @@ bool 
ImplFontMetricData::ImplInitTextLineSizeHarfBuzz(LogicalFontInstance* pFont
 if (!hb_ot_metrics_get_position(pHbFont, 
HB_OT_METRICS_TAG_STRIKEOUT_OFFSET, ))
 return false;
 
+if (ShouldNotUseUnderlineMetrics(nUnderlineSize, nUnderlineOffset, 
nStrikeoutSize,
+ nStrikeoutOffset))
+return false;
+
 double fScale = 0;
 pFont->GetScale(nullptr, );
 


[Libreoffice-commits] core.git: officecfg/registry vcl/inc vcl/source

2021-02-27 Thread Heiko Tietze (via logerrit)
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   27 +
 vcl/inc/printdlg.hxx   |3 -
 vcl/source/window/printdlg.cxx |   39 -
 3 files changed, 51 insertions(+), 18 deletions(-)

New commits:
commit 149807eb6100090e178505ba4a264bb38eba1e0c
Author: Heiko Tietze 
AuthorDate: Tue Feb 9 12:03:08 2021 +0100
Commit: Heiko Tietze 
CommitDate: Sat Feb 27 20:19:17 2021 +0100

Resolves tdf#127782 - Print dialog height

* Expander status remembered
* Fix default size for scrollwindow
* Window size remembered
* Window position center on parent
* Size doesn't depend on preview anymore

Change-Id: If14376ecd190f5d73e7cfad6f5f136d287778478
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110631
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index be60d3d19ec3..0739d3289518 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3486,6 +3486,33 @@
   
 
   
+  
+
+  User-settings on the printer dialog
+
+
+  
+Determines whether the range section should be 
expanded.
+  
+  false
+
+
+  
+Determines whether the layout section should be 
expanded.
+  
+  false
+
+
+  
+Stores the width of the print dialog.
+  
+
+
+  
+Stores the height of the print dialog.
+  
+
+  
 
 
   
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index ee3c1896672e..847ac8b62164 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -60,7 +60,6 @@ namespace vcl
 PrintPreviewWindow(PrintDialog* pDialog);
 virtual ~PrintPreviewWindow() override;
 
-virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) 
override;
 virtual void Paint( vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect ) override;
 virtual bool Command( const CommandEvent& ) override;
 virtual void Resize() override;
@@ -226,8 +225,6 @@ namespace vcl
 DECL_LINK( UIOption_SpinModifyHdl, weld::SpinButton&, void );
 DECL_LINK( UIOption_EntryModifyHdl, weld::Entry&, void );
 
-DECL_LINK( ExpandHdl, weld::Expander&, void );
-
 css::beans::PropertyValue* getValueForWindow(weld::Widget*) const;
 
 void preparePreview( bool i_bMayUseCache );
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index a6352f16384a..e104f79fc81b 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -21,6 +21,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -117,13 +119,6 @@ void PrintDialog::PrintPreviewWindow::Resize()
 preparePreviewBitmap();
 }
 
-void PrintDialog::PrintPreviewWindow::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
-{
-pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() 
* 45,
-   pDrawingArea->get_text_height() * 30);
-CustomWidgetController::SetDrawingArea(pDrawingArea);
-}
-
 void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& 
rRenderContext, const tools::Rectangle&)
 {
 rRenderContext.Push();
@@ -672,28 +667,42 @@ PrintDialog::PrintDialog(weld::Window* i_pWindow, const 
std::shared_ptrconnect_value_changed( LINK( this, PrintDialog, 
MetricSpinModifyHdl ) );
 mxSheetMarginEdt->connect_value_changed( LINK( this, PrintDialog, 
MetricSpinModifyHdl ) );
 
-mxRangeExpander->connect_expanded(LINK( this, PrintDialog, ExpandHdl));
-mxLayoutExpander->connect_expanded(LINK( this, PrintDialog, ExpandHdl));
-
 updateNupFromPages();
 
 // tdf#129180 Delay setting the default value in the Paper Size list
 // set paper sizes listbox
 setPaperSizes();
 
+mxRangeExpander->set_expanded(
+officecfg::Office::Common::Print::Dialog::RangeSectionExpanded::get());
+mxLayoutExpander->set_expanded(
+
officecfg::Office::Common::Print::Dialog::LayoutSectionExpanded::get());
+
 // lock the dialog height, regardless of later expander state
 mxScrolledWindow->set_size_request(
 mxScrolledWindow->get_preferred_size().Width() + 
mxScrolledWindow->get_scroll_thickness(),
-mxScrolledWindow->get_preferred_size().Height());
-}
+450);
 
-IMPL_LINK_NOARG(PrintDialog, ExpandHdl, weld::Expander&, void)
-{
-m_xDialog->resize_to_request();
+// restore dialog size
+std::optional aWidth = 
officecfg::Office::Common::Print::Dialog::Width::get();
+std::optional aHeight = 

[Libreoffice-commits] core.git: officecfg/registry vcl/inc vcl/source

2019-10-14 Thread Samuel Mehrbrodt (via logerrit)
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |8 +
 vcl/inc/graphic/Manager.hxx|1 
 vcl/source/graphic/Manager.cxx |   20 +
 3 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit f0443fa4438aa98bce48bfd53dc6a687737687b6
Author: Samuel Mehrbrodt 
AuthorDate: Mon Oct 14 15:05:19 2019 +0200
Commit: Thorsten Behrens 
CommitDate: Tue Oct 15 00:52:28 2019 +0200

Add option to prevent graphic swap out

Change-Id: Icbfc21b219cd4ba582e798e5deda6ef7c81a2009
Reviewed-on: https://gerrit.libreoffice.org/80773
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 0fd0786a77a9..0c6b90fea58d 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -1524,6 +1524,14 @@
   
   600
 
+
+  
+Whether graphics will be swapped to disk when 
`GraphicMemoryLimit`
+is reached. Disable at your own risk.
+Graphic Swapping Enabled
+  
+  true
+
 
   
 Specifies the allowed cumulated memory that the
diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx
index a756450caf28..f1413877bb08 100644
--- a/vcl/inc/graphic/Manager.hxx
+++ b/vcl/inc/graphic/Manager.hxx
@@ -35,6 +35,7 @@ private:
 std::recursive_mutex maMutex; // instead of SolarMutex because graphics 
can live past vcl main
 std::unordered_set m_pImpGraphicList;
 std::chrono::seconds mnAllowedIdleTime;
+bool mbSwapEnabled;
 sal_Int64 mnMemoryLimit;
 sal_Int64 mnUsedSize;
 Timer maSwapOutTimer;
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index ec2bdca9be0b..5942b5cb8784 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -33,7 +33,7 @@ namespace graphic
 namespace
 {
 void setupConfigurationValuesIfPossible(sal_Int64& rMemoryLimit,
-std::chrono::seconds& rAllowedIdleTime)
+std::chrono::seconds& 
rAllowedIdleTime, bool& bSwapEnabled)
 {
 if (utl::ConfigManager::IsFuzzing())
 return;
@@ -45,6 +45,7 @@ void setupConfigurationValuesIfPossible(sal_Int64& 
rMemoryLimit,
 rMemoryLimit = Cache::GraphicManager::GraphicMemoryLimit::get();
 rAllowedIdleTime
 = 
std::chrono::seconds(Cache::GraphicManager::GraphicAllowedIdleTime::get());
+bSwapEnabled = Cache::GraphicManager::GraphicSwappingEnabled::get();
 }
 catch (...)
 {
@@ -60,20 +61,27 @@ Manager& Manager::get()
 
 Manager::Manager()
 : mnAllowedIdleTime(10)
+, mbSwapEnabled(true)
 , mnMemoryLimit(3)
 , mnUsedSize(0)
 , maSwapOutTimer("graphic::Manager maSwapOutTimer")
 {
-setupConfigurationValuesIfPossible(mnMemoryLimit, mnAllowedIdleTime);
+setupConfigurationValuesIfPossible(mnMemoryLimit, mnAllowedIdleTime, 
mbSwapEnabled);
 
-maSwapOutTimer.SetInvokeHandler(LINK(this, Manager, SwapOutTimerHandler));
-maSwapOutTimer.SetTimeout(1);
-maSwapOutTimer.SetDebugName("graphic::Manager maSwapOutTimer");
-maSwapOutTimer.Start();
+if (mbSwapEnabled)
+{
+maSwapOutTimer.SetInvokeHandler(LINK(this, Manager, 
SwapOutTimerHandler));
+maSwapOutTimer.SetTimeout(1);
+maSwapOutTimer.SetDebugName("graphic::Manager maSwapOutTimer");
+maSwapOutTimer.Start();
+}
 }
 
 void Manager::reduceGraphicMemory()
 {
+if (!mbSwapEnabled)
+return;
+
 std::scoped_lock aGuard(maMutex);
 
 for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: officecfg/registry vcl/inc vcl/source

2018-05-30 Thread Samuel Mehrbrodt
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   12 ++
 vcl/inc/impfontmetricdata.hxx  |3 +
 vcl/source/font/fontmetric.cxx |   26 -
 3 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 2f529db909f99a2a503ca0347a9d70742b7f05ba
Author: Samuel Mehrbrodt 
Date:   Fri Mar 23 14:41:01 2018 +0100

tdf#116498 Use win metrics for 'DIN Light' font

This adds a special treatment for fonts which rely on the win metrics
for correct line spacing calculation.

At the moment, only 'DIN Light' is known to need that treatment.

Change-Id: Idd9fd6f63083ab7a706e0cbcd33a947d4949d4e9
Reviewed-on: https://gerrit.libreoffice.org/53962
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Samuel Mehrbrodt 

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 88b6f3b07f1b..3d73cc94deb2 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5295,6 +5295,18 @@
 
 EmojiOne Color
   
+  
+
+  
+Fonts where the win metrics need to be considered in order to 
display the font correctly
+Fonts are identified by their name and the font metrics (see 
fontmetric.cxx:ShouldUseWinMetrics).
+  
+
+
+  
+  DIN Light,1509,-503,1509,-483,1997,483
+
+  
   
 
 
diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx
index f08e86fdc914..28e0ab3798a2 100644
--- a/vcl/inc/impfontmetricdata.hxx
+++ b/vcl/inc/impfontmetricdata.hxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include "fontattributes.hxx"
+#include "sft.hxx"
 
 #include 
 
@@ -96,6 +97,8 @@ public:
 int nUPEM);
 
 private:
+boolShouldUseWinMetrics(vcl::TTGlobalFontInfo& rInfo);
+
 // font instance attributes from the font request
 longmnHeight;   // Font size
 longmnWidth;// Reference Width
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index b619219c44ce..b54e41a1202a 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
@@ -28,6 +29,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -398,6 +401,27 @@ void ImplFontMetricData::ImplInitFlags( const 
OutputDevice* pDev )
 SetFullstopCenteredFlag( bCentered );
 }
 
+bool ImplFontMetricData::ShouldUseWinMetrics(vcl::TTGlobalFontInfo& rInfo)
+{
+OUString aFontIdentifier(
+GetFamilyName() + ","
++ OUString::number(rInfo.ascender) + "," + 
OUString::number(rInfo.descender) + ","
++ OUString::number(rInfo.typoAscender) + "," + 
OUString::number(rInfo.typoDescender) + ","
++ OUString::number(rInfo.winAscent) + "," + 
OUString::number(rInfo.winDescent));
+
+css::uno::Sequence rWinMetricFontList(
+officecfg::Office::Common::Misc::FontsUseWinMetrics::get());
+for (int i = 0; i < rWinMetricFontList.getLength(); ++i)
+{
+if (aFontIdentifier == rWinMetricFontList[i])
+{
+SAL_INFO("vcl.gdi.fontmetric", "Using win metrics for: " << 
aFontIdentifier);
+return true;
+}
+}
+return false;
+}
+
 /*
  * Calculate line spacing:
  *
@@ -440,7 +464,7 @@ void ImplFontMetricData::ImplCalcLineSpacing(const 
std::vector& rHheaDa
 if (rInfo.winAscent || rInfo.winDescent ||
 rInfo.typoAscender || rInfo.typoDescender)
 {
-if (fAscent == 0 && fDescent == 0)
+if (ShouldUseWinMetrics(rInfo) || (fAscent == 0.0 && fDescent == 0.0))
 {
 fAscent = rInfo.winAscent  * fScale;
 fDescent= rInfo.winDescent * fScale;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: officecfg/registry vcl/inc vcl/source

2018-05-07 Thread Tomaž Vajngerl
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   21 
 vcl/inc/graphic/Manager.hxx|3 +
 vcl/source/graphic/Manager.cxx |   22 -
 3 files changed, 37 insertions(+), 9 deletions(-)

New commits:
commit c6cf2320d2a464594e759289c34796538d31f02b
Author: Tomaž Vajngerl 
Date:   Fri Apr 27 18:30:45 2018 +0900

config entries for the new graphic manager, deprecate old entries

Add 2 new GraphicManager config entries GraphicMemoryLimit and
GraphicAllowedIdleTime. At the same time, deprecate the existing
config entries used in GraphicObject's GraphicManager, which are
not relevant anymore.

Change-Id: Idb775e5e1a623f6c23d0c67fea5334a6c713c6c2
Reviewed-on: https://gerrit.libreoffice.org/53561
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 390b54595e40..88b6f3b07f1b 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -1491,6 +1491,7 @@
 
 
   
+Not used anymore
 Specifies the maximum cache size for all graphical display
 objects.
 Total Image Cache Size
@@ -1499,6 +1500,7 @@
 
 
   
+Not used anymore
 Specifies the maximum cache size for a single graphic display
 object.
 Image Object Cache Size
@@ -1507,12 +1509,31 @@
 
 
   
+Not used anymore
 Specifies the time in seconds after which a cached object is
 freed from the cache.
 Image Object Release Timeout
   
   600
 
+
+  
+Specifies the allowed cumulated memory that the
+graphic objects can occupy before they start to get swapped
+to the disk to save memory.
+Graphic Memory Limit Size
+  
+  3
+
+
+  
+Specifies the time in seconds when the graphic object
+can be idle (time since it was last used) before it is
+considered to be swapped to the disk to save memory.
+Graphic Allowed Idle Time
+  
+  10
+
   
 
 
diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx
index 6dd88a5a4c1c..88d57229f9e2 100644
--- a/vcl/inc/graphic/Manager.hxx
+++ b/vcl/inc/graphic/Manager.hxx
@@ -36,7 +36,8 @@ class Manager final
 {
 private:
 std::unordered_set m_pImpGraphicList;
-sal_Int64 mnTotalCacheSize;
+std::chrono::seconds mnAllowedIdleTime;
+sal_Int64 mnMemoryLimit;
 sal_Int64 mnUsedSize;
 Timer maSwapOutTimer;
 
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index 106677cc0db4..c2146a680e8a 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -30,14 +30,19 @@ namespace graphic
 {
 namespace
 {
-void setTotalCacheSizeFromConfigIfPossible(sal_Int64& nTotalCacheSize)
+void setupConfigurationValuesIfPossible(sal_Int64& rMemoryLimit,
+std::chrono::seconds& rAllowedIdleTime)
 {
 if (utl::ConfigManager::IsFuzzing())
 return;
 
 try
 {
-nTotalCacheSize = 
officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::get();
+using officecfg::Office::Common::Cache;
+
+rMemoryLimit = Cache::GraphicManager::GraphicMemoryLimit::get();
+rAllowedIdleTime
+= 
std::chrono::seconds(Cache::GraphicManager::GraphicAllowedIdleTime::get());
 }
 catch (...)
 {
@@ -52,11 +57,12 @@ Manager& Manager::get()
 }
 
 Manager::Manager()
-: mnTotalCacheSize(5000)
+: mnAllowedIdleTime(10)
+, mnMemoryLimit(3)
 , mnUsedSize(0)
 , maSwapOutTimer("graphic::Manager maSwapOutTimer")
 {
-setTotalCacheSizeFromConfigIfPossible(mnTotalCacheSize);
+setupConfigurationValuesIfPossible(mnMemoryLimit, mnAllowedIdleTime);
 
 maSwapOutTimer.SetInvokeHandler(LINK(this, Manager, SwapOutTimerHandler));
 maSwapOutTimer.SetTimeout(1);
@@ -68,7 +74,7 @@ void Manager::reduceGraphicMemory()
 {
 for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList)
 {
-if (mnUsedSize < mnTotalCacheSize * 0.7)
+if (mnUsedSize < mnMemoryLimit * 0.7)
 return;
 
 sal_Int64 nCurrentGraphicSize = getGraphicSizeBytes(pEachImpGraphic);
@@ -79,8 +85,8 @@ void Manager::reduceGraphicMemory()
 auto aCurrent = std::chrono::high_resolution_clock::now();
 auto aDeltaTime = aCurrent - pEachImpGraphic->maLastUsed;
 auto aSeconds =