8#ifndef SkTypeface_mac_ct_DEFINED
9#define SkTypeface_mac_ct_DEFINED
12#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
24#ifdef SK_BUILD_FOR_MAC
25#import <ApplicationServices/ApplicationServices.h>
28#ifdef SK_BUILD_FOR_IOS
29#include <CoreText/CoreText.h>
30#include <CoreText/CTFontManager.h>
31#include <CoreGraphics/CoreGraphics.h>
32#include <CoreFoundation/CoreFoundation.h>
52struct CTFontVariation {
53 SkUniqueCFRef<CFDictionaryRef> variation;
54 SkUniqueCFRef<CFDictionaryRef> wrongOpszVariation;
58SkFontStyle SkCTFontDescriptorGetSkFontStyle(CTFontDescriptorRef
desc,
bool fromDataProvider);
60CGFloat SkCTFontCTWeightForCSSWeight(
int fontstyleWeight);
61CGFloat SkCTFontCTWidthForCSSWidth(
int fontstyleWidth);
67 SkTypeface_Mac(SkUniqueCFRef<CTFontRef> fontRef,
const SkFontStyle& fs,
bool isFixedPitch,
68 OpszVariation opszVariation, std::unique_ptr<SkStreamAsset> providedData)
70 , fFontRef(
std::move(fontRef))
71 , fOpszVariation(opszVariation)
73 SkToBool(CTFontGetSymbolicTraits(fFontRef.
get()) & kCTFontColorGlyphsTrait))
74 , fStream(
std::move(providedData))
75 , fIsFromStream(fStream)
82 OpszVariation opszVariation,
83 std::unique_ptr<SkStreamAsset> providedData);
89 SkUniqueCFRef<CTFontRef> fFontRef;
90 const OpszVariation fOpszVariation;
91 const bool fHasColorGlyphs;
100 CFArrayRef getVariationAxes()
const;
104 std::unique_ptr<SkStreamAsset>
onOpenStream(
int* ttcIndex)
const override;
108 int coordinateCount)
const override;
125 int parameterCount)
const override;
128 void*
onGetCTFontRef()
const override {
return (
void*)fFontRef.get(); }
131 mutable std::unique_ptr<SkStreamAsset> fStream;
132 mutable SkUniqueCFRef<CFArrayRef> fVariationAxes;
134 mutable SkOnce fInitStream;
135 mutable SkOnce fInitVariationAxes;
#define INHERITED(method,...)
static constexpr bool SkToBool(const T &x)
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
virtual void * onGetCTFontRef() const
virtual std::unique_ptr< SkStreamAsset > onOpenExistingStream(int *ttcIndex) const
virtual sk_sp< SkData > onCopyTableData(SkFontTableTag) const
virtual void getPostScriptGlyphNames(SkString *) const =0
virtual std::unique_ptr< SkAdvancedTypefaceMetrics > onGetAdvancedMetrics() const =0
virtual void getGlyphToUnicodeMap(SkUnichar *dstArray) const =0
virtual std::unique_ptr< SkScalerContext > onCreateScalerContext(const SkScalerContextEffects &, const SkDescriptor *) const =0
virtual int onCountGlyphs() const =0
virtual int onGetTableTags(SkFontTableTag tags[]) const =0
virtual std::unique_ptr< SkStreamAsset > onOpenStream(int *ttcIndex) const =0
virtual void onGetFontDescriptor(SkFontDescriptor *, bool *isLocal) const =0
virtual sk_sp< SkTypeface > onMakeClone(const SkFontArguments &) const =0
virtual size_t onGetTableData(SkFontTableTag, size_t offset, size_t length, void *data) const =0
virtual bool onGetPostScriptName(SkString *) const =0
virtual void onGetFamilyName(SkString *familyName) const =0
virtual void onFilterRec(SkScalerContextRec *) const =0
virtual bool onGlyphMaskNeedsCurrentColor() const =0
virtual LocalizedStrings * onCreateFamilyNameIterator() const =0
virtual int onGetVariationDesignParameters(SkFontParameters::Variation::Axis parameters[], int parameterCount) const =0
virtual void onCharsToGlyphs(const SkUnichar *chars, int count, SkGlyphID glyphs[]) const =0
virtual int onGetUPEM() const =0
SkTypeface(const SkFontStyle &style, bool isFixedPitch=false)
virtual int onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const =0
std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream > stream, SkCodec::SelectionPolicy selectionPolicy, SkCodec::Result *result)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
font
Font Metadata and Metrics.
const myers::Point & get(const myers::Segment &)
std::shared_ptr< const fml::Mapping > data