diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-06-26 20:06:40 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-06-27 12:57:22 +0200 |
commit | b262e6e5da0c2e66e00cd6d68d7c2df11a34ff5c (patch) | |
tree | 826c979a58c3b96134c50c651777f76ca30f0a11 /include/xmloff/XMLFontAutoStylePool.hxx | |
parent | eeef4ab2f4abb7c7b2eef193849029437d46c551 (diff) |
xmloff: prevent embedding same font files with checksumming
When embedding fonts to ODF documents we can get into a situation
where the same font is embedded multiple times and this wastes
space. To prevent this we calculate the checksum of the font first
and track the fonts that are embedded. When the font has the same
checksum, the path to already embedded font is returned.
Change-Id: I087c42d9a63b1697b9b4ea985dbce2fda760a996
Reviewed-on: https://gerrit.libreoffice.org/56507
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/xmloff/XMLFontAutoStylePool.hxx')
-rw-r--r-- | include/xmloff/XMLFontAutoStylePool.hxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/xmloff/XMLFontAutoStylePool.hxx b/include/xmloff/XMLFontAutoStylePool.hxx index e747bb8b20d8..530d05b2762a 100644 --- a/include/xmloff/XMLFontAutoStylePool.hxx +++ b/include/xmloff/XMLFontAutoStylePool.hxx @@ -26,6 +26,7 @@ #include <tools/fontenum.hxx> #include <salhelper/simplereferenceobject.hxx> #include <set> +#include <unordered_map> #include <memory> class XMLFontAutoStylePool_Impl; @@ -33,13 +34,15 @@ class SvXMLExport; class XMLOFF_DLLPUBLIC XMLFontAutoStylePool : public salhelper::SimpleReferenceObject { +private: SvXMLExport& rExport; std::unique_ptr<XMLFontAutoStylePool_Impl> m_pFontAutoStylePool; std::set<OUString> m_aNames; bool m_bTryToEmbedFonts; + std::unordered_map<OString, OUString> m_aEmbeddedFontFiles; - OUString embedFontFile( const OUString& fontUrl ); + OUString embedFontFile(OUString const & rFileUrl, OUString const & rFamilyName); protected: |