skia2/tools/SkShaper.h
halcanary 8a74f13239 tools/SkShaper: factor shaping out of using_skia_and_harfbuzz
Make a clearer demarcation between shaping and layout.

also: refactor using_skia_and_harfbuzz; stop leaking
like a sieve.

Review-Url: https://codereview.chromium.org/2138133002
2016-07-11 14:30:39 -07:00

44 lines
882 B
C++

/*
* 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.
*/
class SkShaper {
public:
SkShaper(sk_sp<SkTypeface> face);
~SkShaper();
bool good() const;
SkScalar shape(SkTextBlobBuilder* dest,
const SkPaint& srcPaint,
const char* utf8text,
size_t textBytes,
SkPoint point) const;
private:
SkShaper(const SkShaper&) = delete;
SkShaper& operator=(const SkShaper&) = delete;
struct Impl;
std::unique_ptr<Impl> fImpl;
};
#endif // SkShaper_DEFINED