diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-08-17 13:10:36 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-08-23 15:00:30 +0200 |
commit | 55422ec895d3014ba0507757870ebdec9ac1a2a9 (patch) | |
tree | 0bec620294895d19ae4a3d248a582b35b7cf1bd5 /vcl/inc | |
parent | e3a8826709430f414411d22d98c1fd5e647e1417 (diff) |
implement text rendering on Mac using Skia
There may be still small problems (CJK needs checking), but this is
already usable.
Change-Id: Ic9381c22ca55d9e6320152ffebeae740fd90f796
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120810
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 14 | ||||
-rw-r--r-- | vcl/inc/skia/osx/gdiimpl.hxx | 5 |
2 files changed, 16 insertions, 3 deletions
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 6cedf6f09b29..80b79a6ec720 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -123,6 +123,8 @@ public: void AnnounceFonts( PhysicalFontCollection& ) const; CoreTextFontFace* GetFontDataFromId( sal_IntPtr nFontId ) const; + CTFontCollectionRef fontCollection() { return mpCTFontCollection; } + private: CTFontCollectionRef mpCTFontCollection; CFArrayRef mpCTFontArray; @@ -170,6 +172,10 @@ struct AquaSharedAttributes int mnXorMode; // 0: off 1: on 2: invert only int mnBitmapDepth; // zero unless bitmap + Color maTextColor; + /// allows text to be rendered without antialiasing + bool mbNonAntialiasedText; + std::unique_ptr<XorEmulation> mpXorEmulation; AquaSharedAttributes() @@ -188,6 +194,8 @@ struct AquaSharedAttributes , mnHeight(0) , mnXorMode(0) , mnBitmapDepth(0) + , maTextColor( COL_BLACK ) + , mbNonAntialiasedText( false ) {} void unsetClipPath() @@ -287,6 +295,7 @@ public: const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue) = 0; + virtual void drawTextLayout(const GenericSalLayout& layout) = 0; protected: static bool performDrawNativeControl(ControlType nType, ControlPart nPart, @@ -433,6 +442,8 @@ public: ControlState nState, const ImplControlValue &aValue) override; + virtual void drawTextLayout(const GenericSalLayout& layout) override; + bool supportsOperation(OutDevSupportType eType) const override; }; @@ -447,9 +458,6 @@ class AquaSalGraphics : public SalGraphicsAutoDelegateToImpl // Device Font settings rtl::Reference<CoreTextStyle> mpTextStyle[MAX_FALLBACK]; - RGBAColor maTextColor; - /// allows text to be rendered without antialiasing - bool mbNonAntialiasedText; public: AquaSalGraphics(); diff --git a/vcl/inc/skia/osx/gdiimpl.hxx b/vcl/inc/skia/osx/gdiimpl.hxx index e42126cfae46..cc291bd38764 100644 --- a/vcl/inc/skia/osx/gdiimpl.hxx +++ b/vcl/inc/skia/osx/gdiimpl.hxx @@ -17,6 +17,8 @@ #include <skia/gdiimpl.hxx> #include <skia/utils.hxx> +#include <SkFontMgr.h> + class VCL_PLUGIN_PUBLIC AquaSkiaSalGraphicsImpl final : public SkiaSalGraphicsImpl, public AquaGraphicsBackendBase { @@ -38,11 +40,14 @@ public: const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue) override; + virtual void drawTextLayout(const GenericSalLayout& layout) override; + private: virtual void createWindowContext(bool forceRaster = false) override; virtual void performFlush() override; void flushToScreen(const SkIRect& rect); friend std::unique_ptr<sk_app::WindowContext> createVulkanWindowContext(bool); + static inline sk_sp<SkFontMgr> fontManager; }; #endif // INCLUDED_VCL_INC_SKIA_OSX_GDIIMPL_HXX |