Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
platform_linux.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_FONTCONFIG_AVAILABLE)
8#include "third_party/skia/include/ports/SkFontMgr_fontconfig.h"
9#include "third_party/skia/include/ports/SkFontScanner_FreeType.h"
10#endif
11
12#if defined(SK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE)
13#include "include/ports/SkFontMgr_directory.h"
14#endif
15
16#if defined(SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE)
17#include "third_party/skia/include/ports/SkFontMgr_empty.h"
18#endif
19
20namespace txt {
21
22std::vector<std::string> GetDefaultFontFamilies() {
23 return {"Ubuntu", "Adwaita Sans", "Cantarell",
24 "DejaVu Sans", "Liberation Sans", "Arial"};
25}
26
27sk_sp<SkFontMgr> GetDefaultFontManager(uint32_t font_initialization_data) {
28#if defined(SK_FONTMGR_FONTCONFIG_AVAILABLE)
29 static sk_sp<SkFontMgr> mgr =
30 SkFontMgr_New_FontConfig(nullptr, SkFontScanner_Make_FreeType());
31#elif defined(SK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE)
32 static sk_sp<SkFontMgr> mgr =
33 SkFontMgr_New_Custom_Directory("/usr/share/fonts/");
34#elif defined(SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE)
35 static sk_sp<SkFontMgr> mgr = SkFontMgr_New_Custom_Empty();
36#else
37 static sk_sp<SkFontMgr> mgr = SkFontMgr::RefEmpty();
38#endif
39 return mgr;
40}
41
42} // namespace txt
std::vector< std::string > GetDefaultFontFamilies()
Definition platform.cc:13
sk_sp< SkFontMgr > GetDefaultFontManager(uint32_t font_initialization_data)
Definition platform.cc:17