summaryrefslogtreecommitdiff
path: root/vcl/quartz/salgdi.cxx
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-10-29 11:57:33 +0200
committerخالد حسني <khaled@aliftype.com>2022-10-29 13:50:28 +0200
commit8ca507a619313ead970ad03a71416dcebea91405 (patch)
tree44885500293d0e8ec9fc0b791a1dffce2cb33bb6 /vcl/quartz/salgdi.cxx
parent37d6dbd1b8f90604d58a782f7af0af1d5c8c1f89 (diff)
vcl: simplify how CoreTextFont stores CTFontRef
We create CFMutableDictionaryRef, store two items in it and only even access one of them. Simplify the whole thing and skip the middleman. Change-Id: Iefc6b2c2664b0ea92e231195390ce8cd0d8d9778 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142011 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl/quartz/salgdi.cxx')
-rw-r--r--vcl/quartz/salgdi.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index d0d6d517d2e7..a9f879dfea90 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -85,11 +85,10 @@ bool CoreTextGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSele
{
bool bFound = false;
CoreTextFont* pFont = static_cast<CoreTextFont*>(pLogicalFont);
- CTFontRef pCTFont = static_cast<CTFontRef>(CFDictionaryGetValue(pFont->GetStyleDict(), kCTFontAttributeName));
CFStringRef pStr = CreateCFString(rMissingChars);
if (pStr)
{
- CTFontRef pFallback = CTFontCreateForString(pCTFont, pStr, CFRangeMake(0, CFStringGetLength(pStr)));
+ CTFontRef pFallback = CTFontCreateForString(pFont->GetCTFont(), pStr, CFRangeMake(0, CFStringGetLength(pStr)));
if (pFallback)
{
bFound = true;
@@ -325,7 +324,7 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool b
return;
}
- CTFontRef pFont = static_cast<CTFontRef>(CFDictionaryGetValue(rFont.GetStyleDict(), kCTFontAttributeName));
+ CTFontRef pCTFont = rFont.GetCTFont();
CGAffineTransform aRotMatrix = CGAffineTransformMakeRotation(-rFont.mfFontRotation);
DevicePoint aPos;
@@ -347,7 +346,7 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool b
{
bUprightGlyph = true;
// Adjust the position of upright (vertical) glyphs.
- aGCPos.y -= CTFontGetAscent(pFont) - CTFontGetDescent(pFont);
+ aGCPos.y -= CTFontGetAscent(pCTFont) - CTFontGetDescent(pCTFont);
}
else
{
@@ -424,7 +423,7 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool b
{
CGContextRotateCTM(mrShared.maContextHolder.get(), rFont.mfFontRotation);
}
- CTFontDrawGlyphs(pFont, &aGlyphIds[nStartIndex], &aGlyphPos[nStartIndex], nLen, mrShared.maContextHolder.get());
+ CTFontDrawGlyphs(pCTFont, &aGlyphIds[nStartIndex], &aGlyphPos[nStartIndex], nLen, mrShared.maContextHolder.get());
mrShared.maContextHolder.restoreState();
aIt = aNext;