summaryrefslogtreecommitdiff
path: root/sdext/source/pdfimport/wrapper
diff options
context:
space:
mode:
authorKevin Suo <suokunlong@126.com>2021-08-21 17:37:52 +0800
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-22 10:29:50 +0200
commita1759769804a7f3b9895b481229d497a9eb4c70a (patch)
tree48ebacf0ad86c1e33dc66abf46202f8179201e75 /sdext/source/pdfimport/wrapper
parent3748535a5739f3cb1471516b2e7ae2601575b639 (diff)
tdf#143959 sdext.pdfimport: fix font name with subtag
as returned by the font descriptor when reading the font file. Change-Id: I376b887e6356e765f669b41c43776f78f94c3623 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120815 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext/source/pdfimport/wrapper')
-rw-r--r--sdext/source/pdfimport/wrapper/wrapper.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 7cf30241c5ee..2efdab6f8553 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -584,6 +584,15 @@ void LineParser::readFont()
if (!aFontDescriptor.Name.isEmpty())
{
aResult.familyName = aFontDescriptor.Name;
+ // tdf#143959: there are cases when the family name returned by font descriptor
+ // is like "AAAAAA+TimesNewRoman,Bold". In this case, use the font name
+ // determined by parseFontFamilyName instead, but still determine the font
+ // attributes (bold italic etc) from the font descriptor.
+ if (aResult.familyName.getLength() > 7 and aResult.familyName.indexOf(u"+", 6) == 6)
+ {
+ aResult.familyName = aResult.familyName.copy(7, aResult.familyName.getLength() - 7);
+ parseFontFamilyName(aResult);
+ }
aResult.isBold = (aFontDescriptor.Weight > 100.0);
aResult.isItalic = (aFontDescriptor.Slant == awt::FontSlant_OBLIQUE ||
aFontDescriptor.Slant == awt::FontSlant_ITALIC);