1/*
2 * Copyright 2017 Google Inc.
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 SkAtlasTextFont_DEFINED
9#define SkAtlasTextFont_DEFINED
10
11#include "include/core/SkFont.h"
12#include "include/core/SkRefCnt.h"
13#include "include/core/SkTypeface.h"
14
15/** Represents a font at a size. TODO: What else do we need here (skewX, scaleX, vertical, ...)? */
16class SK_API SkAtlasTextFont : public SkRefCnt {
17public:
18 static sk_sp<SkAtlasTextFont> Make(sk_sp<SkTypeface> typeface, SkScalar size) {
19 return sk_sp<SkAtlasTextFont>(new SkAtlasTextFont(std::move(typeface), size));
20 }
21
22 SkTypeface* typeface() const { return fTypeface.get(); }
23
24 sk_sp<SkTypeface> refTypeface() const { return fTypeface; }
25
26 SkScalar size() const { return fSize; }
27
28 SkFont makeFont() const { return SkFont(fTypeface, fSize); }
29
30private:
31 SkAtlasTextFont(sk_sp<SkTypeface> typeface, SkScalar size)
32 : fTypeface(std::move(typeface)), fSize(size) {}
33
34 sk_sp<SkTypeface> fTypeface;
35 SkScalar fSize;
36};
37
38#endif
39