Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
platform_fuchsia.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 <lib/zx/channel.h>
6
7#include "third_party/skia/include/ports/SkFontMgr_fuchsia.h"
8#include "third_party/skia/include/ports/SkFontScanner_FreeType.h"
9#include "txt/platform.h"
10
11#if defined(SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE)
12#include "third_party/skia/include/ports/SkFontMgr_empty.h"
13#endif
14
15namespace txt {
16
17std::vector<std::string> GetDefaultFontFamilies() {
18 return {"Roboto"};
19}
20
21sk_sp<SkFontMgr> GetDefaultFontManager(uint32_t font_initialization_data) {
22 if (font_initialization_data) {
23 fuchsia::fonts::ProviderSyncPtr sync_font_provider;
24 sync_font_provider.Bind(zx::channel(font_initialization_data));
25 return SkFontMgr_New_Fuchsia(std::move(sync_font_provider),
26 SkFontScanner_Make_FreeType());
27 } else {
28#if defined(SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE)
29 static sk_sp<SkFontMgr> mgr = SkFontMgr_New_Custom_Empty();
30#else
31 static sk_sp<SkFontMgr> mgr = SkFontMgr::RefEmpty();
32#endif
33 return mgr;
34 }
35}
36
37} // namespace txt
std::vector< std::string > GetDefaultFontFamilies()
Definition platform.cc:13
sk_sp< SkFontMgr > GetDefaultFontManager(uint32_t font_initialization_data)
Definition platform.cc:17