| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkFontMgr.h" | 10 #include "SkFontMgr.h" |
| 11 #include "SkGraphics.h" | 11 #include "SkGraphics.h" |
| 12 #include "SkTypeface.h" | 12 #include "SkTypeface.h" |
| 13 | 13 |
| 14 #ifdef SK_BUILD_FOR_WIN | 14 #ifdef SK_BUILD_FOR_WIN |
| 15 extern SkFontMgr* SkFontMgr_New_GDI(); | 15 #include "SkTypeface_win.h" |
| 16 extern SkFontMgr* SkFontMgr_New_DirectWrite(); | |
| 17 #endif | 16 #endif |
| 18 | 17 |
| 19 // limit this just so we don't take too long to draw | 18 // limit this just so we don't take too long to draw |
| 20 #define MAX_FAMILIES 30 | 19 #define MAX_FAMILIES 30 |
| 21 | 20 |
| 22 static SkScalar drawString(SkCanvas* canvas, const SkString& text, SkScalar x, | 21 static SkScalar drawString(SkCanvas* canvas, const SkString& text, SkScalar x, |
| 23 SkScalar y, const SkPaint& paint) { | 22 SkScalar y, const SkPaint& paint) { |
| 24 canvas->drawText(text.c_str(), text.size(), x, y, paint); | 23 canvas->drawText(text.c_str(), text.size(), x, y, paint); |
| 25 return x + paint.measureText(text.c_str(), text.size()); | 24 return x + paint.measureText(text.c_str(), text.size()); |
| 26 } | 25 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 }; | 192 }; |
| 194 | 193 |
| 195 ////////////////////////////////////////////////////////////////////////////// | 194 ////////////////////////////////////////////////////////////////////////////// |
| 196 | 195 |
| 197 DEF_GM( return SkNEW(FontMgrGM); ) | 196 DEF_GM( return SkNEW(FontMgrGM); ) |
| 198 DEF_GM( return SkNEW(FontMgrMatchGM); ) | 197 DEF_GM( return SkNEW(FontMgrMatchGM); ) |
| 199 | 198 |
| 200 #ifdef SK_BUILD_FOR_WIN | 199 #ifdef SK_BUILD_FOR_WIN |
| 201 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite)); ) | 200 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite)); ) |
| 202 #endif | 201 #endif |
| OLD | NEW |