OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkFontMgr.h" |
| 9 #include "SkFontMgr_android.h" |
| 10 |
| 11 // For test only. |
| 12 static const char* gTestFontsXml = NULL; |
| 13 static const char* gTestFallbackFontsXml = NULL; |
| 14 static const char* gTestBasePath = NULL; |
| 15 |
| 16 void SkUseTestFontConfigFile(const char* fontsXml, const char* fallbackFontsXml, |
| 17 const char* basePath) |
| 18 { |
| 19 gTestFontsXml = fontsXml; |
| 20 gTestFallbackFontsXml = fallbackFontsXml; |
| 21 gTestBasePath = basePath; |
| 22 SkASSERT(gTestFontsXml); |
| 23 SkASSERT(gTestFallbackFontsXml); |
| 24 SkASSERT(gTestBasePath); |
| 25 SkDEBUGF(("Test BasePath: %s Fonts: %s FallbackFonts: %s\n", |
| 26 gTestBasePath, gTestFontsXml, gTestFallbackFontsXml)); |
| 27 } |
| 28 |
| 29 SkFontMgr* SkFontMgr::Factory() { |
| 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. |
| 32 if ((gTestFontsXml || gTestFallbackFontsXml) && gTestBasePath) { |
| 33 SkFontMgr_Android_CustomFonts custom = { |
| 34 SkFontMgr_Android_CustomFonts::kOnlyCustom, |
| 35 gTestBasePath, |
| 36 gTestFontsXml, |
| 37 gTestFallbackFontsXml |
| 38 }; |
| 39 return SkFontMgr_New_Android(&custom); |
| 40 } |
| 41 |
| 42 return SkFontMgr_New_Android(NULL); |
| 43 } |
OLD | NEW |