diff options
Diffstat (limited to 'sdext/source')
-rw-r--r-- | sdext/source/pdfimport/inc/contentsink.hxx | 12 | ||||
-rw-r--r-- | sdext/source/pdfimport/inc/pdfihelper.hxx | 2 | ||||
-rw-r--r-- | sdext/source/pdfimport/inc/wrapper.hxx | 1 | ||||
-rw-r--r-- | sdext/source/pdfimport/test/testdocs/tdf78427-MyraidPro-Semibold-Light.pdf | bin | 0 -> 13199 bytes | |||
-rw-r--r-- | sdext/source/pdfimport/test/testdocs/tdf78427-testFontFeatures.pdf (renamed from sdext/source/pdfimport/test/testdocs/testFontFeatures.pdf) | bin | 81012 -> 81012 bytes | |||
-rw-r--r-- | sdext/source/pdfimport/test/tests.cxx | 65 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/drawtreevisiting.cxx | 9 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/pdfiprocessor.cxx | 4 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/writertreevisiting.cxx | 20 | ||||
-rw-r--r-- | sdext/source/pdfimport/wrapper/wrapper.cxx | 88 | ||||
-rw-r--r-- | sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 4 | ||||
-rw-r--r-- | sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx | 12 |
12 files changed, 158 insertions, 59 deletions
diff --git a/sdext/source/pdfimport/inc/contentsink.hxx b/sdext/source/pdfimport/inc/contentsink.hxx index dbe1b0e08808..9d016a7e2a3e 100644 --- a/sdext/source/pdfimport/inc/contentsink.hxx +++ b/sdext/source/pdfimport/inc/contentsink.hxx @@ -48,14 +48,14 @@ namespace pdfi { struct FontAttributes { - FontAttributes( const OUString& familyName_, - bool isBold_, + FontAttributes( const OUString& familyName_, + const OUString& sFontWeight, bool isItalic_, bool isUnderline_, double size_, double ascent_) : familyName(familyName_), - isBold(isBold_), + fontWeight(sFontWeight), isItalic(isItalic_), isUnderline(isUnderline_), isOutline(false), @@ -65,7 +65,7 @@ namespace pdfi FontAttributes() : familyName(), - isBold(false), + fontWeight(u"normal"), isItalic(false), isUnderline(false), isOutline(false), @@ -74,7 +74,7 @@ namespace pdfi {} OUString familyName; - bool isBold; + OUString fontWeight; bool isItalic; bool isUnderline; bool isOutline; @@ -84,7 +84,7 @@ namespace pdfi bool operator==(const FontAttributes& rFont) const { return familyName == rFont.familyName && - !isBold == !rFont.isBold && + fontWeight == rFont.fontWeight && !isItalic == !rFont.isItalic && !isUnderline == !rFont.isUnderline && !isOutline == !rFont.isOutline && diff --git a/sdext/source/pdfimport/inc/pdfihelper.hxx b/sdext/source/pdfimport/inc/pdfihelper.hxx index aa3a22bd2b67..6b663b203e62 100644 --- a/sdext/source/pdfimport/inc/pdfihelper.hxx +++ b/sdext/source/pdfimport/inc/pdfihelper.hxx @@ -82,7 +82,7 @@ namespace pdfi { std::size_t seed = 0; o3tl::hash_combine(seed, rFont.familyName.hashCode()); - o3tl::hash_combine(seed, rFont.isBold); + o3tl::hash_combine(seed, rFont.fontWeight); o3tl::hash_combine(seed, rFont.isItalic); o3tl::hash_combine(seed, rFont.isUnderline); o3tl::hash_combine(seed, rFont.isOutline); diff --git a/sdext/source/pdfimport/inc/wrapper.hxx b/sdext/source/pdfimport/inc/wrapper.hxx index f8682299600c..9f25e1b7290b 100644 --- a/sdext/source/pdfimport/inc/wrapper.hxx +++ b/sdext/source/pdfimport/inc/wrapper.hxx @@ -67,6 +67,7 @@ namespace pdfi "Oblique", "Bold", //BoldItalic, BoldOblique "Light", + "Semibold", "Reg", "VKana", "-", diff --git a/sdext/source/pdfimport/test/testdocs/tdf78427-MyraidPro-Semibold-Light.pdf b/sdext/source/pdfimport/test/testdocs/tdf78427-MyraidPro-Semibold-Light.pdf Binary files differnew file mode 100644 index 000000000000..685da5db956c --- /dev/null +++ b/sdext/source/pdfimport/test/testdocs/tdf78427-MyraidPro-Semibold-Light.pdf diff --git a/sdext/source/pdfimport/test/testdocs/testFontFeatures.pdf b/sdext/source/pdfimport/test/testdocs/tdf78427-testFontFeatures.pdf Binary files differindex 0405d95f8425..0405d95f8425 100644 --- a/sdext/source/pdfimport/test/testdocs/testFontFeatures.pdf +++ b/sdext/source/pdfimport/test/testdocs/tdf78427-testFontFeatures.pdf diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx index f47fa459a03c..c8c3b9e28a8f 100644 --- a/sdext/source/pdfimport/test/tests.cxx +++ b/sdext/source/pdfimport/test/tests.cxx @@ -583,17 +583,20 @@ namespace #endif } - void testFontFeatures() // tdf#78427 + void testTdf78427_FontFeatures() { rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext())); xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory()); OString aOutput; CPPUNIT_ASSERT_MESSAGE("Converting PDF to ODF XML", - xAdaptor->odfConvert( m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/testFontFeatures.pdf"), - new OutputWrapString(aOutput), - nullptr )); - std::cout << aOutput << std::endl; + xAdaptor->odfConvert( m_directories.getURLFromSrc( + u"/sdext/source/pdfimport/test/testdocs/tdf78427-testFontFeatures.pdf"), + new OutputWrapString(aOutput), + nullptr )); + // Un-comment the following debug line to see the content of generated XML content in + // workdir/CppunitTest/sdext_pdfimport.test.log after running "make CppunitTest_sdext_pdfimport". + //std::cout << aOutput << std::endl; xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast<xmlChar const *>(aOutput.getStr()))); //CPPUNIT_ASSERT(pXmlDoc); @@ -602,8 +605,8 @@ namespace OString xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; - // the font-weight and font-style should be normal (e.g., no such attribute) - assertXPathNoAttribute(pXmlDoc, xpath, "font-weight"); + // the font-weight and font-style should be normal + assertXPath(pXmlDoc, xpath, "font-weight", "normal"); assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); /* Test for the 2nd paragraph */ @@ -621,7 +624,7 @@ namespace OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // there should be a font-style="italic", but no font-weight bold - assertXPathNoAttribute(pXmlDoc, xpath, "font-weight"); + assertXPath(pXmlDoc, xpath, "font-weight", "normal"); assertXPath(pXmlDoc, xpath, "font-style", "italic"); /* Test for the 4th paragraph */ @@ -650,7 +653,7 @@ namespace "\"]/style:text-properties"; // the font should be Arial without font-weight and font-style assertXPath(pXmlDoc, xpath, "font-family", "Arial"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-weight"); + assertXPath(pXmlDoc, xpath, "font-weight", "normal"); assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); /* Test for the 7th paragraph */ @@ -660,7 +663,7 @@ namespace "\"]/style:text-properties"; // the font should be SimSun without font-weight and font-style assertXPath(pXmlDoc, xpath, "font-family", "SimSun"); // TODO: tdf#143095 use localized font name rather than PS name - assertXPathNoAttribute(pXmlDoc, xpath, "font-weight"); + assertXPath(pXmlDoc, xpath, "font-weight", "normal"); assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); /* Test for the 8th paragraph */ @@ -678,9 +681,9 @@ namespace xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; - // the font should be SimSun, no font-weight="bold", with font-style="italic" + // the font should be SimSun, font-weight should be "normal", font-style="italic" assertXPath(pXmlDoc, xpath, "font-family", "SimSun"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-weight"); + assertXPath(pXmlDoc, xpath, "font-weight", "normal"); // FIXME and remove the below comment: // the chinese chars are shown in pdf as faux italic (fake italic). It is currencly imported wrongly as normal font style. // See tdf#78427 for how the faux bold problem was handled. Faux italic may be handled using the transformation pattern. @@ -705,11 +708,44 @@ namespace // the font should be SimSun and there should be style:text-outline="true" // (i.e., the real "outline" font rather than faux bold / fake bold) assertXPath(pXmlDoc, xpath, "font-family", "SimSun"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-weight"); + assertXPath(pXmlDoc, xpath, "font-weight", "normal"); assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); assertXPath(pXmlDoc, xpath, "text-outline", "true"); } + void testTdf78427_FontWeight_MyraidProSemibold() // Related to attachment 155937. + { + rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext())); + xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory()); + + OString aOutput; + CPPUNIT_ASSERT_MESSAGE("Converting PDF to ODF XML", + xAdaptor->odfConvert( m_directories.getURLFromSrc( + u"/sdext/source/pdfimport/test/testdocs/tdf78427-MyraidPro-Semibold-Light.pdf"), + new OutputWrapString(aOutput), + nullptr )); + //std::cout << aOutput << std::endl; + + xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast<xmlChar const *>(aOutput.getStr()))); + //CPPUNIT_ASSERT(pXmlDoc); + + // The for the 1st frame */ + OUString styleName = getXPath(pXmlDoc, "//draw:frame[1]//text:span[1]", "style-name"); + OString xpath = "//office:automatic-styles/style:style[@style:name=\"" + + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + + "\"]/style:text-properties"; + // the font-weight and font-style should be 600 (Semibold) + assertXPath(pXmlDoc, xpath, "font-weight", "600"); + + // The for the 2nd frame */ + styleName = getXPath(pXmlDoc, "//draw:frame[2]//text:span[1]", "style-name"); + xpath = "//office:automatic-styles/style:style[@style:name=\"" + + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + + "\"]/style:text-properties"; + // the font-weight and font-style should be 300 (Light) + assertXPath(pXmlDoc, xpath, "font-weight", "300"); + } + void testTdf143959_nameFromFontFile() { rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext())); @@ -751,7 +787,8 @@ namespace CPPUNIT_TEST(testTdf98421); CPPUNIT_TEST(testTdf105536); CPPUNIT_TEST(testTdf141709); - CPPUNIT_TEST(testFontFeatures); + CPPUNIT_TEST(testTdf78427_FontFeatures); + CPPUNIT_TEST(testTdf78427_FontWeight_MyraidProSemibold); CPPUNIT_TEST(testTdf143959_nameFromFontFile); CPPUNIT_TEST_SUITE_END(); }; diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index d5ce02ad89bf..436f9f532c20 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -835,12 +835,9 @@ void DrawXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_pt aFontProps[ "style:font-family-complex" ] = rFont.familyName; // bold - if( rFont.isBold ) - { - aFontProps[ "fo:font-weight" ] = "bold"; - aFontProps[ "style:font-weight-asian" ] = "bold"; - aFontProps[ "style:font-weight-complex" ] = "bold"; - } + aFontProps[ "fo:font-weight" ] = rFont.fontWeight; + aFontProps[ "style:font-weight-asian" ] = rFont.fontWeight; + aFontProps[ "style:font-weight-complex" ] = rFont.fontWeight; // italic if( rFont.isItalic ) diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 86f703c1ac7b..ff105426ad51 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -57,7 +57,7 @@ namespace pdfi { FontAttributes aDefFont; aDefFont.familyName = "Helvetica"; - aDefFont.isBold = false; + aDefFont.fontWeight = u"normal"; aDefFont.isItalic = false; aDefFont.size = 10*PDFI_OUTDEV_RESOLUTION/72; m_aIdToFont.insert({0, aDefFont}); @@ -151,7 +151,7 @@ void PDFIProcessor::setFont( const FontAttributes& i_rFont ) // Convert to bold instead if the stroke color is the same as the fill color, // otherwise it should be outline. if (getCurrentContext().LineColor == getCurrentContext().FillColor) - aChangedFont.isBold = true; + aChangedFont.fontWeight = u"bold"; else aChangedFont.isOutline = true; } diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index 0ac805acd6ab..6a841e7bc57d 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -463,8 +463,17 @@ void WriterXmlOptimizer::visit( ParagraphElement& elem, const std::list< std::un { const FontAttributes& rPrevFont = m_rProcessor.getFont( pPrevText->FontId ); const FontAttributes& rThisFont = m_rProcessor.getFont( pThisText->FontId ); - if( rPrevFont.isBold && ! rThisFont.isBold ) + if ( (rPrevFont.fontWeight == u"600" || + rPrevFont.fontWeight == u"bold" || + rPrevFont.fontWeight == u"800" || + rPrevFont.fontWeight == u"900" ) && + (rThisFont.fontWeight == u"600" || + rThisFont.fontWeight == u"bold" || + rThisFont.fontWeight == u"800" || + rThisFont.fontWeight == u"900" ) ) + { pPrevPara->Type = ParagraphElement::Headline; + } } } } @@ -906,12 +915,9 @@ void WriterXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_ aFontProps[ "style:font-family-complex" ] = rFont.familyName; // bold - if( rFont.isBold ) - { - aFontProps[ "fo:font-weight" ] = "bold"; - aFontProps[ "style:font-weight-asian" ] = "bold"; - aFontProps[ "style:font-weight-complex" ] = "bold"; - } + aFontProps[ "fo:font-weight" ] = rFont.fontWeight; + aFontProps[ "style:font-weight-asian" ] = rFont.fontWeight; + aFontProps[ "style:font-weight-complex" ] = rFont.fontWeight; // italic if( rFont.isItalic ) diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 2efdab6f8553..4de5a8516297 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/geometry/RealRectangle2D.hpp> #include <com/sun/star/geometry/RealSize2D.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/awt/FontWeight.hpp> #include <tools/diagnose_ex.h> #include <basegfx/point/b2dpoint.hxx> @@ -483,18 +484,28 @@ e.g., TimesNewRoman -> Times New Roman */ void LineParser::parseFontFamilyName( FontAttributes& rResult ) { - SAL_INFO("sdext.pdfimport", "Processing " << rResult.familyName << " ---"); + SAL_WARN("sdext.pdfimport", "Processing " << rResult.familyName << " ---"); rResult.familyName = rResult.familyName.trim(); for (const OUString& fontAttributesSuffix: fontAttributesSuffixes) { if ( rResult.familyName.endsWith(fontAttributesSuffix) ) { rResult.familyName = rResult.familyName.replaceAll(fontAttributesSuffix, ""); - SAL_INFO("sdext.pdfimport", rResult.familyName); - if (fontAttributesSuffix == "Bold") + SAL_WARN("sdext.pdfimport", rResult.familyName); + if (fontAttributesSuffix == u"Bold") { - rResult.isBold = true; - } else if ( (fontAttributesSuffix == "Italic") or (fontAttributesSuffix == "Oblique") ) + rResult.fontWeight = u"bold"; + } + else if (fontAttributesSuffix == u"Semibold") + { + rResult.fontWeight = u"600"; + } + else if (fontAttributesSuffix == u"Light") + { + rResult.fontWeight = u"300"; + } + + if ( (fontAttributesSuffix == "Italic") or (fontAttributesSuffix == "Oblique") ) { rResult.isItalic = true; } @@ -506,20 +517,23 @@ void LineParser::readFont() { /* xpdf line is like (separated by space): - updateFont <FontID> <isEmbedded> <isBold> <isItalic> <isUnderline> <TransformedFontSize> <nEmbedSize> <FontName> - updateFont 14 1 0 0 0 1200.000000 23068 TimesNewRomanPSMT + updateFont <FontID> <isEmbedded> <maFontWeight> <isItalic> <isUnderline> <TransformedFontSize> <nEmbedSize> <FontName> + updateFont 14 1 4 0 0 1200.000000 23068 TimesNewRomanPSMT If nEmbedSize > 0, then a fontFile is followed as a stream. */ - - OString aFontName; sal_Int64 nFontID; - sal_Int32 nIsEmbedded, nIsBold, nIsItalic, nIsUnderline, nFileLen; + sal_Int32 nIsEmbedded; + sal_Int32 nFontWeight; + sal_Int32 nIsItalic; + sal_Int32 nIsUnderline; double nSize; + sal_Int32 nFileLen; + OString aFontName; readInt64(nFontID); // read FontID readInt32(nIsEmbedded); // read isEmbedded - readInt32(nIsBold); // read isBold + readInt32(nFontWeight); // read maFontWeight, see GfxFont enum Weight readInt32(nIsItalic); // read isItalic readInt32(nIsUnderline);// read isUnderline readDouble(nSize); // read TransformedFontSize @@ -545,15 +559,36 @@ void LineParser::readFont() return; } - // yet unknown font - get info and add to map + // The font is not yet in the map list - get info and add to map + OUString sFontWeight; // font weight name per ODF specifications + if (nFontWeight == 0 or nFontWeight == 4) // WeightNotDefined or W400, map to normal font + sFontWeight = u"normal"; + else if (nFontWeight == 1) // W100, Thin + sFontWeight = u"100"; + else if (nFontWeight == 2) // W200, Extra-Light + sFontWeight = u"200"; + else if (nFontWeight == 3) // W300, Light + sFontWeight = u"300"; + else if (nFontWeight == 5) // W500, Medium. Is this supported by ODF? + sFontWeight = u"500"; + else if (nFontWeight == 6) // W600, Semi-Bold + sFontWeight = u"600"; + else if (nFontWeight == 7) // W700, Bold + sFontWeight = u"bold"; + else if (nFontWeight == 8) // W800, Extra-Bold + sFontWeight = u"800"; + else if (nFontWeight == 9) // W900, Black + sFontWeight = u"900"; + SAL_WARN("sdext.pdfimport", "Font weight passed from xpdfimport is: " << sFontWeight); + FontAttributes aResult( OStringToOUString( aFontName, RTL_TEXTENCODING_UTF8 ), - nIsBold != 0, + sFontWeight, nIsItalic != 0, nIsUnderline != 0, nSize, 1.0); - /* The above font attributes (fontName, bold, italic) are based on + /* The above font attributes (fontName, fontWeight, italic) are based on xpdf line output and may not be reliable. To get correct attributes, we do the following: 1. Read the embedded font file and determine the attributes based on the @@ -583,7 +618,9 @@ void LineParser::readFont() aFontReadResult >>= aFontDescriptor; if (!aFontDescriptor.Name.isEmpty()) { + // Family name aResult.familyName = aFontDescriptor.Name; + SAL_INFO("sdext.pdfimport", aResult.familyName); // 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 @@ -593,7 +630,28 @@ void LineParser::readFont() aResult.familyName = aResult.familyName.copy(7, aResult.familyName.getLength() - 7); parseFontFamilyName(aResult); } - aResult.isBold = (aFontDescriptor.Weight > 100.0); + + // Font weight + if (aFontDescriptor.Weight == com::sun::star::awt::FontWeight::THIN) + aResult.fontWeight = u"100"; + else if (aFontDescriptor.Weight == com::sun::star::awt::FontWeight::ULTRALIGHT) + aResult.fontWeight = u"200"; + else if (aFontDescriptor.Weight == com::sun::star::awt::FontWeight::LIGHT) + aResult.fontWeight = u"300"; + else if (aFontDescriptor.Weight == com::sun::star::awt::FontWeight::SEMILIGHT) + aResult.fontWeight = u"350"; + // no need to check "normal" here as this is default in nFontWeight above + else if (aFontDescriptor.Weight == com::sun::star::awt::FontWeight::SEMIBOLD) + aResult.fontWeight = u"600"; + else if (aFontDescriptor.Weight == com::sun::star::awt::FontWeight::BOLD) + aResult.fontWeight = u"bold"; + else if (aFontDescriptor.Weight == com::sun::star::awt::FontWeight::ULTRABOLD) + aResult.fontWeight = u"800"; + else if (aFontDescriptor.Weight == com::sun::star::awt::FontWeight::BLACK) + aResult.fontWeight = u"900"; + SAL_INFO("sdext.pdfimport", aResult.fontWeight); + + // Italic aResult.isItalic = (aFontDescriptor.Slant == awt::FontSlant_OBLIQUE || aFontDescriptor.Slant == awt::FontSlant_ITALIC); } else diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index 5d6ce90bc44c..02b6fe6a1b9e 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -461,7 +461,7 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* gfxFont, const GfxState* st aNewFont.familyName.append( "Arial" ); } - aNewFont.isBold = gfxFont->isBold(); + aNewFont.maFontWeight = gfxFont->getWeight(); aNewFont.isItalic = gfxFont->isItalic(); #if POPPLER_CHECK_VERSION(0, 83, 0) // const added to getTransformedFontSize aNewFont.size = state->getTransformedFontSize(); @@ -795,7 +795,7 @@ void PDFOutDev::updateFont(GfxState *state) #endif printf( " %d %d %d %d %f %d %s", aFont.isEmbedded, - aFont.isBold, + aFont.maFontWeight, aFont.isItalic, aFont.isUnderline, normalize(state->getTransformedFontSize()), diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx index 41e4752dde61..f087915d97b9 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx @@ -75,7 +75,7 @@ namespace pdfi FontAttributes() : familyName(), isEmbedded(false), - isBold(false), + maFontWeight(GfxFont::W400), isItalic(false), isUnderline(false), size(0.0) @@ -86,7 +86,7 @@ namespace pdfi FontAttributes( const FontAttributes& rSrc ) : familyName(), isEmbedded(rSrc.isEmbedded), - isBold(rSrc.isBold), + maFontWeight(rSrc.maFontWeight), isItalic(rSrc.isItalic), isUnderline(rSrc.isUnderline), size(rSrc.size) @@ -100,7 +100,7 @@ namespace pdfi familyName.append(&rSrc.getFamilyName()); isEmbedded = rSrc.isEmbedded; - isBold = rSrc.isBold; + maFontWeight= rSrc.maFontWeight; isItalic = rSrc.isItalic; isUnderline = rSrc.isUnderline; size = rSrc.size; @@ -112,15 +112,15 @@ namespace pdfi { return getFamilyName().cmp(&rFont.getFamilyName())==0 && isEmbedded == rFont.isEmbedded && - isBold == rFont.isBold && + maFontWeight == rFont.maFontWeight && isItalic == rFont.isItalic && isUnderline == rFont.isUnderline && size == rFont.size; } - GooString familyName; + GooString familyName; bool isEmbedded; - bool isBold; + GfxFont::Weight maFontWeight; bool isItalic; bool isUnderline; double size; |