From 590ef3fd3a39ff1aa08746e323da41cbd2928f49 Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Tue, 10 Mar 2009 04:02:30 +0000 Subject: remember to specify the bloody font tag in the constructor! git-svn-id: http://skia.googlecode.com/svn/trunk@118 2bbb7eff-a529-9590-31e7-b0007b416f81 --- samplecode/SampleFontScalerTest.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'samplecode/SampleFontScalerTest.cpp') diff --git a/samplecode/SampleFontScalerTest.cpp b/samplecode/SampleFontScalerTest.cpp index 380d34671a..356ab39c72 100644 --- a/samplecode/SampleFontScalerTest.cpp +++ b/samplecode/SampleFontScalerTest.cpp @@ -29,6 +29,14 @@ static const struct { static const int gFaceCount = SK_ARRAY_COUNT(gFaces); +static const char* gStrings[] = { + "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH", + "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii", + "......................................", + "11111111111111111111111111111111111111", + "00000000000000000000000000000000000000" +}; + class FontScalerTestView : public SkView { SkTypeface* fFaces[gFaceCount]; @@ -67,16 +75,29 @@ protected: paint.setAntiAlias(true); paint.setTypeface(SkTypeface::CreateFromName("Times Roman", SkTypeface::kNormal))->safeUnref(); - const char* text = "HHHaaammmbbbuuurrrgggeeefffooonnnsss"; - const size_t textLen = strlen(text); +// const char* text = "abcdefghijklmnopqrstuvwxyz"; + const char* text = "HnHnHnHnHnHnHnHnH"; + size_t textLen = strlen(text); SkScalar x = SkIntToScalar(10); SkScalar y = SkIntToScalar(20); + { + SkPaint p; + p.setColor(SK_ColorRED); + SkRect r; + r.set(0, 0, x, y*20); + canvas->drawRect(r, p); + } + + int index = 0; for (int ps = 9; ps <= 24; ps++) { + // text = gStrings[index % SK_ARRAY_COUNT(gStrings)]; + textLen = strlen(text); paint.setTextSize(SkIntToScalar(ps)); canvas->drawText(text, textLen, x, y, paint); y += paint.getFontMetrics(NULL); + index += 1; } } -- cgit v1.2.3