skia2/include/atlastext/SkAtlasTextFont.h
Brian Salomon cbcb0a12ad Revert "Revert "Add Atlas Text interface for rendering SDF glyphs.""
This reverts commit 9c2202ffc2.

Bug: skia:
Change-Id: I482ddf74f8e40d3d0908c840ba5c6ff981ccefbd
Reviewed-on: https://skia-review.googlesource.com/73345
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-11-19 18:55:18 +00:00

36 lines
962 B
C++

/*
* 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