diff options
author | Herb Derby <herb@google.com> | 2018-05-29 15:53:40 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-30 04:04:07 +0000 |
commit | 264182c3f7d282e57a4b1d46fde3ef702b81c5c3 (patch) | |
tree | 85c68bfa138662fd60cc3ab3bcad26f83cb9b80d /modules/skshaper/include | |
parent | 09725b0c3fd52b008743c63feb09ec1ab8bc2eea (diff) |
Make SkShaper a module
Change-Id: I3709e49ba865f14260660cc07a762b9ac837cb3c
Reviewed-on: https://skia-review.googlesource.com/130602
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'modules/skshaper/include')
-rw-r--r-- | modules/skshaper/include/SkShaper.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/modules/skshaper/include/SkShaper.h b/modules/skshaper/include/SkShaper.h new file mode 100644 index 0000000000..190a4d834e --- /dev/null +++ b/modules/skshaper/include/SkShaper.h @@ -0,0 +1,47 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkShaper_DEFINED +#define SkShaper_DEFINED + +#include <memory> + +#include "SkPoint.h" +#include "SkTypeface.h" + +class SkPaint; +class SkTextBlobBuilder; + +/** + Shapes text using HarfBuzz and places the shaped text into a + TextBlob. + + If compiled without HarfBuzz, fall back on SkPaint::textToGlyphs. + */ +class SkShaper { +public: + SkShaper(sk_sp<SkTypeface> face); + ~SkShaper(); + + bool good() const; + SkPoint shape(SkTextBlobBuilder* dest, + const SkPaint& srcPaint, + const char* utf8text, + size_t textBytes, + bool leftToRight, + SkPoint point, + SkScalar width) const; + +private: + SkShaper(const SkShaper&) = delete; + SkShaper& operator=(const SkShaper&) = delete; + + struct Impl; + std::unique_ptr<Impl> fImpl; +}; + +#endif // SkShaper_DEFINED |