diff options
author | Kevin Suo <suokunlong@126.com> | 2021-08-21 17:37:52 +0800 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-08-25 15:09:21 +0200 |
commit | 7c2d2f8fbc8b5751121c7c69dbc0f764ec4cc35e (patch) | |
tree | 6e99186834212b339e7e402cc0b906899e41542d /sdext | |
parent | ofz: MemorySanitizer: use-of-uninitialized-value (diff) | |
download | core-7c2d2f8fbc8b5751121c7c69dbc0f764ec4cc35e.tar.gz core-7c2d2f8fbc8b5751121c7c69dbc0f764ec4cc35e.zip |
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>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120896
Reviewed-by: Kevin Suo <suokunlong@126.com>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/pdfimport/wrapper/wrapper.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
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); |