summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorKevin Suo <suokunlong@126.com>2021-08-21 17:37:52 +0800
committerMichael Stahl <michael.stahl@allotropia.de>2021-08-25 15:09:21 +0200
commit7c2d2f8fbc8b5751121c7c69dbc0f764ec4cc35e (patch)
tree6e99186834212b339e7e402cc0b906899e41542d /sdext
parent8f7b8a6c068c6484b05edb2aac643142df6d44ac (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> 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.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 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);