include/vcl/glyphitemcache.hxx  |    2 ++
 vcl/source/gdi/impglyphitem.cxx |    7 +++++++
 2 files changed, 9 insertions(+)

New commits:
commit 0854ae596afa863ab4db592fa484f8b0799b37da
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Aug 31 16:50:08 2022 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Mon Sep 5 16:44:10 2022 +0200

    glyph cache considered artificial italic the same as regular
    
    The "true" font metrics are the same so it matches, though the
    result when rendered is different. Do the same with artificial
    emboldening too.
    
    seen with Bahnschrift font from tdf#103596 and tdf#108497
    
    Change-Id: I5fb77b5abe55fea9a09091e350c58866725c9b3d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139129
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index 30921e6920a0..ed48f8c344c3 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -75,6 +75,8 @@ private:
         double fontScaleY;
         MapMode mapMode;
         bool rtl;
+        bool artificialItalic;
+        bool artificialBold;
         vcl::text::ComplexTextLayoutFlags layoutMode;
         LanguageType digitLanguage;
         size_t hashValue;
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 7dd090929907..8ec1374347b9 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -505,6 +505,10 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
     const LogicalFontInstance* fi = outputDevice->GetFontInstance();
     fi->GetScale(&fontScaleX, &fontScaleY);
 
+    const vcl::font::FontSelectPattern& rFSD = fi->GetFontSelectPattern();
+    artificialItalic = rFSD.GetItalic() != ITALIC_NONE && 
fontMetric.GetItalic() == ITALIC_NONE;
+    artificialBold = rFSD.GetWeight() > WEIGHT_MEDIUM && 
fontMetric.GetWeight() <= WEIGHT_MEDIUM;
+
     hashValue = 0;
     o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text));
     o3tl::hash_combine(hashValue, index);
@@ -520,6 +524,8 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
     o3tl::hash_combine(hashValue, fontScaleY);
     o3tl::hash_combine(hashValue, mapMode.GetHashValue());
     o3tl::hash_combine(hashValue, rtl);
+    o3tl::hash_combine(hashValue, artificialItalic);
+    o3tl::hash_combine(hashValue, artificialBold);
     o3tl::hash_combine(hashValue, layoutMode);
     o3tl::hash_combine(hashValue, digitLanguage.get());
 }
@@ -528,6 +534,7 @@ inline bool 
SalLayoutGlyphsCache::CachedGlyphsKey::operator==(const CachedGlyphs
 {
     return hashValue == other.hashValue && index == other.index && len == 
other.len
            && logicWidth == other.logicWidth && mapMode == other.mapMode && 
rtl == other.rtl
+           && artificialItalic == other.artificialItalic && artificialBold == 
other.artificialBold
            && layoutMode == other.layoutMode && digitLanguage == 
other.digitLanguage
            && fontScaleX == other.fontScaleX && fontScaleY == other.fontScaleY
            && fontMetric.EqualIgnoreColor(other.fontMetric)

Reply via email to