OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/app/blink_test_platform_support.h" | 5 #include "content/shell/app/blink_test_platform_support.h" |
6 | 6 |
| 7 #include "skia/ext/fontmgr_default_android.h" |
7 #include "third_party/skia/include/ports/SkFontMgr_android.h" | 8 #include "third_party/skia/include/ports/SkFontMgr_android.h" |
8 | 9 |
9 namespace { | 10 namespace { |
10 | 11 |
11 // The root directory on the device to which resources will be pushed. This | 12 // The root directory on the device to which resources will be pushed. This |
12 // value needs to be equal to that set in chromium_android.py. | 13 // value needs to be equal to that set in chromium_android.py. |
13 #define DEVICE_SOURCE_ROOT_DIR "/data/local/tmp/content_shell/" | 14 #define DEVICE_SOURCE_ROOT_DIR "/data/local/tmp/content_shell/" |
14 | 15 |
15 // Primary font configuration file on the device for Skia. | 16 // Primary font configuration file on the device for Skia. |
16 const char kPrimaryFontConfig[] = | 17 const char kPrimaryFontConfig[] = |
17 DEVICE_SOURCE_ROOT_DIR "android_main_fonts.xml"; | 18 DEVICE_SOURCE_ROOT_DIR "android_main_fonts.xml"; |
18 | 19 |
19 // The file on the device containing the fallback font configuration for Skia. | 20 // The file on the device containing the fallback font configuration for Skia. |
20 const char kFallbackFontConfig[] = | 21 const char kFallbackFontConfig[] = |
21 DEVICE_SOURCE_ROOT_DIR "android_fallback_fonts.xml"; | 22 DEVICE_SOURCE_ROOT_DIR "android_fallback_fonts.xml"; |
22 | 23 |
23 // The directory in which fonts will be stored on the Android device. | 24 // The directory in which fonts will be stored on the Android device. |
24 const char kFontDirectory[] = DEVICE_SOURCE_ROOT_DIR "fonts/"; | 25 const char kFontDirectory[] = DEVICE_SOURCE_ROOT_DIR "fonts/"; |
25 | 26 |
26 } // namespace | 27 } // namespace |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 | 30 |
30 bool CheckLayoutSystemDeps() { | 31 bool CheckLayoutSystemDeps() { |
31 return true; | 32 return true; |
32 } | 33 } |
33 | 34 |
34 bool BlinkTestPlatformInitialize() { | 35 bool BlinkTestPlatformInitialize() { |
35 // Initialize Skia with the font configuration files crafted for layout tests. | 36 // Initialize Skia with the font configuration files crafted for layout tests. |
36 SkUseTestFontConfigFile( | 37 SkFontMgr_Android_CustomFonts custom; |
37 kPrimaryFontConfig, kFallbackFontConfig, kFontDirectory); | 38 custom.fSystemFontUse = SkFontMgr_Android_CustomFonts::kOnlyCustom; |
| 39 custom.fBasePath = kFontDirectory; |
| 40 custom.fFontsXml = kPrimaryFontConfig; |
| 41 custom.fFallbackFontsXml = kFallbackFontConfig; |
| 42 custom.fIsolated = false; |
38 | 43 |
| 44 SetDefaultSkiaFactory(SkFontMgr_New_Android(&custom)); |
39 return true; | 45 return true; |
40 } | 46 } |
41 | 47 |
42 } // namespace content | 48 } // namespace content |
OLD | NEW |