mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef FLUTTER_LIB_UI_TEXT_FONT_COLLECTION_H_
|
|
#define FLUTTER_LIB_UI_TEXT_FONT_COLLECTION_H_
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "flutter/assets/asset_manager.h"
|
|
#include "flutter/fml/macros.h"
|
|
#include "flutter/fml/memory/ref_ptr.h"
|
|
#include "txt/font_collection.h"
|
|
|
|
namespace tonic {
|
|
class DartLibraryNatives;
|
|
} // namespace tonic
|
|
|
|
namespace flutter {
|
|
|
|
class FontCollection {
|
|
public:
|
|
FontCollection();
|
|
|
|
~FontCollection();
|
|
|
|
static void RegisterNatives(tonic::DartLibraryNatives* natives);
|
|
|
|
std::shared_ptr<txt::FontCollection> GetFontCollection() const;
|
|
|
|
void SetupDefaultFontManager();
|
|
|
|
void RegisterFonts(std::shared_ptr<AssetManager> asset_manager);
|
|
|
|
void RegisterTestFonts();
|
|
|
|
void LoadFontFromList(const uint8_t* font_data,
|
|
int length,
|
|
std::string family_name);
|
|
|
|
private:
|
|
std::shared_ptr<txt::FontCollection> collection_;
|
|
sk_sp<txt::DynamicFontManager> dynamic_font_manager_;
|
|
|
|
FML_DISALLOW_COPY_AND_ASSIGN(FontCollection);
|
|
};
|
|
|
|
} // namespace flutter
|
|
|
|
#endif // FLUTTER_LIB_UI_TEXT_FONT_COLLECTION_H_
|