skia2/include/atlastext/SkAtlasTextFont.h
Mike Reed 191e64b6c6 pass a font to GlyphRunBuilder
- avoid using legacy paint->font converter
- call out that drawText exists just for testing
- simplify drawText to assume UTF8

Bug: skia:
Change-Id: Ide14d8581d4744827d2282e7983cc5e19070b21e
Reviewed-on: https://skia-review.googlesource.com/c/180641
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-01-02 21:02:33 +00:00

39 lines
1.0 KiB
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 "SkFont.h"
#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; }
SkFont makeFont() const { return SkFont(fTypeface, fSize); }
private:
SkAtlasTextFont(sk_sp<SkTypeface> typeface, SkScalar size)
: fTypeface(std::move(typeface)), fSize(size) {}
sk_sp<SkTypeface> fTypeface;
SkScalar fSize;
};
#endif