summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-16 16:33:29 +0000
committerMichael Meeks <michael.meeks@collabora.com>2024-02-16 21:55:33 +0100
commit5a4ab8cb3a3fbf15de11afc5d8876aaa8a7784c9 (patch)
tree3a4e0b3f4580e34da2ab2b9e735f01029716921a /sc
parent4df426e429e1aed92f074d8acd3ba3a5ec335ba9 (diff)
for caching if a font has glyphs, strikethrough and underline don't matter
Those aren't part of the font. Likewise it's safe to assume these days that if the glyph appears at one size it will exist at any size. The same isn't through for Bold/Italic. A font like Freesans has, or had at least, glyphs in one variant not in another. So don't treat those properties the same. Change-Id: Iccc291642dfe7e9d2cb06a241a575fd1e4a4bb9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163509 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/oox/stylesbuffer.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 22ebb2025833..a7be2cb93d7b 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -794,9 +794,19 @@ void Font::finalizeImport()
if( !maUsedFlags.mbNameUsed )
return;
+ // For caching if the font has glyphs then the underline and strike-through don't matter.
+ // Those aren't differences in the actual font, so just zero those out for the cache.
+ // The weight and pitch are different faces though, and there are some fonts with glyphs
+ // missing in one or other variant.
+ css::awt::FontDescriptor aGlyphDesc = maApiData.maDesc;
+ aGlyphDesc.Strikeout = css::awt::FontStrikeout::NONE;
+ aGlyphDesc.Underline = css::awt::FontUnderline::NONE;
+ // Never seen that to be the case for font *sizes* however, so we can use a uniform 10pt size
+ aGlyphDesc.Height = 200;
+
bool bHasAsian(false), bHasCmplx(false), bHasLatin(false);
FontClassificationMap& rFontClassificationCache = getFontClassificationCache();
- if (auto found = rFontClassificationCache.find(maApiData.maDesc); found != rFontClassificationCache.end())
+ if (auto found = rFontClassificationCache.find(aGlyphDesc); found != rFontClassificationCache.end())
{
FontClassification eClassification = found->second;
bHasAsian = bool(eClassification & FontClassification::Asian);
@@ -810,7 +820,7 @@ void Font::finalizeImport()
if( !xDevice.is() )
return;
- Reference< XFont2 > xFont( xDevice->getFont( maApiData.maDesc ), UNO_QUERY );
+ Reference< XFont2 > xFont( xDevice->getFont(aGlyphDesc), UNO_QUERY );
if( !xFont.is() )
return;
@@ -851,7 +861,7 @@ void Font::finalizeImport()
eClassification = eClassification | FontClassification::Cmplx;
if (bHasLatin)
eClassification = eClassification | FontClassification::Latin;
- rFontClassificationCache.emplace(maApiData.maDesc, eClassification);
+ rFontClassificationCache.emplace(aGlyphDesc, eClassification);
}
lclSetFontName( maApiData.maLatinFont, maApiData.maDesc, bHasLatin );