2016-07-11 21:30:39 +00:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
/**
|
2016-08-03 17:43:55 +00:00
|
|
|
Shapes text using HarfBuzz and places the shaped text into a
|
2016-07-11 21:30:39 +00:00
|
|
|
TextBlob.
|
2016-08-03 17:43:55 +00:00
|
|
|
|
|
|
|
If compiled without HarfBuzz, fall back on SkPaint::textToGlyphs.
|
2016-07-11 21:30:39 +00:00
|
|
|
*/
|
|
|
|
class SkShaper {
|
|
|
|
public:
|
|
|
|
SkShaper(sk_sp<SkTypeface> face);
|
|
|
|
~SkShaper();
|
|
|
|
|
|
|
|
bool good() const;
|
2018-01-25 19:37:17 +00:00
|
|
|
SkPoint shape(SkTextBlobBuilder* dest,
|
2016-07-11 21:30:39 +00:00
|
|
|
const SkPaint& srcPaint,
|
|
|
|
const char* utf8text,
|
|
|
|
size_t textBytes,
|
2017-08-30 17:56:19 +00:00
|
|
|
bool leftToRight,
|
2017-11-16 15:08:28 +00:00
|
|
|
SkPoint point,
|
|
|
|
SkScalar width) const;
|
2016-07-11 21:30:39 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SkShaper(const SkShaper&) = delete;
|
|
|
|
SkShaper& operator=(const SkShaper&) = delete;
|
|
|
|
|
|
|
|
struct Impl;
|
|
|
|
std::unique_ptr<Impl> fImpl;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SkShaper_DEFINED
|