sdext/source/pdfimport/inc/wrapper.hxx | 12 ++++++++++++ sdext/source/pdfimport/wrapper/wrapper.cxx | 26 +++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-)
New commits: commit bb5a8696dc85723e324d1201acd3f68c32220e24 Author: Kevin Suo <suokunl...@126.com> AuthorDate: Sat Jan 29 21:44:36 2022 +0800 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Feb 8 11:52:32 2022 +0100 sdext.pdfimport tdf#137128: Recognize more font name and weight... ...values from the embeded 'PS' font names. Change-Id: I8465a6b1d845ce626848112f0a735a9ee3696e5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129136 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit bcf10015c5d12d363d0be9f6da25092c83112692) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129430 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sdext/source/pdfimport/inc/wrapper.hxx b/sdext/source/pdfimport/inc/wrapper.hxx index 9f25e1b7290b..94cc2b24327d 100644 --- a/sdext/source/pdfimport/inc/wrapper.hxx +++ b/sdext/source/pdfimport/inc/wrapper.hxx @@ -58,16 +58,28 @@ namespace pdfi // and they are checked from the suffix, thus the order matters. // e.g. for "TimesNewRomanPS-BoldItalic", to get "TimesNewRoman", you should // first have "Italic", and then "Bold", then "-", and then "PS". + "-VKana", "MT", "PS", "PSMT", "Regular", + "Normal", + "Book", + "Medium", + "ExtraBold", + "UltraBold", + "ExtraLight", + "UltraLight", "Bold", + "Heavy", + "Black", "Italic", "Oblique", "Bold", //BoldItalic, BoldOblique "Light", + "Thin", "Semibold", + "-Roman", "Reg", "VKana", "-", diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 0560826d5727..cfa256f0acfa 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -492,7 +492,15 @@ void LineParser::parseFontFamilyName( FontAttributes& rResult ) { rResult.familyName = rResult.familyName.replaceAll(fontAttributesSuffix, ""); SAL_INFO("sdext.pdfimport", rResult.familyName); - if (fontAttributesSuffix == u"Bold") + if (fontAttributesSuffix == u"Heavy" || fontAttributesSuffix == u"Black") + { + rResult.fontWeight = u"900"; + } + else if (fontAttributesSuffix == u"ExtraBold" || fontAttributesSuffix == u"UltraBold") + { + rResult.fontWeight = u"800"; + } + else if (fontAttributesSuffix == u"Bold") { rResult.fontWeight = u"bold"; } @@ -500,10 +508,26 @@ void LineParser::parseFontFamilyName( FontAttributes& rResult ) { rResult.fontWeight = u"600"; } + else if (fontAttributesSuffix == u"Medium") + { + rResult.fontWeight = u"500"; + } + else if (fontAttributesSuffix == u"Normal" || fontAttributesSuffix == u"Regular" || fontAttributesSuffix == u"Book") + { + rResult.fontWeight = u"400"; + } else if (fontAttributesSuffix == u"Light") { rResult.fontWeight = u"300"; } + else if (fontAttributesSuffix == u"ExtraLight" || fontAttributesSuffix == u"UltraLight") + { + rResult.fontWeight = u"200"; + } + else if (fontAttributesSuffix == u"Thin") + { + rResult.fontWeight = u"100"; + } if ( (fontAttributesSuffix == "Italic") or (fontAttributesSuffix == "Oblique") ) {