summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/docxattributeoutput.cxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-02-21 13:43:44 +0100
committerLuboš Luňák <l.lunak@suse.cz>2013-02-21 18:26:21 +0100
commit596bd0f61f8cfc957410148ae221c62331067bdd (patch)
tree53b9421f4d9d508176c1c1cff3b8d87741fb1460 /sw/source/filter/ww8/docxattributeoutput.cxx
parent895dc882c451bcc03236267d3ce33be218451721 (diff)
embed also system fonts when embedding fonts in a document
Without this, only fonts that had come embedded with the document were embedded when saving, which meant that it was impossible to create new documents that would have any fonts embedded. Change-Id: I3b4e87b1b3ca5ae1ccfe29d9b571b0262c568dcf
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8a6e8bbbff0d..b7e211ffb8e5 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -98,7 +98,7 @@
#include <txtinet.hxx>
#include <osl/file.hxx>
-#include <vcl/temporaryfonts.hxx>
+#include <vcl/embeddedfontshelper.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -3055,14 +3055,14 @@ void DocxAttributeOutput::FontPitchType( FontPitch ePitch ) const
FSEND );
}
-void DocxAttributeOutput::EmbedFont( const OUString& name )
+void DocxAttributeOutput::EmbedFont( const OUString& name, FontFamily family, FontPitch pitch, rtl_TextEncoding encoding )
{
if( !m_rExport.pDoc->get( IDocumentSettingAccess::EMBED_FONTS ))
return; // no font embedding with this document
- EmbedFontStyle( name, XML_embedRegular, "" );
- EmbedFontStyle( name, XML_embedBold, "b" );
- EmbedFontStyle( name, XML_embedItalic, "i" );
- EmbedFontStyle( name, XML_embedBoldItalic, "bi" );
+ EmbedFontStyle( name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch, encoding );
+ EmbedFontStyle( name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch, encoding );
+ EmbedFontStyle( name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch, encoding );
+ EmbedFontStyle( name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch, encoding );
}
static inline char toHexChar( int value )
@@ -3070,11 +3070,12 @@ static inline char toHexChar( int value )
return value >= 10 ? value + 'A' - 10 : value + '0';
}
-void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, const char* style )
+void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, FontFamily family, FontItalic italic,
+ FontWeight weight, FontPitch pitch, rtl_TextEncoding encoding )
{
- OUString fontUrl = TemporaryFonts::fileUrlForFont( name, style );
- // If a temporary font file exists for this font, assume it was embedded
- // and embed it again.
+ OUString fontUrl = EmbeddedFontsHelper::fontFileUrl( name, family, italic, weight, pitch, encoding );
+ if( fontUrl.isEmpty())
+ return;
// TODO IDocumentSettingAccess::EMBED_SYSTEM_FONTS
osl::File file( fontUrl );
if( file.open( osl_File_OpenFlag_Read ) != osl::File::E_None )