summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/quartz/salgdi.h2
-rw-r--r--vcl/quartz/ctfonts.cxx48
2 files changed, 15 insertions, 35 deletions
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index a0e00c6c2af2..b621e715ef54 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -68,8 +68,6 @@ public:
CTFontDescriptorRef GetFontDescriptorRef() const { return mxFontDescriptor; }
- int GetFontTable( uint32_t nTagCode, unsigned char* ) const;
-
rtl::Reference<LogicalFontInstance> CreateFontInstance(const vcl::font::FontSelectPattern&) const override;
virtual hb_blob_t* GetHbTable(hb_tag_t nTag) const override;
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 81ab7a6ad2dc..861c57fa1ba9 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -218,13 +218,13 @@ bool CoreTextFont::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rRe
hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const
{
hb_blob_t* pBlob = nullptr;
+ CTFontDescriptorRef pFontDesc = reinterpret_cast<CTFontDescriptorRef>(GetFontId());
if (!nTag)
{
// If nTag is 0, the whole font data is requested. CoreText does not
// give us that, so we will construct an HarfBuzz face from CoreText
// table data and return the blob of that face.
- auto pFontDesc = reinterpret_cast<CTFontDescriptorRef>(GetFontId());
auto rCTFont = CTFontCreateWithFontDescriptor(pFontDesc, 0.0, nullptr);
auto pTags = CTFontCopyAvailableTables(rCTFont, kCTFontTableOptionNoOptions);
@@ -252,18 +252,24 @@ hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const
return pBlob;
}
- sal_uLong nLength = 0;
- unsigned char* pBuffer = nullptr;
- nLength = GetFontTable(nTag, nullptr);
+ CTFontRef pFont = CTFontCreateWithFontDescriptor(pFontDesc, 0.0, nullptr);
+ CFDataRef pData = CTFontCopyTable(pFont, nTag, kCTFontTableOptionNoOptions);
+
+ const CFIndex nLength = pData ? CFDataGetLength(pData) : 0;
if (nLength > 0)
{
- pBuffer = new unsigned char[nLength];
- GetFontTable(nTag, pBuffer);
+ auto pBuffer = new UInt8[nLength];
+ const CFRange aRange = CFRangeMake(0, nLength);
+ CFDataGetBytes(pData, aRange, pBuffer);
+
+ pBlob = hb_blob_create(reinterpret_cast<const char*>(pBuffer), nLength,
+ HB_MEMORY_MODE_READONLY, pBuffer,
+ [](void* data) { delete[] static_cast<UInt8*>(data); });
}
+ if (pData)
+ CFRelease(pData);
+ CFRelease(pFont);
- if (pBuffer != nullptr)
- pBlob = hb_blob_create(reinterpret_cast<const char*>(pBuffer), nLength, HB_MEMORY_MODE_READONLY,
- pBuffer, [](void* data){ delete[] static_cast<unsigned char*>(data); });
return pBlob;
}
@@ -317,30 +323,6 @@ rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const v
return new CoreTextFont(*this, rFSD);
}
-int CoreTextFontFace::GetFontTable(uint32_t nTagCode, unsigned char* pResultBuf ) const
-{
- // get the raw table length
- CTFontDescriptorRef pFontDesc = reinterpret_cast<CTFontDescriptorRef>( GetFontId());
- CTFontRef rCTFont = CTFontCreateWithFontDescriptor( pFontDesc, 0.0, nullptr);
- CFDataRef pDataRef = CTFontCopyTable(rCTFont, nTagCode, kCTFontTableOptionNoOptions);
- CFRelease( rCTFont);
- if( !pDataRef)
- return 0;
-
- const CFIndex nByteLength = CFDataGetLength( pDataRef);
-
- // get the raw table data if requested
- if( pResultBuf && (nByteLength > 0))
- {
- const CFRange aFullRange = CFRangeMake( 0, nByteLength);
- CFDataGetBytes( pDataRef, aFullRange, reinterpret_cast<UInt8*>(pResultBuf));
- }
-
- CFRelease( pDataRef);
-
- return static_cast<int>(nByteLength);
-}
-
FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFontEnabled )
{
// all CoreText fonts are device fonts that can rotate just fine