summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorKevin Suo <suokunlong@126.com>2022-01-29 21:44:36 +0800
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-04 07:44:18 +0100
commitbcf10015c5d12d363d0be9f6da25092c83112692 (patch)
treeea387afc1bb6029e32828c42c9048deec5dd132f /sdext
parent2f605009907166d509ccd1dcb6385e5cd456e3e4 (diff)
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.grandin@collabora.co.uk>
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/pdfimport/inc/wrapper.hxx12
-rw-r--r--sdext/source/pdfimport/wrapper/wrapper.cxx26
2 files changed, 37 insertions, 1 deletions
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") )
{