| 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" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // check to see that we get different glyphs in japanese and chi
nese | 108 // check to see that we get different glyphs in japanese and chi
nese |
| 109 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str()
, &zh, 1, fs); | 109 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str()
, &zh, 1, fs); |
| 110 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str()
, &ja, 1, fs); | 110 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str()
, &ja, 1, fs); |
| 111 // check that emoji characters are found | 111 // check that emoji characters are found |
| 112 x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, fName.c_str(
), NULL, 0, fs); | 112 x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, fName.c_str(
), NULL, 0, fs); |
| 113 } | 113 } |
| 114 y += 24; | 114 y += 24; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 uint32_t onGetFlags() const SK_OVERRIDE { | |
| 119 // fontdescriptors (and therefore serialization) don't yet understand | |
| 120 // these new styles, so skip tests that exercise that for now. | |
| 121 | |
| 122 // If certain fonts are picked up (e.g. Microsoft Jhenghei 20MB for Regu
lar, 12MB for Bold), | |
| 123 // the resulting pdf can be ~700MB and crashes Chrome's PDF viewer. | |
| 124 | |
| 125 return kSkipPicture_Flag | kSkipPipe_Flag | kSkipPDF_Flag; | |
| 126 } | |
| 127 | |
| 128 private: | 118 private: |
| 129 SkAutoTUnref<SkFontMgr> fFM; | 119 SkAutoTUnref<SkFontMgr> fFM; |
| 130 SkString fName; | 120 SkString fName; |
| 131 typedef GM INHERITED; | 121 typedef GM INHERITED; |
| 132 }; | 122 }; |
| 133 | 123 |
| 134 class FontMgrMatchGM : public skiagm::GM { | 124 class FontMgrMatchGM : public skiagm::GM { |
| 135 SkAutoTUnref<SkFontMgr> fFM; | 125 SkAutoTUnref<SkFontMgr> fFM; |
| 136 | 126 |
| 137 public: | 127 public: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 if (NULL == fset.get()) { | 197 if (NULL == fset.get()) { |
| 208 return; | 198 return; |
| 209 } | 199 } |
| 210 | 200 |
| 211 canvas->translate(20, 40); | 201 canvas->translate(20, 40); |
| 212 this->exploreFamily(canvas, paint, fset); | 202 this->exploreFamily(canvas, paint, fset); |
| 213 canvas->translate(150, 0); | 203 canvas->translate(150, 0); |
| 214 this->iterateFamily(canvas, paint, fset); | 204 this->iterateFamily(canvas, paint, fset); |
| 215 } | 205 } |
| 216 | 206 |
| 217 uint32_t onGetFlags() const SK_OVERRIDE { | |
| 218 // fontdescriptors (and therefore serialization) don't yet understand | |
| 219 // these new styles, so skip tests that exercise that for now. | |
| 220 return kSkipPicture_Flag | kSkipPipe_Flag; | |
| 221 } | |
| 222 | |
| 223 private: | 207 private: |
| 224 typedef GM INHERITED; | 208 typedef GM INHERITED; |
| 225 }; | 209 }; |
| 226 | 210 |
| 227 class FontMgrBoundsGM : public skiagm::GM { | 211 class FontMgrBoundsGM : public skiagm::GM { |
| 228 public: | 212 public: |
| 229 FontMgrBoundsGM(double scale, double skew) | 213 FontMgrBoundsGM(double scale, double skew) |
| 230 : fScaleX(SkDoubleToScalar(scale)) | 214 : fScaleX(SkDoubleToScalar(scale)) |
| 231 , fSkewX(SkDoubleToScalar(skew)) | 215 , fSkewX(SkDoubleToScalar(skew)) |
| 232 { | 216 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 x = 0; | 276 x = 0; |
| 293 y += 160; | 277 y += 160; |
| 294 } | 278 } |
| 295 if (index >= 30) { | 279 if (index >= 30) { |
| 296 return; | 280 return; |
| 297 } | 281 } |
| 298 } | 282 } |
| 299 } | 283 } |
| 300 } | 284 } |
| 301 } | 285 } |
| 302 | 286 |
| 303 uint32_t onGetFlags() const SK_OVERRIDE { | |
| 304 // fontdescriptors (and therefore serialization) don't yet understand | |
| 305 // these new styles, so skip tests that exercise that for now. | |
| 306 | |
| 307 // If certain fonts are picked up (e.g. Microsoft Jhenghei 20MB for Regu
lar, 12MB for Bold), | |
| 308 // the resulting pdf can be ~700MB and crashes Chrome's PDF viewer. | |
| 309 | |
| 310 return kSkipPicture_Flag | kSkipPipe_Flag | kSkipPDF_Flag; | |
| 311 } | |
| 312 | |
| 313 private: | 287 private: |
| 314 SkAutoTUnref<SkFontMgr> fFM; | 288 SkAutoTUnref<SkFontMgr> fFM; |
| 315 SkString fName; | 289 SkString fName; |
| 316 SkScalar fScaleX, fSkewX; | 290 SkScalar fScaleX, fSkewX; |
| 317 typedef GM INHERITED; | 291 typedef GM INHERITED; |
| 318 }; | 292 }; |
| 319 | 293 |
| 320 ////////////////////////////////////////////////////////////////////////////// | 294 ////////////////////////////////////////////////////////////////////////////// |
| 321 | 295 |
| 322 DEF_GM( return SkNEW(FontMgrGM); ) | 296 DEF_GM( return SkNEW(FontMgrGM); ) |
| 323 DEF_GM( return SkNEW(FontMgrMatchGM); ) | 297 DEF_GM( return SkNEW(FontMgrMatchGM); ) |
| 324 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); ) | 298 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); ) |
| 325 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); ) | 299 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); ) |
| 326 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); ) | 300 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); ) |
| 327 | 301 |
| 328 #ifdef SK_BUILD_FOR_WIN | 302 #ifdef SK_BUILD_FOR_WIN |
| 329 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); ) | 303 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); ) |
| 330 #endif | 304 #endif |
| OLD | NEW |