1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkTextUtils_DEFINED
9#define SkTextUtils_DEFINED
10
11#include "include/core/SkCanvas.h"
12#include "include/core/SkFont.h"
13#include "include/core/SkPaint.h"
14#include "include/core/SkString.h"
15
16class SkPath;
17
18class SK_API SkTextUtils {
19public:
20 enum Align {
21 kLeft_Align,
22 kCenter_Align,
23 kRight_Align,
24 };
25
26 static void Draw(SkCanvas*, const void* text, size_t size, SkTextEncoding,
27 SkScalar x, SkScalar y, const SkFont&, const SkPaint&, Align = kLeft_Align);
28
29 static void DrawString(SkCanvas* canvas, const char text[], SkScalar x, SkScalar y,
30 const SkFont& font, const SkPaint& paint, Align align = kLeft_Align) {
31 Draw(canvas, text, strlen(text), SkTextEncoding::kUTF8, x, y, font, paint, align);
32 }
33
34 static void GetPath(const void* text, size_t length, SkTextEncoding, SkScalar x, SkScalar y,
35 const SkFont&, SkPath*);
36};
37
38#endif
39