| 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_LIB_UI_TEXT_FONT_COLLECTION_H_ |
| 6 | #define FLUTTER_LIB_UI_TEXT_FONT_COLLECTION_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | #include <vector> |
| 10 | |
| 11 | #include "flutter/assets/asset_manager.h" |
| 12 | #include "flutter/fml/macros.h" |
| 13 | #include "flutter/fml/memory/ref_ptr.h" |
| 14 | #include "third_party/tonic/typed_data/typed_list.h" |
| 15 | #include "txt/font_collection.h" |
| 16 | |
| 17 | namespace flutter { |
| 18 | |
| 19 | class FontCollection { |
| 20 | public: |
| 21 | FontCollection(); |
| 22 | |
| 23 | ~FontCollection(); |
| 24 | |
| 25 | std::shared_ptr<txt::FontCollection> GetFontCollection() const; |
| 26 | |
| 27 | void SetupDefaultFontManager(uint32_t font_initialization_data); |
| 28 | |
| 29 | void RegisterFonts(const std::shared_ptr<AssetManager>& asset_manager); |
| 30 | |
| 31 | void RegisterTestFonts(); |
| 32 | |
| 33 | static void LoadFontFromList(Dart_Handle font_data_handle, |
| 34 | Dart_Handle callback, |
| 35 | const std::string& family_name); |
| 36 | |
| 37 | private: |
| 38 | std::shared_ptr<txt::FontCollection> collection_; |
| 39 | sk_sp<txt::DynamicFontManager> dynamic_font_manager_; |
| 40 | |
| 41 | FML_DISALLOW_COPY_AND_ASSIGN(FontCollection); |
| 42 | }; |
| 43 | |
| 44 | } // namespace flutter |
| 45 | |
| 46 | #endif // FLUTTER_LIB_UI_TEXT_FONT_COLLECTION_H_ |
| 47 |
