aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/atlastext/SkAtlasTextFont.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-11-19 13:20:13 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-19 18:55:18 +0000
commitcbcb0a12ad0068b820c28178e8aa141166febd1f (patch)
tree120917b5961b8a043894b95811eec1f8f6379b25 /include/atlastext/SkAtlasTextFont.h
parentb07b06e14819c7bfb9da87dd754aca1239045af4 (diff)
Revert "Revert "Add Atlas Text interface for rendering SDF glyphs.""
This reverts commit 9c2202ffc22b4293b48a4edeafa1b5d2bab8bb83. 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>
Diffstat (limited to 'include/atlastext/SkAtlasTextFont.h')
-rw-r--r--include/atlastext/SkAtlasTextFont.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/atlastext/SkAtlasTextFont.h b/include/atlastext/SkAtlasTextFont.h
new file mode 100644
index 0000000000..a9e641f7ad
--- /dev/null
+++ b/include/atlastext/SkAtlasTextFont.h
@@ -0,0 +1,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