summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-08-31 16:50:08 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-09-05 16:44:10 +0200
commit0854ae596afa863ab4db592fa484f8b0799b37da (patch)
tree6e582f1883ad026608d96168be9cac164784ff1a /vcl
parentad15930e60b1e175d127022fd99fe71f140cbd88 (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/+/139129 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/impglyphitem.cxx7
1 files changed, 7 insertions, 0 deletions
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)