Flutter Engine
 
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 "txt/platform.h"
9
10#if defined(SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE)
11#include "third_party/skia/include/ports/SkFontMgr_empty.h"
12#endif
13
14namespace txt {
15
16std::vector<std::string> GetDefaultFontFamilies() {
17 return {"Roboto"};
18}
19
20sk_sp<SkFontMgr> GetDefaultFontManager(uint32_t font_initialization_data) {
21 if (font_initialization_data) {
22 fuchsia::fonts::ProviderSyncPtr sync_font_provider;
23 sync_font_provider.Bind(zx::channel(font_initialization_data));
24 return SkFontMgr_New_Fuchsia(std::move(sync_font_provider));
25 } else {
26#if 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
35} // namespace txt
std::vector< std::string > GetDefaultFontFamilies()
Definition platform.cc:13
sk_sp< SkFontMgr > GetDefaultFontManager(uint32_t font_initialization_data)
Definition platform.cc:17