Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / skia / font_converter / src / font.h
1 #ifndef RiveFont_DEFINED
2 #define RiveFont_DEFINED
3
4 #include "include/core/SkData.h"
5 #include "include/core/SkPath.h"
6 #include "include/core/SkTypeface.h"
7 #include <vector>
8
9 class RiveFont {
10     struct Pair {
11         uint16_t fChar;
12         uint16_t fGlyph;
13     };
14     std::vector<Pair> fCMap;
15
16     struct Glyph {
17         SkPath fPath;
18         float fAdvance;
19     };
20     std::vector<Glyph> fGlyphs;
21
22 public:
23     uint16_t charToGlyph(SkUnichar) const;
24     float advance(uint16_t glyph) const;
25     const SkPath* path(uint16_t glyph) const;
26
27     void clear() {
28         fCMap.clear();
29         fGlyphs.clear();
30     }
31
32     void load(sk_sp<SkTypeface>, const char text[], size_t length);
33
34     sk_sp<SkData> encode() const;
35     bool decode(const void*, size_t);
36 };
37
38 #endif