summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sdext/source/pdfimport/tree/drawtreevisiting.cxx15
-rw-r--r--sdext/source/pdfimport/tree/pdfiprocessor.cxx15
-rw-r--r--sdext/source/pdfimport/tree/writertreevisiting.cxx28
3 files changed, 41 insertions, 17 deletions
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index ebce9efc896b..69f70001f6d6 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-
+#include <sal/log.hxx>
#include <pdfiprocessor.hxx>
#include <xmlemitter.hxx>
#include <pdfihelper.hxx>
@@ -828,23 +827,28 @@ void DrawXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_pt
PropertyMap aFontProps;
// family name
+ // TODO: tdf#143095: use system font name rather than PSName
+ SAL_INFO("sdext.pdfimport", "The font used in xml is: " << rFont.familyName);
aFontProps[ "fo:font-family" ] = rFont.familyName;
+ aFontProps[ "style:font-family-asia" ] = rFont.familyName;
aFontProps[ "style:font-family-complex" ] = rFont.familyName;
// bold
if( rFont.isBold )
{
aFontProps[ "fo:font-weight" ] = "bold";
- aFontProps[ "fo:font-weight-asian" ] = "bold";
+ aFontProps[ "style:font-weight-asian" ] = "bold";
aFontProps[ "style:font-weight-complex" ] = "bold";
}
+
// italic
if( rFont.isItalic )
{
aFontProps[ "fo:font-style" ] = "italic";
- aFontProps[ "fo:font-style-asian" ] = "italic";
+ aFontProps[ "style:font-style-asian" ] = "italic";
aFontProps[ "style:font-style-complex" ] = "italic";
}
+
// underline
if( rFont.isUnderline )
{
@@ -852,11 +856,10 @@ void DrawXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_pt
aFontProps[ "style:text-underline-width" ] = "auto";
aFontProps[ "style:text-underline-color" ] = "font-color";
}
+
// outline
if( rFont.isOutline )
- {
aFontProps[ "style:text-outline" ] = "true";
- }
// size
SetFontsizeProperties(aFontProps, rFont.size);
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index ed2eaf6510b9..d63ab04e97fd 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -147,7 +147,20 @@ void PDFIProcessor::setFont( const FontAttributes& i_rFont )
FontAttributes aChangedFont( i_rFont );
GraphicsContext& rGC=getCurrentContext();
// for text render modes, please see PDF reference manual
- aChangedFont.isOutline = ( (rGC.TextRenderMode == 1) || (rGC. TextRenderMode == 2) );
+ if (rGC.TextRenderMode == 1)
+ {
+ aChangedFont.isOutline = true;
+ }
+ else if (rGC.TextRenderMode == 2)
+ {
+ // tdf#81484: faux bold is represented as "stroke+fill" (while using the same color for both stroke and fill) in pdf.
+ // 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;
+ else
+ aChangedFont.isOutline = true;
+ }
FontToIdMap::const_iterator it = m_aFontToId.find( aChangedFont );
if( it != m_aFontToId.end() )
rGC.FontId = it->second;
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 0aab0c9a7261..0ac805acd6ab 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -18,7 +18,7 @@
*/
#include <sal/config.h>
-
+#include <sal/log.hxx>
#include <string_view>
#include <pdfiprocessor.hxx>
@@ -899,21 +899,28 @@ void WriterXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_
PropertyMap aFontProps;
// family name
+ // TODO: tdf#143095: use system font name rather than PSName
+ SAL_INFO("sdext.pdfimport", "The font used in xml is: " << rFont.familyName);
aFontProps[ "fo:font-family" ] = rFont.familyName;
+ aFontProps[ "style:font-family-asia" ] = rFont.familyName;
+ aFontProps[ "style:font-family-complex" ] = rFont.familyName;
+
// bold
if( rFont.isBold )
{
- aFontProps[ "fo:font-weight" ] = "bold";
- aFontProps[ "fo:font-weight-asian" ] = "bold";
- aFontProps[ "fo:font-weight-complex" ] = "bold";
+ aFontProps[ "fo:font-weight" ] = "bold";
+ aFontProps[ "style:font-weight-asian" ] = "bold";
+ aFontProps[ "style:font-weight-complex" ] = "bold";
}
+
// italic
if( rFont.isItalic )
{
- aFontProps[ "fo:font-style" ] = "italic";
- aFontProps[ "fo:font-style-asian" ] = "italic";
- aFontProps[ "fo:font-style-complex" ] = "italic";
+ aFontProps[ "fo:font-style" ] = "italic";
+ aFontProps[ "style:font-style-asian" ] = "italic";
+ aFontProps[ "style:font-style-complex" ] = "italic";
}
+
// underline
if( rFont.isUnderline )
{
@@ -921,19 +928,20 @@ void WriterXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_
aFontProps[ "style:text-underline-width" ] = "auto";
aFontProps[ "style:text-underline-color" ] = "font-color";
}
+
// outline
if( rFont.isOutline )
- {
aFontProps[ "style:text-outline" ] = "true";
- }
+
// size
OUString aFSize = OUString::number( rFont.size*72/PDFI_OUTDEV_RESOLUTION ) + "pt";
aFontProps[ "fo:font-size" ] = aFSize;
aFontProps[ "style:font-size-asian" ] = aFSize;
aFontProps[ "style:font-size-complex" ] = aFSize;
+
// color
const GraphicsContext& rGC = m_rProcessor.getGraphicsContext( elem.GCId );
- aFontProps[ "fo:color" ] = getColorString( rFont.isOutline ? rGC.LineColor : rGC.FillColor );
+ aFontProps[ "fo:color" ] = getColorString( rFont.isOutline ? rGC.LineColor : rGC.FillColor );
StyleContainer::Style aStyle( "style:style", aProps );
StyleContainer::Style aSubStyle( "style:text-properties", aFontProps );