[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - vcl/inc vcl/quartz
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 22 12:05:17 UTC 2019
vcl/inc/quartz/salgdi.h | 2 ++
vcl/quartz/ctfonts.cxx | 5 ++---
vcl/quartz/salgdi.cxx | 9 +++++++++
3 files changed, 13 insertions(+), 3 deletions(-)
New commits:
commit 2141597694905250ea6a1228dc34e575f8bc04a2
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Apr 20 21:50:37 2019 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 22 13:00:17 2019 +0900
tdf#101854 Move to CommonSalLayout removed faux bold in macos
Previously faux bold was drawn with setting a dictionary key
kCTStrokeWidthAttributeName and a value of the stroke width. This
stopped working because we don't use attributedString for drawing
anymore but we always use CTFontDrawGlyphs and draw the glyphs,
which doesn't have a way to set this attributes.
It took me a while to find a workaround (thanks to Apple's great
documentation), where we switch text drawing to fill and stroke,
and after that we can modify the stroke by changing the line
width.
Reviewed-on: https://gerrit.libreoffice.org/71012
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit eb5606511fac2a8ee1af7cc03c12d6c5b16f7c96)
Change-Id: I594fcb9c796a9c04ea8234a9938ca2f719706199
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 39ba333c547a..1a21669989bd 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -102,6 +102,8 @@ public:
/// text rotation in radian
float mfFontRotation;
FontSelectPattern maFontSelData;
+ /// faux bold - true, if font doesn't have proper bold variants
+ float mbFauxBold;
private:
/// CoreText text style object
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 2d5b103b8e63..f0c7b586abcb 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -49,6 +49,7 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
, mfFontStretch( 1.0 )
, mfFontRotation( 0.0 )
, maFontSelData( rFSD )
+ , mbFauxBold(false)
, mpStyleDict( nullptr )
, mpHbFont( nullptr )
{
@@ -83,9 +84,7 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
((mpFontData->GetWeight() < WEIGHT_SEMIBOLD) &&
(mpFontData->GetWeight() != WEIGHT_DONTKNOW)) )
{
- int nStroke = -lrint((3.5F * pReqFont->GetWeight()) / mpFontData->GetWeight());
- CFNumberRef rStroke = CFNumberCreate(nullptr, kCFNumberSInt32Type, &nStroke);
- CFDictionarySetValue(mpStyleDict, kCTStrokeWidthAttributeName, rStroke);
+ mbFauxBold = true;
}
// fake italic
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index d7aa4d279370..aa183f354a39 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -467,6 +467,15 @@ void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
CGContextSetShouldAntialias(mrContext, !mbNonAntialiasedText);
CGContextSetFillColor(mrContext, maTextColor.AsArray());
+ if (rStyle.mbFauxBold)
+ {
+
+ float fSize = rFontSelect.mnHeight / 23.0f;
+ CGContextSetStrokeColor(mrContext, maTextColor.AsArray());
+ CGContextSetLineWidth(mrContext, fSize);
+ CGContextSetTextDrawingMode(mrContext, kCGTextFillStroke);
+ }
+
auto aIt = aGlyphOrientation.cbegin();
while (aIt != aGlyphOrientation.cend())
{
More information about the Libreoffice-commits
mailing list