include/vcl/filter/SvmReader.hxx | 1 + include/vcl/metaact.hxx | 2 ++ vcl/source/filter/svm/SvmReader.cxx | 19 ++++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-)
New commits: commit e6773aaa82a11485bf07c1e960f8c1df5f7f02d5 Author: panoskorovesis <panoskorove...@outlook.com> AuthorDate: Thu Jul 15 10:15:25 2021 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Jul 19 10:01:28 2021 +0200 Add Handler for Font Read The handler separates MetaFontAction::Read from metaact.hxx Read implementation is now in SvmReader.hxx Change-Id: Id301813ceb29e13488a472ab8e3b2dfd9287d624 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118979 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx index 60d60dacedf4..aa0fcda1aa20 100644 --- a/include/vcl/filter/SvmReader.hxx +++ b/include/vcl/filter/SvmReader.hxx @@ -79,6 +79,7 @@ public: rtl::Reference<MetaAction> OverlineColorHandler(); rtl::Reference<MetaAction> TextAlignHandler(); rtl::Reference<MetaAction> MapModeHandler(); + rtl::Reference<MetaAction> FontHandler(ImplMetaReadData* pData); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index e6fce271d9be..03631e6000a1 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -1548,6 +1548,8 @@ public: virtual void Scale( double fScaleX, double fScaleY ) override; const vcl::Font& GetFont() const { return maFont; } + void SetFont(const vcl::Font& rFont) { maFont = rFont; } + }; class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaPushAction final : public MetaAction diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx index 5f1947bffe76..7c1b101e925a 100644 --- a/vcl/source/filter/svm/SvmReader.cxx +++ b/vcl/source/filter/svm/SvmReader.cxx @@ -19,6 +19,7 @@ #include <vcl/filter/SvmReader.hxx> #include <sal/log.hxx> +#include <osl/thread.h> #include <tools/stream.hxx> #include <tools/vcompat.hxx> #include <vcl/dibtools.hxx> @@ -286,7 +287,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData) return MapModeHandler(); break; case MetaActionType::FONT: - pAction = new MetaFontAction; + return FontHandler(pData); break; case MetaActionType::PUSH: pAction = new MetaPushAction; @@ -1243,4 +1244,20 @@ rtl::Reference<MetaAction> SvmReader::MapModeHandler() return pAction; } + +rtl::Reference<MetaAction> SvmReader::FontHandler(ImplMetaReadData* pData) +{ + auto pAction = new MetaFontAction(); + + VersionCompatRead aCompat(mrStream); + vcl::Font aFont; + ReadFont(mrStream, aFont); + pData->meActualCharSet = aFont.GetCharSet(); + if (pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW) + pData->meActualCharSet = osl_getThreadTextEncoding(); + + pAction->SetFont(aFont); + + return pAction; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits