Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 569dda7

Browse files
reed-at-googleSkia Commit-Bot
authored andcommitted
hide SkFont::containsText
Bug: skia: Change-Id: I197addb0ea1da57083283b30e19e290cdaf8dac6 Reviewed-on: https://skia-review.googlesource.com/c/188581 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com> Auto-Submit: Mike Reed <reed@google.com>
1 parent 72a0e33 commit 569dda7

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

bench/CmapBench.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ enum {
1717
typedef void (*TypefaceProc)(int loops, const SkFont&, const void* text, size_t len,
1818
int glyphCount);
1919

20-
static void containsText_proc(int loops, const SkFont& font, const void* text, size_t len,
21-
int glyphCount) {
22-
for (int i = 0; i < loops; ++i) {
23-
font.containsText(text, len, kUTF8_SkTextEncoding);
24-
}
25-
}
26-
2720
static void textToGlyphs_proc(int loops, const SkFont& font, const void* text, size_t len,
2821
int glyphCount) {
2922
uint16_t glyphs[NGLYPHS];
@@ -87,7 +80,6 @@ class CMAPBench : public Benchmark {
8780

8881
//////////////////////////////////////////////////////////////////////////////
8982

90-
DEF_BENCH( return new CMAPBench(containsText_proc, "paint_containsText"); )
9183
DEF_BENCH( return new CMAPBench(textToGlyphs_proc, "paint_textToGlyphs"); )
9284
DEF_BENCH( return new CMAPBench(charsToGlyphs_proc, "face_charsToGlyphs"); )
9385
DEF_BENCH( return new CMAPBench(charsToGlyphsNull_proc, "face_charsToGlyphs_null"); )

include/core/SkFont.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ class SK_API SkFont {
320320
return this->textToGlyphs(text, byteLength, encoding, nullptr, 0);
321321
}
322322

323+
#ifdef SK_SUPPORT_LEGACY_CONTAINSTEXT
323324
/** Returns true if all text corresponds to a non-zero glyph index.
324325
Returns false if any characters in text are not supported in
325326
SkTypeface.
@@ -336,6 +337,7 @@ class SK_API SkFont {
336337
@return true if all text corresponds to a non-zero glyph index
337338
*/
338339
bool containsText(const void* text, size_t byteLength, SkTextEncoding encoding) const;
340+
#endif
339341

340342
#ifdef SK_SUPPORT_LEGACY_BREAKTEXT
341343
/** Deprecated.

src/core/SkFont.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ void SkFont::glyphsToUnichars(const SkGlyphID glyphs[], int count, SkUnichar tex
219219
}
220220
}
221221

222+
#ifdef SK_SUPPORT_LEGACY_CONTAINSTEXT
222223
static SkTypeface::Encoding to_encoding(SkTextEncoding e) {
223224
static_assert((int)SkTypeface::kUTF8_Encoding == (int)kUTF8_SkTextEncoding, "");
224225
static_assert((int)SkTypeface::kUTF16_Encoding == (int)kUTF16_SkTextEncoding, "");
@@ -255,6 +256,7 @@ bool SkFont::containsText(const void* textData, size_t byteLength, SkTextEncodin
255256
}
256257
return true;
257258
}
259+
#endif
258260

259261
#ifdef SK_SUPPORT_LEGACY_BREAKTEXT
260262
size_t SkFont::breakText(const void* textD, size_t length, SkTextEncoding encoding,

tests/PaintTest.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ DEF_TEST(Paint_cmap, reporter) {
9393

9494
uint16_t glyphs0[NGLYPHS], glyphs1[NGLYPHS];
9595

96-
bool contains = font.containsText(dst, len, gRec[k].fEncoding);
9796
int nglyphs = font.textToGlyphs(dst, len, gRec[k].fEncoding, glyphs0, NGLYPHS);
9897
int first = face->charsToGlyphs(dst, (SkTypeface::Encoding)gRec[k].fEncoding,
9998
glyphs1, NGLYPHS);
@@ -102,11 +101,6 @@ DEF_TEST(Paint_cmap, reporter) {
102101
REPORTER_ASSERT(reporter, NGLYPHS == nglyphs);
103102
REPORTER_ASSERT(reporter, index == first);
104103
REPORTER_ASSERT(reporter, 0 == memcmp(glyphs0, glyphs1, NGLYPHS * sizeof(uint16_t)));
105-
if (contains) {
106-
REPORTER_ASSERT(reporter, NGLYPHS == first);
107-
} else {
108-
REPORTER_ASSERT(reporter, NGLYPHS > first);
109-
}
110104
}
111105
}
112106
}

0 commit comments

Comments
 (0)