skia2/tools/shape/SkShaper.h
Ben Wagner 5d4dd8bef5 SkShaper to account for line wrap.
Now that line wrap is possible, handle it.

Change-Id: Ibe2c849cedfd91167c2d48352999052b61d47e9d
Reviewed-on: https://skia-review.googlesource.com/99885
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-01-25 21:28:22 +00:00

48 lines
1023 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.
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