include LogicalFontInstance font scale in SalLayoutGlyphsCache key
For some reason it may differ even if vcl::Font is the same. Without this ScExportTest2::testTdf66668 fails. Change-Id: I728a0848ac0420ce0d746134c7072f6ab59f2761 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133537 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
parent
f8d6ec1a51
commit
12dcfc191b
@ -71,6 +71,8 @@ private:
|
||||
tools::Long logicWidth;
|
||||
VclPtr<const OutputDevice> outputDevice;
|
||||
vcl::Font font;
|
||||
double fontScaleX;
|
||||
double fontScaleY;
|
||||
MapMode mapMode;
|
||||
bool rtl;
|
||||
vcl::text::ComplexTextLayoutFlags layoutMode;
|
||||
|
@ -1192,8 +1192,9 @@ public:
|
||||
//If bNewFontLists is true then drop and refetch lists of system fonts
|
||||
SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists );
|
||||
|
||||
protected:
|
||||
SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
|
||||
|
||||
protected:
|
||||
SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return mnEmphasisAscent; }
|
||||
SAL_DLLPRIVATE tools::Long GetEmphasisDescent() const { return mnEmphasisDescent; }
|
||||
|
||||
|
@ -364,6 +364,9 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr<const Output
|
||||
, layoutMode(outputDevice->GetLayoutMode())
|
||||
, digitLanguage(outputDevice->GetDigitLanguage())
|
||||
{
|
||||
const LogicalFontInstance* fi = outputDevice->GetFontInstance();
|
||||
fi->GetScale(&fontScaleX, &fontScaleY);
|
||||
|
||||
hashValue = 0;
|
||||
o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text));
|
||||
o3tl::hash_combine(hashValue, index);
|
||||
@ -371,7 +374,13 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr<const Output
|
||||
o3tl::hash_combine(hashValue, logicWidth);
|
||||
|
||||
o3tl::hash_combine(hashValue, outputDevice.get());
|
||||
// Need to use IgnoreColor, because sometimes the color changes, but it's irrelevant
|
||||
// for text layout (and also obsolete in vcl::Font).
|
||||
o3tl::hash_combine(hashValue, font.GetHashValueIgnoreColor());
|
||||
// For some reason font scale may differ even if vcl::Font is the same,
|
||||
// so explicitly check it too.
|
||||
o3tl::hash_combine(hashValue, fontScaleX);
|
||||
o3tl::hash_combine(hashValue, fontScaleY);
|
||||
o3tl::hash_combine(hashValue, mapMode.GetHashValue());
|
||||
o3tl::hash_combine(hashValue, rtl);
|
||||
o3tl::hash_combine(hashValue, layoutMode);
|
||||
@ -383,10 +392,8 @@ inline bool SalLayoutGlyphsCache::CachedGlyphsKey::operator==(const CachedGlyphs
|
||||
return hashValue == other.hashValue && index == other.index && len == other.len
|
||||
&& logicWidth == other.logicWidth && outputDevice == other.outputDevice
|
||||
&& mapMode == other.mapMode && rtl == other.rtl && layoutMode == other.layoutMode
|
||||
&& digitLanguage == other.digitLanguage
|
||||
// Need to use EqualIgnoreColor, because sometimes the color changes, but it's irrelevant
|
||||
// for text layout (and also obsolete in vcl::Font).
|
||||
&& font.EqualIgnoreColor(other.font)
|
||||
&& digitLanguage == other.digitLanguage && fontScaleX == other.fontScaleX
|
||||
&& fontScaleY == other.fontScaleY && font.EqualIgnoreColor(other.font)
|
||||
&& vcl::text::FastStringCompareEqual()(text, other.text);
|
||||
// Slower things last in the comparison.
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user