aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkFontHost_mac.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ports/SkFontHost_mac.cpp')
-rw-r--r--src/ports/SkFontHost_mac.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 4774eab87f..a43cf22c98 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -62,6 +62,10 @@
// Set to make glyph bounding boxes visible.
#define SK_SHOW_TEXT_BLIT_COVERAGE 0
+CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face) {
+ return face ? (CTFontRef)face->internal_private_getCTFontRef() : nullptr;
+}
+
class SkScalerContext_Mac;
struct CFSafeRelease {
@@ -528,6 +532,8 @@ protected:
uint16_t glyphs[], int glyphCount) const override;
int onCountGlyphs() const override;
+ void* onGetCTFontRef() const override { return (void*)fFontRef.get(); }
+
private:
bool fIsLocalStream;
@@ -536,7 +542,7 @@ private:
static bool find_by_CTFontRef(SkTypeface* cached, void* context) {
CTFontRef self = (CTFontRef)context;
- CTFontRef other = ((SkTypeface_Mac*)cached)->fFontRef.get();
+ CTFontRef other = (CTFontRef)cached->internal_private_getCTFontRef();
return CFEqual(self, other);
}
@@ -653,12 +659,6 @@ static SkTypeface* create_from_name(const char familyName[], const SkFontStyle&
///////////////////////////////////////////////////////////////////////////////
-extern CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face);
-CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face) {
- const SkTypeface_Mac* macface = (const SkTypeface_Mac*)face;
- return macface ? macface->fFontRef.get() : nullptr;
-}
-
/* This function is visible on the outside. It first searches the cache, and if
* not found, returns a new entry (after adding it to the cache).
*/
@@ -779,7 +779,7 @@ SkScalerContext_Mac::SkScalerContext_Mac(sk_sp<SkTypeface_Mac> typeface,
{
AUTO_CG_LOCK();
- CTFontRef ctFont = static_cast<SkTypeface_Mac*>(this->getTypeface())->fFontRef.get();
+ CTFontRef ctFont = (CTFontRef)this->getTypeface()->internal_private_getCTFontRef();
CFIndex numGlyphs = CTFontGetGlyphCount(ctFont);
SkASSERT(numGlyphs >= 1 && numGlyphs <= 0xFFFF);
fGlyphCount = SkToU16(numGlyphs);