8 #include "../iplatformfont.h" 11 #include "../../ccolor.h" 14 #include <CoreText/CoreText.h> 16 #include <ApplicationServices/ApplicationServices.h> 23 class CoreTextFont :
public IPlatformFont,
public IFontPainter
26 CoreTextFont (
const UTF8String& name,
const CCoord& size,
const int32_t& style);
28 double getAscent ()
const override;
29 double getDescent ()
const override;
30 double getLeading ()
const override;
31 double getCapHeight ()
const override;
33 const IFontPainter* getPainter ()
const override {
return this; }
35 CTFontRef getFontRef ()
const {
return fontRef; }
36 CGFloat getSize ()
const {
return CTFontGetSize (fontRef); }
40 ~CoreTextFont () noexcept override;
42 void drawString (CDrawContext* context, IPlatformString*
string, const CPoint& p,
bool antialias = true) const override;
43 CCoord getStringWidth (CDrawContext* context, IPlatformString*
string,
bool antialias = true) const override;
44 CFDictionaryRef getStringAttributes (const CGColorRef color =
nullptr) const;
46 CTLineRef createCTLine (CDrawContext* context, MacString* macString) const;
51 mutable CColor lastColor;
52 mutable CFMutableDictionaryRef stringAttributes;
Definition: customcontrols.cpp:8