remove SkPaint breakText, use SkFont instead (or don't call it)
Bug: skia:
Change-Id: I906b8ea70be1f70043b77ca32cc214d15c256967
Reviewed-on: https://skia-review.googlesource.com/c/175254
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index a09d7c9..6e07a97 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -3280,36 +3280,6 @@
##
-#Method size_t breakText(const void* text, size_t length, SkScalar maxWidth,
- SkScalar* measuredWidth = nullptr) const
-#In Measure_Text
-#Line # returns text that fits in a width ##
-#Populate
-
-#Example
- #Description
- Line under "Breakfast" shows desired width, shorter than available characters.
- Line under "Bre" shows measured width after breaking text.
- ##
- #Height 128
- #Width 280
- void draw(SkCanvas* canvas) {
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(50);
- const char str[] = "Breakfast";
- const int count = sizeof(str) - 1;
- canvas->drawText(str, count, 25, 50, paint);
- SkScalar measuredWidth;
- int partialBytes = paint.breakText(str, count, 100, &measuredWidth);
- canvas->drawText(str, partialBytes, 25, 100, paint);
- canvas->drawLine(25, 60, 25 + 100, 60, paint);
- canvas->drawLine(25, 110, 25 + measuredWidth, 110, paint);
- }
- ##
-
-##
-
#Method int getTextWidths(const void* text, size_t byteLength, SkScalar widths[],
SkRect bounds[] = nullptr) const
#In Measure_Text
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 817f3f1..b9434f0 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -1027,23 +1027,6 @@
}
#endif
- /** Returns the bytes of text that fit within maxWidth.
- The text fragment fits if its advance width is less than or equal to maxWidth.
- Measures only while the advance is less than or equal to maxWidth.
- Returns the advance or the text fragment in measuredWidth if it not nullptr.
- Uses SkTextEncoding to decode text, SkTypeface to get the font metrics,
- and text size to scale the metrics.
- Does not scale the advance or bounds by fake bold or SkPathEffect.
-
- @param text character codes or glyph indices to be measured
- @param length number of bytes of text to measure
- @param maxWidth advance limit; text is measured while advance is less than maxWidth
- @param measuredWidth returns the width of the text less than or equal to maxWidth
- @return bytes of text that fit, always less than or equal to length
- */
- size_t breakText(const void* text, size_t length, SkScalar maxWidth,
- SkScalar* measuredWidth = nullptr) const;
-
#ifdef SK_SUPPORT_LEGACY_PAINT_TEXTMEASURE
/** Retrieves the advance and bounds for each glyph in text, and returns
the glyph count in text.
diff --git a/src/core/SkPaint_text.cpp b/src/core/SkPaint_text.cpp
index 47ac73f..3b3b796 100644
--- a/src/core/SkPaint_text.cpp
+++ b/src/core/SkPaint_text.cpp
@@ -344,12 +344,6 @@
return width;
}
-size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
- SkScalar* measuredWidth) const {
- return SkFont::LEGACY_ExtractFromPaint(*this).breakText(textD, length,
- this->getTextEncoding(), maxWidth, measuredWidth);
-}
-
SkScalar SkPaint::getFontMetrics(SkFontMetrics* metrics) const {
return SkFont::LEGACY_ExtractFromPaint(*this).getMetrics(metrics);
}