OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkFontMgr.h" | 8 #include "SkFontMgr.h" |
9 #include "SkFontMgr_android.h" | 9 #include "SkFontMgr_android.h" |
10 | 10 |
11 // For test only. | 11 // For test only. |
12 static const char* gTestFontsXml = NULL; | 12 static const char* gTestFontsXml = nullptr; |
13 static const char* gTestFallbackFontsXml = NULL; | 13 static const char* gTestFallbackFontsXml = nullptr; |
14 static const char* gTestBasePath = NULL; | 14 static const char* gTestBasePath = nullptr; |
15 | 15 |
16 void SkUseTestFontConfigFile(const char* fontsXml, const char* fallbackFontsXml, | 16 void SkUseTestFontConfigFile(const char* fontsXml, const char* fallbackFontsXml, |
17 const char* basePath) | 17 const char* basePath) |
18 { | 18 { |
19 gTestFontsXml = fontsXml; | 19 gTestFontsXml = fontsXml; |
20 gTestFallbackFontsXml = fallbackFontsXml; | 20 gTestFallbackFontsXml = fallbackFontsXml; |
21 gTestBasePath = basePath; | 21 gTestBasePath = basePath; |
22 SkASSERT(gTestFontsXml); | 22 SkASSERT(gTestFontsXml); |
23 SkASSERT(gTestFallbackFontsXml); | 23 SkASSERT(gTestFallbackFontsXml); |
24 SkASSERT(gTestBasePath); | 24 SkASSERT(gTestBasePath); |
25 SkDEBUGF(("Test BasePath: %s Fonts: %s FallbackFonts: %s\n", | 25 SkDEBUGF(("Test BasePath: %s Fonts: %s FallbackFonts: %s\n", |
26 gTestBasePath, gTestFontsXml, gTestFallbackFontsXml)); | 26 gTestBasePath, gTestFontsXml, gTestFallbackFontsXml)); |
27 } | 27 } |
28 | 28 |
29 SkFontMgr* SkFontMgr::Factory() { | 29 SkFontMgr* SkFontMgr::Factory() { |
30 // These globals exist so that Chromium can override the environment. | 30 // These globals exist so that Chromium can override the environment. |
31 // TODO: these globals need to be removed, and Chromium use SkFontMgr_New_An
droid instead. | 31 // TODO: these globals need to be removed, and Chromium use SkFontMgr_New_An
droid instead. |
32 if ((gTestFontsXml || gTestFallbackFontsXml) && gTestBasePath) { | 32 if ((gTestFontsXml || gTestFallbackFontsXml) && gTestBasePath) { |
33 SkFontMgr_Android_CustomFonts custom = { | 33 SkFontMgr_Android_CustomFonts custom = { |
34 SkFontMgr_Android_CustomFonts::kOnlyCustom, | 34 SkFontMgr_Android_CustomFonts::kOnlyCustom, |
35 gTestBasePath, | 35 gTestBasePath, |
36 gTestFontsXml, | 36 gTestFontsXml, |
37 gTestFallbackFontsXml | 37 gTestFallbackFontsXml |
38 }; | 38 }; |
39 return SkFontMgr_New_Android(&custom); | 39 return SkFontMgr_New_Android(&custom); |
40 } | 40 } |
41 | 41 |
42 return SkFontMgr_New_Android(NULL); | 42 return SkFontMgr_New_Android(nullptr); |
43 } | 43 } |
OLD | NEW |