[Libreoffice-commits] core.git: sw/inc sw/source vcl/generic vcl/inc vcl/Library_vcl.mk vcl/Package_inc.mk vcl/source writerfilter/inc writerfilter/source xmloff/inc xmloff/source
David Ostrovsky
david at ostrovsky.org
Thu Feb 21 14:36:15 PST 2013
sw/inc/pch/precompiled_msword.hxx | 2
sw/source/filter/ww8/docxattributeoutput.cxx | 21 ++--
sw/source/filter/ww8/docxattributeoutput.hxx | 5 -
sw/source/filter/ww8/wrtw8sty.cxx | 2
vcl/Library_vcl.mk | 2
vcl/Package_inc.mk | 2
vcl/generic/fontmanager/fontmanager.cxx | 2
vcl/inc/vcl/embeddedfontshelper.hxx | 58 ------------
vcl/inc/vcl/temporaryfonts.hxx | 54 +++++++++++
vcl/source/app/svmain.cxx | 6 -
vcl/source/gdi/embeddedfontshelper.cxx | 104 ----------------------
vcl/source/gdi/temporaryfonts.cxx | 56 +++++++++++
writerfilter/inc/pch/precompiled_writerfilter.hxx | 2
writerfilter/source/dmapper/FontTable.cxx | 6 -
xmloff/inc/pch/precompiled_xo.hxx | 2
xmloff/source/style/XMLFontAutoStylePool.cxx | 13 --
xmloff/source/style/XMLFontStylesContext.cxx | 8 -
17 files changed, 142 insertions(+), 203 deletions(-)
New commits:
commit cad65120c6da901bf9fe33ab16ad22217efed0c0
Author: David Ostrovsky <david at ostrovsky.org>
Date: Thu Feb 21 23:33:10 2013 +0100
Revert "embed also system fonts when embedding fonts in a document"
that's enouph breakage for now.
This reverts commit 596bd0f61f8cfc957410148ae221c62331067bdd.
Change-Id: I992f439a9a099e47115a30b3d745848f3af09e5e
diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx
index e05919f..acacb8b 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/embeddedfontshelper.hxx>
+#include <vcl/temporaryfonts.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 b7e211f..8a6e8bb 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/embeddedfontshelper.hxx>
+#include <vcl/temporaryfonts.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, FontFamily family, FontPitch pitch, rtl_TextEncoding encoding )
+void DocxAttributeOutput::EmbedFont( const OUString& name )
{
if( !m_rExport.pDoc->get( IDocumentSettingAccess::EMBED_FONTS ))
return; // no font embedding with this document
- 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 );
+ EmbedFontStyle( name, XML_embedRegular, "" );
+ EmbedFontStyle( name, XML_embedBold, "b" );
+ EmbedFontStyle( name, XML_embedItalic, "i" );
+ EmbedFontStyle( name, XML_embedBoldItalic, "bi" );
}
static inline char toHexChar( int value )
@@ -3070,12 +3070,11 @@ static inline char toHexChar( int value )
return value >= 10 ? value + 'A' - 10 : value + '0';
}
-void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, FontFamily family, FontItalic italic,
- FontWeight weight, FontPitch pitch, rtl_TextEncoding encoding )
+void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, const char* style )
{
- OUString fontUrl = EmbeddedFontsHelper::fontFileUrl( name, family, italic, weight, pitch, encoding );
- if( fontUrl.isEmpty())
- return;
+ OUString fontUrl = TemporaryFonts::fileUrlForFont( name, style );
+ // If a temporary font file exists for this font, assume it was embedded
+ // and embed it again.
// 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 37a6d4e..af94b1f 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, FontFamily family, FontPitch pitch, rtl_TextEncoding encoding );
+ void EmbedFont( const OUString& name );
/// Definition of a numbering instance.
virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule );
@@ -326,8 +326,7 @@ private:
void WriteFFData( const FieldInfos& rInfos );
- void EmbedFontStyle( const OUString& name, int tag, FontFamily family, FontItalic italic, FontWeight weight,
- FontPitch pitch, rtl_TextEncoding encoding );
+ void EmbedFontStyle( const OUString& name, int tag, const char* style );
protected:
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 4c9e80f..3d40f4e 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, meFamily, mePitch, meChrSet );
+ rAttrOutput->EmbedFont( msFamilyNm );
rAttrOutput->EndFont();
}
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 49c1c78..c71543d 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -207,7 +207,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/gdi/configsettings \
vcl/source/gdi/cvtgrf \
vcl/source/gdi/cvtsvm \
- vcl/source/gdi/embeddedfontshelper \
vcl/source/gdi/extoutdevdata \
vcl/source/gdi/font \
vcl/source/gdi/gdimtf \
@@ -256,6 +255,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/gdi/salmisc \
vcl/source/gdi/salnativewidgets-none \
vcl/source/gdi/svgdata \
+ vcl/source/gdi/temporaryfonts \
vcl/source/gdi/textlayout \
vcl/source/gdi/virdev \
vcl/source/gdi/wall \
diff --git a/vcl/Package_inc.mk b/vcl/Package_inc.mk
index 6088b66..53a7326 100644
--- a/vcl/Package_inc.mk
+++ b/vcl/Package_inc.mk
@@ -144,7 +144,7 @@ $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/tabctrl.hxx,vcl/tabctrl.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/tabdlg.hxx,vcl/tabdlg.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/tabpage.hxx,vcl/tabpage.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/taskpanelist.hxx,vcl/taskpanelist.hxx))
-$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/embeddedfontshelper.hxx,vcl/embeddedfontshelper.hxx))
+$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/temporaryfonts.hxx,vcl/temporaryfonts.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/textdata.hxx,vcl/textdata.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/texteng.hxx,vcl/texteng.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/textview.hxx,vcl/textview.hxx))
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index c84b15a..b571955 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -34,7 +34,7 @@
#include "vcl/fontmanager.hxx"
#include "vcl/strhelper.hxx"
#include "vcl/ppdparser.hxx"
-#include <vcl/embeddedfontshelper.hxx>
+#include <vcl/temporaryfonts.hxx>
#include "tools/urlobj.hxx"
#include "tools/stream.hxx"
diff --git a/vcl/inc/vcl/embeddedfontshelper.hxx b/vcl/inc/vcl/embeddedfontshelper.hxx
deleted file mode 100644
index 96e8226..0000000
--- a/vcl/inc/vcl/embeddedfontshelper.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef VCL_EMBEDDEDFONTSHELPER_HXX
-#define VCL_EMBEDDEDFONTSHELPER_HXX
-
-#include <vcl/dllapi.h>
-
-#include <rtl/ustring.hxx>
-#include <tools/fontenum.hxx>
-
-/**
- Helper functions for handling embedded fonts in documents.
-
-*/
-class VCL_DLLPUBLIC EmbeddedFontsHelper
-{
-public:
- /**
- Returns URL for a font file for the given font, or empty if it does not exist.
- */
- static OUString fontFileUrl( const OUString& familyName, FontFamily family, FontItalic italic,
- FontWeight weight, FontPitch pitch, rtl_TextEncoding encoding );
- /**
- Returns an URL for a file where to store contents of a given temporary font.
- The file may or not may not exist yet, and will be cleaned up automatically as appropriate.
- Use activateTemporaryFont() to actually enable usage of the font.
-
- @param fontName name of the font (e.g. 'Times New Roman')
- @param fontStyle font style, "" for regular, "bi" for bold italic, etc.
- */
- static OUString fileUrlForTemporaryFont( const OUString& fontName, const char* fontStyle );
-
- /**
- Adds the given font to the list of known fonts. The font is used only until application
- exit.
-
- @param fontName name of the font (e.g. 'Times New Roman')
- @param fileUrl URL of the font file
- */
- static void activateFont( const OUString& fontName, const OUString& fileUrl );
-
- /**
- Removes all temporary fonts in the path used by fileUrlForTemporaryFont().
- @internal
- */
- static void clearTemporaryFontFiles();
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/vcl/temporaryfonts.hxx b/vcl/inc/vcl/temporaryfonts.hxx
new file mode 100644
index 0000000..f8fe162
--- /dev/null
+++ b/vcl/inc/vcl/temporaryfonts.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef VCL_TEMPORARYFONTS_HXX
+#define VCL_TEMPORARYFONTS_HXX
+
+#include <vcl/dllapi.h>
+
+#include <rtl/ustring.hxx>
+
+/**
+ Management of temporary fonts (e.g. embedded in documents).
+
+ This class handles adding of temporary fonts.
+ @since LibreOffice 4.0
+*/
+class VCL_DLLPUBLIC TemporaryFonts
+{
+public:
+ /**
+ Returns an URL for a file where to store contents of a temporary font
+ (the file may or may not exist). The file will be cleaned up automatically as appropriate.
+ Use activateTemporaryFont() to actually enable usage of the font.
+
+ @param fontName name of the font (e.g. 'Times New Roman')
+ @param fontStyle font style, "" for regular, "bi" for bold italic, etc.
+ */
+ static OUString fileUrlForFont( const OUString& fontName, const char* fontStyle );
+
+ /**
+ Adds the given font to the list of known fonts. The font is used only until application
+ exit.
+
+ @param fontName name of the font (e.g. 'Times New Roman')
+ @param fileUrl URL of the font file
+ */
+ static void activateFont( const OUString& fontName, const OUString& fileUrl );
+
+ /**
+ Removes all temporary fonts.
+ @internal
+ */
+ static void clear();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 58cec57..9d08192 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -40,7 +40,7 @@
#include "vcl/unowrap.hxx"
#include "vcl/configsettings.hxx"
#include "vcl/lazydelete.hxx"
-#include "vcl/embeddedfontshelper.hxx"
+#include "vcl/temporaryfonts.hxx"
#ifdef WNT
#include <svsys.h>
@@ -251,7 +251,7 @@ sal_Bool InitVCL()
if( pExceptionHandler != NULL )
return sal_False;
- EmbeddedFontsHelper::clearTemporaryFontFiles();
+ TemporaryFonts::clear();
if( ! ImplGetSVData() )
ImplInitSVData();
@@ -581,7 +581,7 @@ void DeInitVCL()
pOwnSvApp = NULL;
}
- EmbeddedFontsHelper::clearTemporaryFontFiles();
+ TemporaryFonts::clear();
}
// only one call is allowed
diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx
deleted file mode 100644
index b5d1c01..0000000
--- a/vcl/source/gdi/embeddedfontshelper.cxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <vcl/embeddedfontshelper.hxx>
-
-#include <osl/file.hxx>
-#include <rtl/bootstrap.hxx>
-#include <vcl/fontmanager.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/outdev.hxx>
-
-using namespace std;
-
-void EmbeddedFontsHelper::clearTemporaryFontFiles()
-{
- OUString path = "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
- rtl::Bootstrap::expandMacros( path );
- path += "/user/temp/embeddedfonts/";
- osl::Directory dir( path );
- if( dir.reset() == osl::Directory::E_None )
- {
- for(;;)
- {
- osl::DirectoryItem item;
- if( dir.getNextItem( item ) != osl::Directory::E_None )
- break;
- osl::FileStatus status( osl_FileStatus_Mask_FileURL );
- if( item.getFileStatus( status ) == osl::File::E_None )
- osl::File::remove( status.getFileURL());
- }
- }
-}
-
-OUString EmbeddedFontsHelper::fileUrlForTemporaryFont( const OUString& fontName, const char* fontStyle )
-{
- OUString path = "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
- rtl::Bootstrap::expandMacros( path );
- path += "/user/temp/embeddedfonts/";
- osl::Directory::createPath( path );
- OUString filename = fontName;
- filename += OStringToOUString( fontStyle, RTL_TEXTENCODING_ASCII_US );
- filename += ".ttf"; // TODO is it always ttf?
- return path + filename;
-}
-
-void EmbeddedFontsHelper::activateFont( const OUString& fontName, const OUString& fileUrl )
-{
- OutputDevice *pDevice = Application::GetDefaultDevice();
- pDevice->AddTempDevFont( fileUrl, fontName );
- pDevice->ImplUpdateAllFontData( true );
-}
-
-OUString EmbeddedFontsHelper::fontFileUrl( const OUString& familyName, FontFamily family, FontItalic italic,
- FontWeight weight, FontPitch pitch, rtl_TextEncoding )
-{
- OUString url;
- psp::PrintFontManager& mgr = psp::PrintFontManager::get();
- list< psp::fontID > fontIds;
- mgr.getFontList( fontIds );
- for( list< psp::fontID >::const_iterator it = fontIds.begin();
- it != fontIds.end();
- ++it )
- {
- psp::fontID id = *it;
- psp::FastPrintFontInfo info;
- if( !mgr.getFontFastInfo( id, info ))
- continue;
- if( info.m_aFamilyName == familyName )
- {
- // Ignore comparing text encodings, at least for now. They cannot be trivially compared
- // (e.g. UCS2 and UTF8 are technically the same characters, just have different encoding,
- // and just having a unicode font doesn't say what glyphs it actually contains).
- // It is possible that it still may be needed to do at least some checks here
- // for some encodings (can one font have more font files for more encodings?).
- if(( family == FAMILY_DONTKNOW || info.m_eFamilyStyle == family )
- && ( italic == ITALIC_DONTKNOW || info.m_eItalic == italic )
- && ( weight == WEIGHT_DONTKNOW || info.m_eWeight == weight )
- && ( pitch == PITCH_DONTKNOW || info.m_ePitch == pitch ))
- { // Exact match, return it immediately.
- OUString ret;
- osl::File::getFileURLFromSystemPath(
- OStringToOUString( mgr.getFontFileSysPath( id ), RTL_TEXTENCODING_UTF8 ), ret );
- return ret;
- }
- if(( info.m_eFamilyStyle == FAMILY_DONTKNOW || family == FAMILY_DONTKNOW || info.m_eFamilyStyle == family )
- && ( info.m_eItalic == ITALIC_DONTKNOW || italic == ITALIC_DONTKNOW || info.m_eItalic == italic )
- && ( info.m_eWeight == WEIGHT_DONTKNOW || weight == WEIGHT_DONTKNOW || info.m_eWeight == weight )
- && ( info.m_ePitch == PITCH_DONTKNOW || pitch == PITCH_DONTKNOW || info.m_ePitch == pitch ))
- { // Some fonts specify 'DONTKNOW' for some things, still a good match, if we don't find a better one.
- osl::File::getFileURLFromSystemPath(
- OStringToOUString( mgr.getFontFileSysPath( id ), RTL_TEXTENCODING_UTF8 ), url );
- }
- }
- }
- return url;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/temporaryfonts.cxx b/vcl/source/gdi/temporaryfonts.cxx
new file mode 100644
index 0000000..292e09e
--- /dev/null
+++ b/vcl/source/gdi/temporaryfonts.cxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vcl/temporaryfonts.hxx>
+
+#include <osl/file.hxx>
+#include <rtl/bootstrap.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+
+void TemporaryFonts::clear()
+{
+ OUString path = "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
+ rtl::Bootstrap::expandMacros( path );
+ path += "/user/temp/fonts/";
+ osl::Directory dir( path );
+ if( dir.reset() == osl::Directory::E_None )
+ {
+ for(;;)
+ {
+ osl::DirectoryItem item;
+ if( dir.getNextItem( item ) != osl::Directory::E_None )
+ break;
+ osl::FileStatus status( osl_FileStatus_Mask_FileURL );
+ if( item.getFileStatus( status ) == osl::File::E_None )
+ osl::File::remove( status.getFileURL());
+ }
+ }
+}
+
+OUString TemporaryFonts::fileUrlForFont( const OUString& fontName, const char* fontStyle )
+{
+ OUString path = "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
+ rtl::Bootstrap::expandMacros( path );
+ path += "/user/temp/fonts/";
+ osl::Directory::createPath( path );
+ OUString filename = fontName;
+ filename += OStringToOUString( fontStyle, RTL_TEXTENCODING_ASCII_US );
+ filename += ".ttf"; // TODO is it always ttf?
+ return path + filename;
+}
+
+void TemporaryFonts::activateFont( const OUString& fontName, const OUString& fileUrl )
+{
+ OutputDevice *pDevice = Application::GetDefaultDevice();
+ pDevice->AddTempDevFont( fileUrl, fontName );
+ pDevice->ImplUpdateAllFontData( true );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/inc/pch/precompiled_writerfilter.hxx b/writerfilter/inc/pch/precompiled_writerfilter.hxx
index f2565ad..23a1299 100644
--- a/writerfilter/inc/pch/precompiled_writerfilter.hxx
+++ b/writerfilter/inc/pch/precompiled_writerfilter.hxx
@@ -209,7 +209,7 @@
#include <vcl/graph.hxx>
#include <vcl/outdev.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/embeddedfontshelper.hxx>
+#include <vcl/temporaryfonts.hxx>
#include <vcl/wmf.hxx>
#include <vector>
#include <xmloff/odffields.hxx>
diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx
index cb737f1..08aab11 100644
--- a/writerfilter/source/dmapper/FontTable.cxx
+++ b/writerfilter/source/dmapper/FontTable.cxx
@@ -24,7 +24,7 @@
#include <osl/file.hxx>
#include <stdio.h>
#include <rtl/tencinfo.h>
-#include <vcl/embeddedfontshelper.hxx>
+#include <vcl/temporaryfonts.hxx>
#include "dmapperLoggers.hxx"
@@ -251,7 +251,7 @@ EmbeddedFontHandler::~EmbeddedFontHandler()
{
if( !inputStream.is())
return;
- OUString fileUrl = EmbeddedFontsHelper::fileUrlForTemporaryFont( fontName, style );
+ OUString fileUrl = TemporaryFonts::fileUrlForFont( fontName, style );
osl::File file( fileUrl );
switch( file.open( osl_File_OpenFlag_Create | osl_File_OpenFlag_Write ))
{
@@ -318,7 +318,7 @@ EmbeddedFontHandler::~EmbeddedFontHandler()
osl::File::remove( fileUrl );
return;
}
- EmbeddedFontsHelper::activateFont( fontName, fileUrl );
+ TemporaryFonts::activateFont( fontName, fileUrl );
}
void EmbeddedFontHandler::lcl_attribute( Id name, Value& val )
diff --git a/xmloff/inc/pch/precompiled_xo.hxx b/xmloff/inc/pch/precompiled_xo.hxx
index aeffb54..d13eef3 100644
--- a/xmloff/inc/pch/precompiled_xo.hxx
+++ b/xmloff/inc/pch/precompiled_xo.hxx
@@ -550,7 +550,7 @@
#include <unotools/streamwrap.hxx>
#include <unotools/syslocale.hxx>
#include <utility>
-#include <vcl/embeddedfontshelper.hxx>
+#include <vcl/temporaryfonts.hxx>
#include <vector>
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx
index e8c33aa..9163ef5 100644
--- a/xmloff/source/style/XMLFontAutoStylePool.cxx
+++ b/xmloff/source/style/XMLFontAutoStylePool.cxx
@@ -25,7 +25,7 @@
#include "fonthdl.hxx"
#include <xmloff/xmlexp.hxx>
#include <xmloff/XMLFontAutoStylePool.hxx>
-#include <vcl/embeddedfontshelper.hxx>
+#include <vcl/temporaryfonts.hxx>
#include <osl/file.hxx>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -276,25 +276,18 @@ void XMLFontAutoStylePool::exportXML()
{
std::vector< OUString > fileUrls;
static const char* const styles[] = { "", "b", "i", "bi" };
- static const FontWeight weight[] = { WEIGHT_NORMAL, WEIGHT_BOLD, WEIGHT_NORMAL, WEIGHT_BOLD };
- static const FontItalic italic[] = { ITALIC_NONE, ITALIC_NONE, ITALIC_NORMAL, ITALIC_NORMAL };
- assert( SAL_N_ELEMENTS( styles ) == SAL_N_ELEMENTS( italic ));
- assert( SAL_N_ELEMENTS( styles ) == SAL_N_ELEMENTS( weight ));
for( unsigned int j = 0;
j < SAL_N_ELEMENTS( styles );
++j )
{
- OUString fileUrl = EmbeddedFontsHelper::fontFileUrl( pEntry->GetFamilyName(), pEntry->GetFamily(),
- italic[ j ], weight[ j ], pEntry->GetPitch(), pEntry->GetEncoding());
- if( fileUrl.isEmpty())
- continue;
+ OUString fileUrl = TemporaryFonts::fileUrlForFont( pEntry->GetFamilyName(), styles[ j ] );
if( !fontFilesMap.count( fileUrl ))
{
OUString docUrl = embedFontFile( fileUrl, styles[ j ] );
if( !docUrl.isEmpty())
fontFilesMap[ fileUrl ] = docUrl;
else
- continue; // --> failed to embed
+ continue; // --> failed (most probably this font is not embedded)
}
fileUrls.push_back( fileUrl );
}
diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx
index f269284..86433b8 100644
--- a/xmloff/source/style/XMLFontStylesContext.cxx
+++ b/xmloff/source/style/XMLFontStylesContext.cxx
@@ -26,7 +26,7 @@
#include <osl/file.hxx>
#include <rtl/logfile.hxx>
-#include <vcl/embeddedfontshelper.hxx>
+#include <vcl/temporaryfonts.hxx>
#include <xmloff/nmspmap.hxx>
#include "xmloff/xmlnmspe.hxx"
@@ -241,7 +241,7 @@ void XMLFontStyleContextFontFaceUri::handleEmbeddedFont( const OUString& url )
OUString fontName = font.familyName();
const char* style = "";
// OOXML needs to know what kind of style the font is (regular, italic, bold, bold-italic),
- // and the EmbeddedFontsHelper class is modelled after it. But ODF doesn't (need to) include
+ // and the TemporaryFonts class is modelled after it. But ODF doesn't (need to) include
// this information, so try to guess from the name (LO encodes the style), otherwise
// go with regular and hope it works.
if( url.endsWithIgnoreAsciiCase( "bi.ttf" ))
@@ -258,7 +258,7 @@ void XMLFontStyleContextFontFaceUri::handleEmbeddedFont( const OUString& url )
if( url.indexOf( '/' ) > -1 ) // TODO what if more levels?
storage.set( storage->openStorageElement( url.copy( 0, url.indexOf( '/' )),
::embed::ElementModes::READ ), uno::UNO_QUERY_THROW );
- OUString fileUrl = EmbeddedFontsHelper::fileUrlForTemporaryFont( fontName, style );
+ OUString fileUrl = TemporaryFonts::fileUrlForFont( fontName, style );
osl::File file( fileUrl );
switch( file.open( osl_File_OpenFlag_Create | osl_File_OpenFlag_Write ))
{
@@ -291,7 +291,7 @@ void XMLFontStyleContextFontFaceUri::handleEmbeddedFont( const OUString& url )
osl::File::remove( fileUrl );
return;
}
- EmbeddedFontsHelper::activateFont( fontName, fileUrl );
+ TemporaryFonts::activateFont( fontName, fileUrl );
GetImport().NotifyEmbeddedFontRead();
}
else
More information about the Libreoffice-commits
mailing list