vcl/inc/quartz/salgdi.h | 8 +++---- vcl/quartz/ctfonts.cxx | 16 +++++++------- vcl/quartz/salgdi.cxx | 52 +++++++++++++++++++++++------------------------ vcl/skia/osx/gdiimpl.cxx | 10 ++++----- 4 files changed, 43 insertions(+), 43 deletions(-)
New commits: commit 37d6dbd1b8f90604d58a782f7af0af1d5c8c1f89 Author: Khaled Hosny <kha...@aliftype.com> AuthorDate: Sat Oct 29 11:37:06 2022 +0200 Commit: خالد حسني <kha...@aliftype.com> CommitDate: Sat Oct 29 13:49:26 2022 +0200 vcl: rename CoreTextStyle to CoreTextFont Everywhere else we call them fonts. Change-Id: I70ef5957e9fb4fd03588cf23a255480ad021e083 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142010 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@aliftype.com> diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 5d2611f5b06e..8e54fa65aa53 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -78,12 +78,12 @@ private: CTFontDescriptorRef mxFontDescriptor; }; -class CoreTextStyle final : public LogicalFontInstance +class CoreTextFont final : public LogicalFontInstance { friend rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; public: - ~CoreTextStyle() override; + ~CoreTextFont() override; void GetFontMetric( ImplFontMetricDataRef const & ); bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; @@ -98,7 +98,7 @@ public: bool mbFauxBold; private: - explicit CoreTextStyle(const CoreTextFontFace&, const vcl::font::FontSelectPattern&); + explicit CoreTextFont(const CoreTextFontFace&, const vcl::font::FontSelectPattern&); virtual void ImplInitHbFont(hb_font_t*) override; bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; @@ -459,7 +459,7 @@ class AquaSalGraphics : public SalGraphicsAutoDelegateToImpl sal_Int32 mnRealDPIY; // Device Font settings - rtl::Reference<CoreTextStyle> mpTextStyle[MAX_FALLBACK]; + rtl::Reference<CoreTextFont> mpFont[MAX_FALLBACK]; public: AquaSalGraphics(); diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 298a5274aa1f..25a7efe46e2a 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -41,7 +41,7 @@ #include <sallayout.hxx> #include <hb-coretext.h> -CoreTextStyle::CoreTextStyle(const CoreTextFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP) +CoreTextFont::CoreTextFont(const CoreTextFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP) : LogicalFontInstance(rPFF, rFSP) , mfFontStretch( 1.0 ) , mfFontRotation( 0.0 ) @@ -94,13 +94,13 @@ CoreTextStyle::CoreTextStyle(const CoreTextFontFace& rPFF, const vcl::font::Font CFRelease( pNewCTFont); } -CoreTextStyle::~CoreTextStyle() +CoreTextFont::~CoreTextFont() { if( mpStyleDict ) CFRelease( mpStyleDict ); } -void CoreTextStyle::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) +void CoreTextFont::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) { // get the matching CoreText font handle // TODO: is it worth it to cache the CTFontRef in SetFont() and reuse it here? @@ -117,7 +117,7 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) rxFontMetric->SetMinKashida(GetKashidaWidth()); } -bool CoreTextStyle::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool bVertical) const +bool CoreTextFont::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool bVertical) const { CGGlyph nCGGlyph = nId; CTFontRef aCTFontRef = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); @@ -195,7 +195,7 @@ static void MyCGPathApplierFunc( void* pData, const CGPathElement* pElement ) } } -bool CoreTextStyle::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rResult, bool) const +bool CoreTextFont::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rResult, bool) const { rResult.clear(); @@ -284,7 +284,7 @@ hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const return pBlob; } -void CoreTextStyle::SetFontVariationsOnHBFont(hb_font_t* pHbFont) const +void CoreTextFont::SetFontVariationsOnHBFont(hb_font_t* pHbFont) const { CTFontRef aCTFontRef = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); @@ -326,14 +326,14 @@ void CoreTextStyle::SetFontVariationsOnHBFont(hb_font_t* pHbFont) const hb_font_set_variations(pHbFont, aHBVariations.data(), aHBVariations.size()); } -void CoreTextStyle::ImplInitHbFont(hb_font_t* pHbFont) +void CoreTextFont::ImplInitHbFont(hb_font_t* pHbFont) { SetFontVariationsOnHBFont(pHbFont); } rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const { - return new CoreTextStyle(*this, rFSD); + return new CoreTextFont(*this, rFSD); } int CoreTextFontFace::GetFontTable(uint32_t nTagCode, unsigned char* pResultBuf ) const diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index ac32415edc87..d0d6d517d2e7 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -84,12 +84,12 @@ bool CoreTextGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSele OUString& rMissingChars) const { bool bFound = false; - CoreTextStyle* pStyle = static_cast<CoreTextStyle*>(pLogicalFont); - CTFontRef pFont = static_cast<CTFontRef>(CFDictionaryGetValue(pStyle->GetStyleDict(), kCTFontAttributeName)); + CoreTextFont* pFont = static_cast<CoreTextFont*>(pLogicalFont); + CTFontRef pCTFont = static_cast<CTFontRef>(CFDictionaryGetValue(pFont->GetStyleDict(), kCTFontAttributeName)); CFStringRef pStr = CreateCFString(rMissingChars); if (pStr) { - CTFontRef pFallback = CTFontCreateForString(pFont, pStr, CFRangeMake(0, CFStringGetLength(pStr))); + CTFontRef pFallback = CTFontCreateForString(pCTFont, pStr, CFRangeMake(0, CFStringGetLength(pStr))); if (pFallback) { bFound = true; @@ -160,7 +160,7 @@ AquaSalGraphics::AquaSalGraphics() mpBackend.reset(new AquaGraphicsBackend(maShared)); for (int i = 0; i < MAX_FALLBACK; ++i) - mpTextStyle[i] = nullptr; + mpFont[i] = nullptr; if (comphelper::LibreOfficeKit::isActive()) initWidgetDrawBackends(true); @@ -208,9 +208,9 @@ void AquaSalGraphics::SetTextColor( Color nColor ) void AquaSalGraphics::GetFontMetric(ImplFontMetricDataRef& rxFontMetric, int nFallbackLevel) { - if (nFallbackLevel < MAX_FALLBACK && mpTextStyle[nFallbackLevel]) + if (nFallbackLevel < MAX_FALLBACK && mpFont[nFallbackLevel]) { - mpTextStyle[nFallbackLevel]->GetFontMetric(rxFontMetric); + mpFont[nFallbackLevel]->GetFontMetric(rxFontMetric); } } @@ -317,16 +317,16 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool b } #endif - const CoreTextStyle& rStyle = *static_cast<const CoreTextStyle*>(&rLayout.GetFont()); - const vcl::font::FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern(); + const CoreTextFont& rFont = *static_cast<const CoreTextFont*>(&rLayout.GetFont()); + const vcl::font::FontSelectPattern& rFontSelect = rFont.GetFontSelectPattern(); if (rFontSelect.mnHeight == 0) { SAL_WARN("vcl.quartz", "AquaSalGraphics::DrawTextLayout(): rFontSelect.mnHeight is zero!?"); return; } - CTFontRef pFont = static_cast<CTFontRef>(CFDictionaryGetValue(rStyle.GetStyleDict(), kCTFontAttributeName)); - CGAffineTransform aRotMatrix = CGAffineTransformMakeRotation(-rStyle.mfFontRotation); + CTFontRef pFont = static_cast<CTFontRef>(CFDictionaryGetValue(rFont.GetStyleDict(), kCTFontAttributeName)); + CGAffineTransform aRotMatrix = CGAffineTransformMakeRotation(-rFont.mfFontRotation); DevicePoint aPos; const GlyphItem* pGlyph; @@ -341,7 +341,7 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool b // Whether the glyph should be upright in vertical mode or not bool bUprightGlyph = false; - if (rStyle.mfFontRotation) + if (rFont.mfFontRotation) { if (pGlyph->IsVertical()) { @@ -392,7 +392,7 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool b CGContextSetShouldAntialias(mrShared.maContextHolder.get(), !mrShared.mbNonAntialiasedText); CGContextSetFillColor(mrShared.maContextHolder.get(), textColor.AsArray()); - if (rStyle.mbFauxBold) + if (rFont.mbFauxBold) { float fSize = rFontSelect.mnHeight / 23.0f; @@ -420,9 +420,9 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool b size_t nLen = std::distance(aIt, aNext); mrShared.maContextHolder.saveState(); - if (rStyle.mfFontRotation && !bUprightGlyph) + if (rFont.mfFontRotation && !bUprightGlyph) { - CGContextRotateCTM(mrShared.maContextHolder.get(), rStyle.mfFontRotation); + CGContextRotateCTM(mrShared.maContextHolder.get(), rFont.mfFontRotation); } CTFontDrawGlyphs(pFont, &aGlyphIds[nStartIndex], &aGlyphPos[nStartIndex], nLen, mrShared.maContextHolder.get()); mrShared.maContextHolder.restoreState(); @@ -435,45 +435,45 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool b void AquaSalGraphics::SetFont(LogicalFontInstance* pReqFont, int nFallbackLevel) { - // release the text style + // release the font for (int i = nFallbackLevel; i < MAX_FALLBACK; ++i) { - if (!mpTextStyle[i]) + if (!mpFont[i]) break; - mpTextStyle[i].clear(); + mpFont[i].clear(); } if (!pReqFont) return; - // update the text style - mpTextStyle[nFallbackLevel] = static_cast<CoreTextStyle*>(pReqFont); + // update the font + mpFont[nFallbackLevel] = static_cast<CoreTextFont*>(pReqFont); } std::unique_ptr<GenericSalLayout> AquaSalGraphics::GetTextLayout(int nFallbackLevel) { - assert(mpTextStyle[nFallbackLevel]); - if (!mpTextStyle[nFallbackLevel]) + assert(mpFont[nFallbackLevel]); + if (!mpFont[nFallbackLevel]) return nullptr; - return std::make_unique<GenericSalLayout>(*mpTextStyle[nFallbackLevel]); + return std::make_unique<GenericSalLayout>(*mpFont[nFallbackLevel]); } FontCharMapRef AquaSalGraphics::GetFontCharMap() const { - if (!mpTextStyle[0]) + if (!mpFont[0]) { return FontCharMapRef( new FontCharMap() ); } - return mpTextStyle[0]->GetFontFace()->GetFontCharMap(); + return mpFont[0]->GetFontFace()->GetFontCharMap(); } bool AquaSalGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const { - if (!mpTextStyle[0]) + if (!mpFont[0]) return false; - return mpTextStyle[0]->GetFontFace()->GetFontCapabilities(rFontCapabilities); + return mpFont[0]->GetFontFace()->GetFontCapabilities(rFontCapabilities); } void AquaSalGraphics::Flush() diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx index fef8b54e3db4..604c297c6fdd 100644 --- a/vcl/skia/osx/gdiimpl.cxx +++ b/vcl/skia/osx/gdiimpl.cxx @@ -277,8 +277,8 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n void AquaSkiaSalGraphicsImpl::drawTextLayout(const GenericSalLayout& rLayout, bool bSubpixelPositioning) { - const CoreTextStyle& rStyle = *static_cast<const CoreTextStyle*>(&rLayout.GetFont()); - const vcl::font::FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern(); + const CoreTextFont& rFont = *static_cast<const CoreTextFont*>(&rLayout.GetFont()); + const vcl::font::FontSelectPattern& rFontSelect = rFont.GetFontSelectPattern(); int nHeight = rFontSelect.mnHeight; int nWidth = rFontSelect.mnWidth ? rFontSelect.mnWidth : nHeight; if (nWidth == 0 || nHeight == 0) @@ -302,12 +302,12 @@ void AquaSkiaSalGraphicsImpl::drawTextLayout(const GenericSalLayout& rLayout, } CTFontRef pFont - = static_cast<CTFontRef>(CFDictionaryGetValue(rStyle.GetStyleDict(), kCTFontAttributeName)); + = static_cast<CTFontRef>(CFDictionaryGetValue(rFont.GetStyleDict(), kCTFontAttributeName)); sk_sp<SkTypeface> typeface = SkMakeTypefaceFromCTFont(pFont); SkFont font(typeface); font.setSize(nHeight); - // font.setScaleX(rStyle.mfFontStretch); TODO - if (rStyle.mbFauxBold) + // font.setScaleX(rFont.mfFontStretch); TODO + if (rFont.mbFauxBold) font.setEmbolden(true); SkFont::Edging ePreferredAliasing