summaryrefslogtreecommitdiff
path: root/sw
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
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')
-rw-r--r--sw/inc/pch/precompiled_msword.hxx2
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx21
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx5
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx2
4 files changed, 16 insertions, 14 deletions
diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx
index acacb8bdeaa2..e05919fcc59b 100644
--- a/sw/inc/pch/precompiled_msword.hxx
+++ b/sw/inc/pch/precompiled_msword.hxx
@@ -252,7 +252,7 @@
#include <vcl/outdev.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/temporaryfonts.hxx>
+#include <vcl/embeddedfontshelper.hxx>
#include <vcl/vclenum.hxx>
#include <vcl/virdev.hxx>
#include <vcl/wmf.hxx>
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 )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index af94b1f8467a..37a6d4ee124b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -244,7 +244,7 @@ public:
void FontPitchType( FontPitch ePitch ) const;
/// Write out the font into the document, if it's an embedded font.
- void EmbedFont( const OUString& name );
+ void EmbedFont( const OUString& name, FontFamily family, FontPitch pitch, rtl_TextEncoding encoding );
/// Definition of a numbering instance.
virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule );
@@ -326,7 +326,8 @@ private:
void WriteFFData( const FieldInfos& rInfos );
- void EmbedFontStyle( const OUString& name, int tag, const char* style );
+ void EmbedFontStyle( const OUString& name, int tag, FontFamily family, FontItalic italic, FontWeight weight,
+ FontPitch pitch, rtl_TextEncoding encoding );
protected:
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 3d40f4e24c9e..4c9e80f7ce8e 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -718,7 +718,7 @@ void wwFont::WriteDocx( DocxAttributeOutput* rAttrOutput ) const
rAttrOutput->FontCharset( sw::ms::rtl_TextEncodingToWinCharset( meChrSet ), meChrSet );
rAttrOutput->FontFamilyType( meFamily );
rAttrOutput->FontPitchType( mePitch );
- rAttrOutput->EmbedFont( msFamilyNm );
+ rAttrOutput->EmbedFont( msFamilyNm, meFamily, mePitch, meChrSet );
rAttrOutput->EndFont();
}