1 /* 2 * Copyright 2013 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkGScalerContext_DEFINED 9 #define SkGScalerContext_DEFINED 10 11 #include "SkScalerContext.h" 12 #include "SkTypeface.h" 13 14 class SkGTypeface : public SkTypeface { 15 public: 16 SkGTypeface(sk_sp<SkTypeface> proxy, const SkPaint&); 17 proxy()18 SkTypeface* proxy() const { return fProxy.get(); } paint()19 const SkPaint& paint() const { return fPaint; } 20 21 protected: 22 SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, 23 const SkDescriptor*) const override; 24 void onFilterRec(SkScalerContextRec*) const override; 25 SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( 26 PerGlyphInfo, 27 const uint32_t* glyphIDs, 28 uint32_t glyphIDsCount) const override; 29 SkStreamAsset* onOpenStream(int* ttcIndex) const override; 30 void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const override; 31 32 int onCharsToGlyphs(const void* chars, Encoding encoding, 33 uint16_t glyphs[], int glyphCount) const override; 34 int onCountGlyphs() const override; 35 int onGetUPEM() const override; 36 37 void onGetFamilyName(SkString* familyName) const override; 38 SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const override; 39 40 int onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[], 41 int coordinateCount) const override; 42 int onGetTableTags(SkFontTableTag tags[]) const override; 43 size_t onGetTableData(SkFontTableTag, size_t offset, 44 size_t length, void* data) const override; 45 46 private: 47 sk_sp<SkTypeface> fProxy; 48 SkPaint fPaint; 49 }; 50 51 #endif 52