sdext/source/pdfimport/wrapper/wrapper.cxx | 9 +++++++++ 1 file changed, 9 insertions(+)
New commits: commit 7c2d2f8fbc8b5751121c7c69dbc0f764ec4cc35e Author: Kevin Suo <suokunl...@126.com> AuthorDate: Sat Aug 21 17:37:52 2021 +0800 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Aug 25 15:09:21 2021 +0200 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.gran...@collabora.co.uk> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120896 Reviewed-by: Kevin Suo <suokunl...@126.com> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index a887160eb56c..2f837988d94d 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -675,6 +675,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);