summaryrefslogtreecommitdiffstats
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
parentResolves: tdf#142293 Implement the temporariness of GetOpCodeMap() (diff)
downloadcore-0854ae596afa863ab4db592fa484f8b0799b37da.tar.gz
core-0854ae596afa863ab4db592fa484f8b0799b37da.zip
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>
-rw-r--r--include/vcl/glyphitemcache.hxx2
-rw-r--r--vcl/source/gdi/impglyphitem.cxx7
2 files changed, 9 insertions, 0 deletions
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)