Flutter Engine
 
Loading...
Searching...
No Matches
font_collection.h
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#ifndef FLUTTER_TXT_SRC_TXT_FONT_COLLECTION_H_
6#define FLUTTER_TXT_SRC_TXT_FONT_COLLECTION_H_
7
8#include <memory>
9#include <set>
10#include <string>
11#include <unordered_map>
12
13#include "flutter/fml/macros.h"
14#include "third_party/googletest/googletest/include/gtest/gtest_prod.h" // nogncheck
15#include "third_party/skia/include/core/SkFontMgr.h"
16#include "third_party/skia/include/core/SkRefCnt.h"
17#include "third_party/skia/modules/skparagraph/include/FontCollection.h" // nogncheck
19#include "txt/text_style.h"
20
21namespace txt {
22
23class FontCollection : public std::enable_shared_from_this<FontCollection> {
24 public:
26
28
29 size_t GetFontManagersCount() const;
30
31 void SetupDefaultFontManager(uint32_t font_initialization_data);
32 void SetDefaultFontManager(sk_sp<SkFontMgr> font_manager);
33 void SetAssetFontManager(sk_sp<SkFontMgr> font_manager);
34 void SetDynamicFontManager(sk_sp<SkFontMgr> font_manager);
35 void SetTestFontManager(sk_sp<SkFontMgr> font_manager);
36
37 // Do not provide alternative fonts that can match characters which are
38 // missing from the requested font family.
40
41 // Remove all entries in the font family cache.
43
44 // Construct a Skia text layout FontCollection based on this collection.
45 sk_sp<skia::textlayout::FontCollection> CreateSktFontCollection();
46
47 private:
48 sk_sp<SkFontMgr> default_font_manager_;
49 sk_sp<SkFontMgr> asset_font_manager_;
50 sk_sp<SkFontMgr> dynamic_font_manager_;
51 sk_sp<SkFontMgr> test_font_manager_;
52 bool enable_font_fallback_;
53
54 // An equivalent font collection usable by the Skia text shaper library.
55 sk_sp<skia::textlayout::FontCollection> skt_collection_;
56
57 std::vector<sk_sp<SkFontMgr>> GetFontManagerOrder() const;
58
60};
61
62} // namespace txt
63
64#endif // FLUTTER_TXT_SRC_TXT_FONT_COLLECTION_H_
void SetTestFontManager(sk_sp< SkFontMgr > font_manager)
size_t GetFontManagersCount() const
void SetupDefaultFontManager(uint32_t font_initialization_data)
void SetDynamicFontManager(sk_sp< SkFontMgr > font_manager)
void SetDefaultFontManager(sk_sp< SkFontMgr > font_manager)
sk_sp< skia::textlayout::FontCollection > CreateSktFontCollection()
void SetAssetFontManager(sk_sp< SkFontMgr > font_manager)
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27