vcl/unx/generic/gdi/cairotextrender.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit b589fc5a8d1124b81ac75dfac972c1036ae55477
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Jan 13 17:27:20 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jan 13 20:24:47 2022 +0100

    set hint_metrics seperately from hint_style
    
    I unsure hint_metrics makes any difference to our use case, but probably
    won't hurt
    
    Change-Id: I82a4ff0d3a05e50ec30e878363e0c24a438c96cb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128389
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx 
b/vcl/unx/generic/gdi/cairotextrender.cxx
index 7d24dce1e09f..c403c2f3246b 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -174,11 +174,13 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
         const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
         bool bDisableAA = !rStyleSettings.GetUseFontAAFromSystem() && 
!rGraphics.getAntiAlias();
 
-        bool bWithoutHintingInTextDirection = 
rGraphics.getTextRenderModeForResolutionIndependentLayoutEnabled();
+        const bool bResolutionIndependentLayoutEnabled = 
rGraphics.getTextRenderModeForResolutionIndependentLayoutEnabled();
         cairo_hint_style_t eHintStyle = 
cairo_font_options_get_hint_style(pFontOptions);
-        bool bAllowedHintStyle = !bWithoutHintingInTextDirection || 
(eHintStyle == CAIRO_HINT_STYLE_NONE || eHintStyle == CAIRO_HINT_STYLE_SLIGHT);
+        cairo_hint_metrics_t eHintMetricsStyle = 
cairo_font_options_get_hint_metrics(pFontOptions);
+        bool bAllowedHintStyle = !bResolutionIndependentLayoutEnabled || 
(eHintStyle == CAIRO_HINT_STYLE_NONE || eHintStyle == CAIRO_HINT_STYLE_SLIGHT);
+        bool bAllowedHintMetricStyle = !bResolutionIndependentLayoutEnabled || 
(eHintMetricsStyle == CAIRO_HINT_METRICS_OFF);
 
-        if (bDisableAA || !bAllowedHintStyle)
+        if (bDisableAA || !bAllowedHintStyle || !bAllowedHintMetricStyle)
         {
             // Disable font AA in case global AA setting is supposed to affect
             // font rendering (not the default) and AA is disabled.
@@ -186,10 +188,9 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
             if (bDisableAA)
                 cairo_font_options_set_antialias(pOptions, 
CAIRO_ANTIALIAS_NONE);
             if (!bAllowedHintStyle)
-            {
                 cairo_font_options_set_hint_style(pOptions, 
CAIRO_HINT_STYLE_SLIGHT);
+            if (!bAllowedHintMetricStyle)
                 cairo_font_options_set_hint_metrics(pOptions, 
CAIRO_HINT_METRICS_OFF);
-            }
             cairo_set_font_options(cr, pOptions);
             cairo_font_options_destroy(pOptions);
         }

Reply via email to