331ccfd8e4
These are meant to enable several things (eventually) - fission Align off of paint - fission TextEncoding off of paint - fission SkFont of of paint The first one is explicitly enabled here. The others will (I plan) follow later. The final state of the world (the goal) - paint has no font-ish parameters (no typeface or size) - font has no paint-ish parameters (no aa or lcd) - neither has alignment or encoding Bug: skia:8493, skia:8501 Change-Id: I5fcb945b6bcab30ef5e7019dfccb682661f56230 Reviewed-on: https://skia-review.googlesource.com/c/165061 Auto-Submit: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
32 lines
1020 B
C++
32 lines
1020 B
C++
/*
|
|
* 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 "SkPaint.h"
|
|
#include "SkFont.h"
|
|
#include "SkString.h"
|
|
|
|
class SkTextUtils {
|
|
public:
|
|
static void DrawText(SkCanvas*, const void* text, size_t size, SkScalar x, SkScalar y,
|
|
const SkPaint&, SkPaint::Align = SkPaint::kLeft_Align);
|
|
|
|
static void DrawString(SkCanvas* canvas, const char text[], SkScalar x, SkScalar y,
|
|
const SkPaint& paint, SkPaint::Align align = SkPaint::kLeft_Align) {
|
|
DrawText(canvas, text, strlen(text), x, y, paint, align);
|
|
}
|
|
static void DrawString(SkCanvas* canvas, const SkString& str, SkScalar x, SkScalar y,
|
|
const SkPaint& paint, SkPaint::Align align = SkPaint::kLeft_Align) {
|
|
DrawText(canvas, str.c_str(), str.size(), x, y, paint, align);
|
|
}
|
|
};
|
|
|
|
#endif
|