aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/atlastext/SkAtlasTextFont.h
blob: a9e641f7ad6eab0bc2aa8ead5ee0a13c898446d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkAtlasTextFont_DEFINED
#define SkAtlasTextFont_DEFINED

#include "SkRefCnt.h"
#include "SkTypeface.h"

/** Represents a font at a size. TODO: What else do we need here (skewX, scaleX, vertical, ...)? */
class SK_API SkAtlasTextFont : public SkRefCnt {
public:
    static sk_sp<SkAtlasTextFont> Make(sk_sp<SkTypeface> typeface, SkScalar size) {
        return sk_sp<SkAtlasTextFont>(new SkAtlasTextFont(std::move(typeface), size));
    }

    SkTypeface* typeface() const { return fTypeface.get(); }

    sk_sp<SkTypeface> refTypeface() const { return fTypeface; }

    SkScalar size() const { return fSize; }

private:
    SkAtlasTextFont(sk_sp<SkTypeface> typeface, SkScalar size)
            : fTypeface(std::move(typeface)), fSize(size) {}

    sk_sp<SkTypeface> fTypeface;
    SkScalar fSize;
};

#endif