Flutter Engine
 
Loading...
Searching...
No Matches
platform_android.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "txt/platform.h"
6
7#if defined(SK_FONTMGR_ANDROID_AVAILABLE)
8#include "third_party/skia/include/ports/SkFontMgr_android.h"
9#include "third_party/skia/include/ports/SkFontScanner_FreeType.h"
10#endif
11
12#if defined(SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE)
13#include "third_party/skia/include/ports/SkFontMgr_empty.h"
14#endif
15
16namespace txt {
17
18std::vector<std::string> GetDefaultFontFamilies() {
19 return {"sans-serif"};
20}
21
22sk_sp<SkFontMgr> GetDefaultFontManager(uint32_t font_initialization_data) {
23#if defined(SK_FONTMGR_ANDROID_AVAILABLE)
24 static sk_sp<SkFontMgr> mgr =
25 SkFontMgr_New_Android(nullptr, SkFontScanner_Make_FreeType());
26#elif defined(SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE)
27 static sk_sp<SkFontMgr> mgr = SkFontMgr_New_Custom_Empty();
28#else
29 static sk_sp<SkFontMgr> mgr = SkFontMgr::RefEmpty();
30#endif
31 return mgr;
32}
33
34} // namespace txt
std::vector< std::string > GetDefaultFontFamilies()
Definition platform.cc:13
sk_sp< SkFontMgr > GetDefaultFontManager(uint32_t font_initialization_data)
Definition platform.cc:17