2017-11-19 18:20:13 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkFont.h"
|
|
|
|
#include "include/core/SkRefCnt.h"
|
|
|
|
#include "include/core/SkTypeface.h"
|
2017-11-19 18:20:13 +00:00
|
|
|
|
|
|
|
/** 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; }
|
|
|
|
|
2019-01-02 20:35:29 +00:00
|
|
|
SkFont makeFont() const { return SkFont(fTypeface, fSize); }
|
|
|
|
|
2017-11-19 18:20:13 +00:00
|
|
|
private:
|
|
|
|
SkAtlasTextFont(sk_sp<SkTypeface> typeface, SkScalar size)
|
|
|
|
: fTypeface(std::move(typeface)), fSize(size) {}
|
|
|
|
|
|
|
|
sk_sp<SkTypeface> fTypeface;
|
|
|
|
SkScalar fSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|