2018-10-25 16:36:06 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2018 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkTextUtils_DEFINED
|
|
|
|
#define SkTextUtils_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
|
|
|
#include "include/core/SkFont.h"
|
|
|
|
#include "include/core/SkPaint.h"
|
|
|
|
#include "include/core/SkString.h"
|
2018-10-25 16:36:06 +00:00
|
|
|
|
2018-12-26 03:06:17 +00:00
|
|
|
class SkPath;
|
|
|
|
|
2019-04-04 16:32:22 +00:00
|
|
|
class SK_API SkTextUtils {
|
2018-10-25 16:36:06 +00:00
|
|
|
public:
|
2018-10-30 16:53:21 +00:00
|
|
|
enum Align {
|
|
|
|
kLeft_Align,
|
|
|
|
kCenter_Align,
|
|
|
|
kRight_Align,
|
|
|
|
};
|
|
|
|
|
2018-12-24 04:19:14 +00:00
|
|
|
static void Draw(SkCanvas*, const void* text, size_t size, SkTextEncoding,
|
|
|
|
SkScalar x, SkScalar y, const SkFont&, const SkPaint&, Align = kLeft_Align);
|
|
|
|
|
|
|
|
static void DrawString(SkCanvas* canvas, const char text[], SkScalar x, SkScalar y,
|
|
|
|
const SkFont& font, const SkPaint& paint, Align align = kLeft_Align) {
|
2019-05-07 19:38:46 +00:00
|
|
|
Draw(canvas, text, strlen(text), SkTextEncoding::kUTF8, x, y, font, paint, align);
|
2018-12-24 04:19:14 +00:00
|
|
|
}
|
2018-10-25 16:36:06 +00:00
|
|
|
|
2018-12-26 03:06:17 +00:00
|
|
|
static void GetPath(const void* text, size_t length, SkTextEncoding, SkScalar x, SkScalar y,
|
|
|
|
const SkFont&, SkPath*);
|
2018-10-25 16:36:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|