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 10 namespace skia { 11 namespace textlayout { 12 13 class FontArguments { 14 public: 15 FontArguments(const SkFontArguments&); 16 FontArguments(const FontArguments&) = default; 17 FontArguments(FontArguments&&) = default; 18 19 FontArguments& operator=(const FontArguments&) = default; 20 FontArguments& operator=(FontArguments&&) = default; 21 22 sk_sp<SkTypeface> CloneTypeface(const sk_sp<SkTypeface>& typeface) const; 23 24 friend bool operator==(const FontArguments& a, const FontArguments& b); 25 friend bool operator!=(const FontArguments& a, const FontArguments& b); 26 friend struct std::hash<FontArguments>; 27 28 private: 29 FontArguments() = delete; 30 31 int fCollectionIndex; 32 std::vector<SkFontArguments::VariationPosition::Coordinate> fCoordinates; 33 int fPaletteIndex; 34 std::vector<SkFontArguments::Palette::Override> fPaletteOverrides; 35 }; 36 37 } // namespace textlayout 38 } // namespace skia 39 40 namespace std { 41 template<> struct hash<skia::textlayout::FontArguments> { 42 size_t operator()(const skia::textlayout::FontArguments& args) const; 43 }; 44 } 45 46 #endif // FontArguments_DEFINED 47