Flutter Impeller
typography_context.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 
6 
7 #include <mutex>
8 
9 #include "flutter/fml/icu_util.h"
10 #include "impeller/toolkit/interop/embedded_icu_data.h"
11 
12 namespace impeller::interop {
13 
15  : collection_(std::make_shared<txt::FontCollection>()) {
16  static std::once_flag sICUInitOnceFlag;
17  std::call_once(sICUInitOnceFlag, []() {
18  auto icu_data = std::make_unique<fml::NonOwnedMapping>(
19  impeller_embedded_icu_data_data, impeller_embedded_icu_data_length);
20  fml::icu::InitializeICUFromMapping(std::move(icu_data));
21  });
22  collection_->SetupDefaultFontManager(0u);
23 }
24 
26 
28  return !!collection_;
29 }
30 
31 const std::shared_ptr<txt::FontCollection>&
33  return collection_;
34 }
35 
36 } // namespace impeller::interop
impeller::interop::TypographyContext::~TypographyContext
~TypographyContext() override
impeller::interop::TypographyContext::IsValid
bool IsValid() const
Definition: typography_context.cc:27
impeller::interop
Definition: color_filter.cc:7
typography_context.h
std
Definition: comparable.h:95
impeller::interop::TypographyContext::TypographyContext
TypographyContext()
Definition: typography_context.cc:14
impeller::interop::TypographyContext::GetFontCollection
const std::shared_ptr< txt::FontCollection > & GetFontCollection() const
Definition: typography_context.cc:32