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
|
|
|
|
|
|
|
|
#include "SkCanvas.h"
|
|
|
|
#include "SkFont.h"
|
2018-12-24 04:19:14 +00:00
|
|
|
#include "SkPaint.h"
|
2018-10-25 16:36:06 +00:00
|
|
|
#include "SkString.h"
|
|
|
|
|
2018-12-26 03:06:17 +00:00
|
|
|
class SkPath;
|
|
|
|
|
2018-10-25 16:36:06 +00:00
|
|
|
class SkTextUtils {
|
|
|
|
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) {
|
|
|
|
Draw(canvas, text, strlen(text), kUTF8_SkTextEncoding, x, y, font, paint, align);
|
|
|
|
}
|
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
|