blob: bc78be7d541e73a5f69eecda1bbc356205ac48c4 [file] [log] [blame]
halcanary8a74f132016-07-11 14:30:39 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkShaper_DEFINED
9#define SkShaper_DEFINED
10
11#include <memory>
12
13#include "SkPoint.h"
14#include "SkTypeface.h"
15
16class SkPaint;
17class SkTextBlobBuilder;
18
19/**
halcanary13cba492016-08-03 10:43:55 -070020 Shapes text using HarfBuzz and places the shaped text into a
halcanary8a74f132016-07-11 14:30:39 -070021 TextBlob.
halcanary13cba492016-08-03 10:43:55 -070022
23 If compiled without HarfBuzz, fall back on SkPaint::textToGlyphs.
halcanary8a74f132016-07-11 14:30:39 -070024 */
25class SkShaper {
26public:
27 SkShaper(sk_sp<SkTypeface> face);
28 ~SkShaper();
29
30 bool good() const;
31 SkScalar shape(SkTextBlobBuilder* dest,
32 const SkPaint& srcPaint,
33 const char* utf8text,
34 size_t textBytes,
35 SkPoint point) const;
36
37private:
38 SkShaper(const SkShaper&) = delete;
39 SkShaper& operator=(const SkShaper&) = delete;
40
41 struct Impl;
42 std::unique_ptr<Impl> fImpl;
43};
44
45#endif // SkShaper_DEFINED