blob: ce39b2cf97df5d89b4bf5fee137d5d0e4880af18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkTypes.h"
#if defined(SK_BUILD_FOR_ANDROID)
#include "SkFontMgr.h"
#include "SkFontMgr_android.h"
// For test only.
static const char* gTestFontsXml = nullptr;
static const char* gTestFallbackFontsXml = nullptr;
static const char* gTestBasePath = nullptr;
void SkUseTestFontConfigFile(const char* fontsXml, const char* fallbackFontsXml,
const char* basePath)
{
gTestFontsXml = fontsXml;
gTestFallbackFontsXml = fallbackFontsXml;
gTestBasePath = basePath;
SkASSERT(gTestFontsXml);
SkASSERT(gTestFallbackFontsXml);
SkASSERT(gTestBasePath);
SkDEBUGF(("Test BasePath: %s Fonts: %s FallbackFonts: %s\n",
gTestBasePath, gTestFontsXml, gTestFallbackFontsXml));
}
SkFontMgr* SkFontMgr::Factory() {
// These globals exist so that Chromium can override the environment.
// TODO: these globals need to be removed, and Chromium use SkFontMgr_New_Android instead.
if ((gTestFontsXml || gTestFallbackFontsXml) && gTestBasePath) {
SkFontMgr_Android_CustomFonts custom = {
SkFontMgr_Android_CustomFonts::kOnlyCustom,
gTestBasePath,
gTestFontsXml,
gTestFallbackFontsXml,
false /* fIsolated */
};
return SkFontMgr_New_Android(&custom);
}
return SkFontMgr_New_Android(nullptr);
}
#endif//defined(SK_BUILD_FOR_ANDROID)
|