Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / include / utils / SkCustomTypeface.h
1 /*
2  * Copyright 2020 Google LLC
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 SkCustomTypeface_DEFINED
9 #define SkCustomTypeface_DEFINED
10
11 #include "include/core/SkFontMetrics.h"
12 #include "include/core/SkFontStyle.h"
13 #include "include/core/SkPath.h"
14 #include "include/core/SkRefCnt.h"
15 #include "include/core/SkTypes.h"
16
17 #include <vector>
18
19 class SkImage;
20 class SkPaint;
21 class SkPicture;
22 class SkStream;
23 class SkTypeface;
24
25 class SkCustomTypefaceBuilder {
26 public:
27     SkCustomTypefaceBuilder();
28
29     void setGlyph(SkGlyphID, float advance, const SkPath&);
30     void setGlyph(SkGlyphID, float advance, const SkPath&, const SkPaint&);
31     void setGlyph(SkGlyphID, float advance, sk_sp<SkImage>, float scale);
32     void setGlyph(SkGlyphID, float advance, sk_sp<SkPicture>);
33
34     void setMetrics(const SkFontMetrics& fm, float scale = 1);
35     void setFontStyle(SkFontStyle);
36
37     sk_sp<SkTypeface> detach();
38
39 private:
40     std::vector<SkPath> fPaths;
41     std::vector<float>  fAdvances;
42     SkFontMetrics       fMetrics;
43     SkFontStyle         fStyle;
44
45     static sk_sp<SkTypeface> Deserialize(SkStream*);
46
47     friend class SkTypeface;
48 };
49
50 #endif