diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-08-31 16:50:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-08-31 22:21:33 +0200 |
commit | 8b8810343dc25eb44c2a5500648b9afbc94ab7b8 (patch) | |
tree | 38a26468fa001f5d80357271c6edab615d9287ee /vcl/source/gdi | |
parent | a72861e3be5b89544ae943c0c5cc6d43e8e70a7d (diff) |
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/+/139127
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/impglyphitem.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index df35d5a5fe37..53f9b1d18b9a 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -484,7 +484,11 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey( { const LogicalFontInstance* fi = outputDevice->GetFontInstance(); fi->GetScale(&fontScaleX, &fontScaleY); - disabledLigatures = fi->GetFontSelectPattern().GetPitch() == PITCH_FIXED; + + const vcl::font::FontSelectPattern& rFSD = fi->GetFontSelectPattern(); + disabledLigatures = rFSD.GetPitch() == PITCH_FIXED; + 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)); @@ -502,6 +506,8 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey( o3tl::hash_combine(hashValue, mapMode.GetHashValue()); o3tl::hash_combine(hashValue, rtl); o3tl::hash_combine(hashValue, disabledLigatures); + o3tl::hash_combine(hashValue, artificialItalic); + o3tl::hash_combine(hashValue, artificialBold); o3tl::hash_combine(hashValue, layoutMode); o3tl::hash_combine(hashValue, digitLanguage.get()); } @@ -510,9 +516,11 @@ 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 - && disabledLigatures == other.disabledLigatures && layoutMode == other.layoutMode - && digitLanguage == other.digitLanguage && fontScaleX == other.fontScaleX - && fontScaleY == other.fontScaleY && fontMetric.EqualIgnoreColor(other.fontMetric) + && disabledLigatures == other.disabledLigatures + && artificialItalic == other.artificialItalic && artificialBold == other.artificialBold + && layoutMode == other.layoutMode && digitLanguage == other.digitLanguage + && fontScaleX == other.fontScaleX && fontScaleY == other.fontScaleY + && fontMetric.EqualIgnoreColor(other.fontMetric) && vcl::text::FastStringCompareEqual()(text, other.text); // Slower things last in the comparison. } |