summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/quartz/salgdi.h4
-rw-r--r--vcl/inc/skia/osx/gdiimpl.hxx3
-rw-r--r--vcl/quartz/salgdi.cxx12
-rw-r--r--vcl/skia/osx/gdiimpl.cxx11
4 files changed, 22 insertions, 8 deletions
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index f0aa925c6083..569a14a6d3fc 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -297,7 +297,7 @@ public:
const tools::Rectangle &rControlRegion,
ControlState nState,
const ImplControlValue &aValue) = 0;
- virtual void drawTextLayout(const GenericSalLayout& layout) = 0;
+ virtual void drawTextLayout(const GenericSalLayout& layout, bool bTextRenderModeForResolutionIndependentLayout) = 0;
virtual void Flush() {}
virtual void Flush( const tools::Rectangle& ) {}
protected:
@@ -446,7 +446,7 @@ public:
ControlState nState,
const ImplControlValue &aValue) override;
- virtual void drawTextLayout(const GenericSalLayout& layout) override;
+ virtual void drawTextLayout(const GenericSalLayout& layout, bool bTextRenderModeForResolutionIndependentLayout) override;
bool supportsOperation(OutDevSupportType eType) const override;
};
diff --git a/vcl/inc/skia/osx/gdiimpl.hxx b/vcl/inc/skia/osx/gdiimpl.hxx
index e59aa60f56df..71baf24625fc 100644
--- a/vcl/inc/skia/osx/gdiimpl.hxx
+++ b/vcl/inc/skia/osx/gdiimpl.hxx
@@ -38,7 +38,8 @@ public:
const tools::Rectangle& rControlRegion, ControlState nState,
const ImplControlValue& aValue) override;
- virtual void drawTextLayout(const GenericSalLayout& layout) override;
+ virtual void drawTextLayout(const GenericSalLayout& layout,
+ bool bTextRenderModeForResolutionIndependentLayout) override;
virtual void Flush() override;
virtual void Flush(const tools::Rectangle&) override;
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 5a1051965b6c..cbeaea4fc62b 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -362,10 +362,10 @@ bool AquaSalGraphics::AddTempDevFont(vcl::font::PhysicalFontCollection*,
void AquaSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
{
- mpBackend->drawTextLayout(rLayout);
+ mpBackend->drawTextLayout(rLayout, getTextRenderModeForResolutionIndependentLayoutEnabled());
}
-void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout)
+void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool bTextRenderModeForResolutionIndependentLayout)
{
#ifdef IOS
if (!mrShared.checkContext())
@@ -459,6 +459,14 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout)
CGContextSetTextDrawingMode(mrShared.maContextHolder.get(), kCGTextFillStroke);
}
+ if (bTextRenderModeForResolutionIndependentLayout)
+ {
+ CGContextSetAllowsFontSubpixelQuantization(mrShared.maContextHolder.get(), false);
+ CGContextSetShouldSubpixelQuantizeFonts(mrShared.maContextHolder.get(), false);
+ CGContextSetAllowsFontSubpixelPositioning(mrShared.maContextHolder.get(), true);
+ CGContextSetShouldSubpixelPositionFonts(mrShared.maContextHolder.get(), true);
+ }
+
auto aIt = aGlyphOrientation.cbegin();
while (aIt != aGlyphOrientation.cend())
{
diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx
index fa3f1c528322..1035d998a1c8 100644
--- a/vcl/skia/osx/gdiimpl.cxx
+++ b/vcl/skia/osx/gdiimpl.cxx
@@ -261,7 +261,8 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n
return bOK;
}
-void AquaSkiaSalGraphicsImpl::drawTextLayout(const GenericSalLayout& rLayout)
+void AquaSkiaSalGraphicsImpl::drawTextLayout(const GenericSalLayout& rLayout,
+ bool bSubpixelPositioning)
{
const CoreTextStyle& rStyle = *static_cast<const CoreTextStyle*>(&rLayout.GetFont());
const vcl::font::FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern();
@@ -295,8 +296,12 @@ void AquaSkiaSalGraphicsImpl::drawTextLayout(const GenericSalLayout& rLayout)
// font.setScaleX(rStyle.mfFontStretch); TODO
if (rStyle.mbFauxBold)
font.setEmbolden(true);
- font.setEdging(!mrShared.mbNonAntialiasedText ? SkFont::Edging::kAntiAlias
- : SkFont::Edging::kAlias);
+
+ SkFont::Edging ePreferredAliasing
+ = bSubpixelPositioning ? SkFont::Edging::kSubpixelAntiAlias : SkFont::Edging::kAntiAlias;
+ if (bSubpixelPositioning)
+ font.setSubpixel(true);
+ font.setEdging(mrShared.mbNonAntialiasedText ? SkFont::Edging::kAlias : ePreferredAliasing);
// Vertical font, use width as "height".
SkFont verticalFont(font);