2 * Copyright 2020 Google LLC
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkCustomTypeface_DEFINED
9 #define SkCustomTypeface_DEFINED
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"
25 class SkCustomTypefaceBuilder {
27 SkCustomTypefaceBuilder();
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>);
34 void setMetrics(const SkFontMetrics& fm, float scale = 1);
35 void setFontStyle(SkFontStyle);
37 sk_sp<SkTypeface> detach();
40 std::vector<SkPath> fPaths;
41 std::vector<float> fAdvances;
42 SkFontMetrics fMetrics;
45 static sk_sp<SkTypeface> Deserialize(SkStream*);
47 friend class SkTypeface;