1 // Copyright 2019 Google LLC. 2 #ifndef FontArguments_DEFINED 3 #define FontArguments_DEFINED 4 5 #include <functional> 6 #include <vector> 7 #include "include/core/SkFontArguments.h" 8 #include "include/core/SkTypeface.h" 9 #ifdef ENABLE_TEXT_ENHANCE 10 #include "drawing.h" 11 #endif 12 13 namespace skia { 14 namespace textlayout { 15 16 class FontArguments { 17 public: 18 FontArguments(const SkFontArguments&); 19 FontArguments(const FontArguments&) = default; 20 FontArguments(FontArguments&&) = default; 21 22 FontArguments& operator=(const FontArguments&) = default; 23 FontArguments& operator=(FontArguments&&) = default; 24 25 #ifdef ENABLE_TEXT_ENHANCE 26 std::shared_ptr<RSTypeface> CloneTypeface(std::shared_ptr<RSTypeface> typeface) const; 27 #else 28 sk_sp<SkTypeface> CloneTypeface(const sk_sp<SkTypeface>& typeface) const; 29 #endif 30 31 friend bool operator==(const FontArguments& a, const FontArguments& b); 32 friend bool operator!=(const FontArguments& a, const FontArguments& b); 33 friend struct std::hash<FontArguments>; 34 35 private: 36 FontArguments() = delete; 37 38 int fCollectionIndex; 39 std::vector<SkFontArguments::VariationPosition::Coordinate> fCoordinates; 40 int fPaletteIndex; 41 std::vector<SkFontArguments::Palette::Override> fPaletteOverrides; 42 }; 43 44 } // namespace textlayout 45 } // namespace skia 46 47 namespace std { 48 template<> struct hash<skia::textlayout::FontArguments> { 49 size_t operator()(const skia::textlayout::FontArguments& args) const; 50 }; 51 } 52 53 #endif // FontArguments_DEFINED 54