Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: gm/lcdtext.cpp

Issue 407183003: add portable and canonical font support for DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add atexit; rename to create_... Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/internal_links.cpp ('k') | gm/lighting.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 /* Tests text rendering with LCD and subpixel rendering turned on and off. 10 /* Tests text rendering with LCD and subpixel rendering turned on and off.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 drawText(canvas, SkString("TEXT: SubpixelFalse LCDRenderFalse"), 42 drawText(canvas, SkString("TEXT: SubpixelFalse LCDRenderFalse"),
43 false, false); 43 false, false);
44 } 44 }
45 45
46 void drawText(SkCanvas* canvas, const SkString& string, 46 void drawText(SkCanvas* canvas, const SkString& string,
47 bool subpixelTextEnabled, bool lcdRenderTextEnabled) { 47 bool subpixelTextEnabled, bool lcdRenderTextEnabled) {
48 SkPaint paint; 48 SkPaint paint;
49 paint.setColor(SK_ColorBLACK); 49 paint.setColor(SK_ColorBLACK);
50 paint.setDither(true); 50 paint.setDither(true);
51 paint.setAntiAlias(true); 51 paint.setAntiAlias(true);
52 sk_tool_utils::set_portable_typeface(&paint);
52 paint.setSubpixelText(subpixelTextEnabled); 53 paint.setSubpixelText(subpixelTextEnabled);
53 paint.setLCDRenderText(lcdRenderTextEnabled); 54 paint.setLCDRenderText(lcdRenderTextEnabled);
54 paint.setTextSize(textHeight); 55 paint.setTextSize(textHeight);
55 56
56 canvas->drawText(string.c_str(), string.size(), 0, y, paint); 57 canvas->drawText(string.c_str(), string.size(), 0, y, paint);
57 y += textHeight; 58 y += textHeight;
58 } 59 }
59 60
60 private: 61 private:
61 typedef GM INHERITED; 62 typedef GM INHERITED;
62 SkScalar y, textHeight; 63 SkScalar y, textHeight;
63 }; 64 };
64 65
65 /////////////////////////////////////////////////////////////////////////////// 66 ///////////////////////////////////////////////////////////////////////////////
66 67
67 static GM* MyFactory(void*) { return new LcdTextGM; } 68 static GM* MyFactory(void*) { return new LcdTextGM; }
68 static GMRegistry reg(MyFactory); 69 static GMRegistry reg(MyFactory);
69 70
70 } 71 }
OLDNEW
« no previous file with comments | « gm/internal_links.cpp ('k') | gm/lighting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698