diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-05-17 20:40:37 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-05-18 11:03:58 +0200 |
commit | 2092df2a9044f1c2ae4379f48a3201e5867575a8 (patch) | |
tree | 4c6523d255e44480bfde07417c1ccd1937f7a61c /include | |
parent | 2f4103da5625a9b90eb41d5c767a248a8d0b4255 (diff) |
tdf#161154: pass "scaling is done externally" information down the stack
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D does the
scaling, taking into account the font scaling. Before commit
8557ea84c9336ba8061246f1f46ddb6e02f413a1, D2DWriteTextOutRenderer was
doing own scaling in addition, but it seems that it somehow didn't
affect the result much. The said commit removed the scalng from
D2DWriteTextOutRenderer. As tdf#160901 demonstrated, the scaling is
necessary in different code paths - and it turns out, that we need to
know, if the caller does its own scaling or not, to make a decision,
if the scaling should be fone in D2DWriteTextOutRenderer.
This hack passes this from VclProcessor2D to D2DWriteTextOutRenderer
through OutputDevice. Thanks to Miklos for the isea. I still don't
understand, why all this seemingly doesn't affect other renderers.
Change-Id: I001036f4574898b8e7606652525638df43c35240
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167786
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/outdev.hxx | 5 | ||||
-rw-r--r-- | include/vcl/vcllayout.hxx | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index ab1758835ce1..6dbb9acf7f32 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -21,6 +21,7 @@ #include <sal/config.h> +#include <comphelper/flagguard.hxx> #include <tools/gen.hxx> #include <tools/ref.hxx> #include <tools/solar.h> @@ -260,6 +261,8 @@ private: mutable bool mbRefPoint : 1; mutable bool mbEnableRTL : 1; + bool mbNoFontScaling = false; // Used only by D2DWriteTextOutRenderer + protected: mutable std::shared_ptr<vcl::font::PhysicalFontCollection> mxFontCollection; mutable std::shared_ptr<ImplFontCache> mxFontCache; @@ -342,6 +345,8 @@ public: /// request XSpriteCanvas render interface css::uno::Reference< css::rendering::XSpriteCanvas > GetSpriteCanvas() const; + auto ScopedNoFontScaling() { return comphelper::FlagRestorationGuard(mbNoFontScaling, true); } + protected: /** Acquire a graphics device that the output device uses to draw on. diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx index dd0747eae3ec..9370c69ded2e 100644 --- a/include/vcl/vcllayout.hxx +++ b/include/vcl/vcllayout.hxx @@ -22,6 +22,7 @@ #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/range/b2drectangle.hxx> +#include <comphelper/flagguard.hxx> #include <i18nlangtag/languagetag.hxx> #include <tools/gen.hxx> #include <tools/degree.hxx> @@ -120,6 +121,9 @@ public: virtual SalLayoutGlyphs GetGlyphs() const; + auto ScopedFontScaling(bool v) { return comphelper::FlagRestorationGuard(mbScaleFont, v); } + bool ScaleFont() const { return mbScaleFont; } + protected: // used by layout engines SalLayout(); @@ -128,6 +132,8 @@ private: SalLayout(const SalLayout&) = delete; SalLayout& operator=(const SalLayout&) = delete; + bool mbScaleFont = true; // Used only by D2DWriteTextOutRenderer + protected: int mnMinCharPos; int mnEndCharPos; |