Files
Renderive/Core/render/Font_Face.h
T
2026-08-01 20:09:45 +08:00

45 lines
1.0 KiB
C++

#pragma once
#include <cstddef>
#include <filesystem>
#include <memory>
#include <span>
#include <string>
namespace renderive {
class Font_Face {
public:
Font_Face();
~Font_Face();
Font_Face(const Font_Face&) = delete;
Font_Face(Font_Face&&) noexcept;
Font_Face& operator=(const Font_Face&) = delete;
Font_Face& operator=(Font_Face&&) noexcept;
[[nodiscard]] bool valid() const;
[[nodiscard]] std::string family_name() const;
private:
struct Impl;
std::unique_ptr<Impl> impl_;
friend class Font_Registry;
friend class Canvas;
};
class Font_Registry {
public:
Font_Registry();
~Font_Registry();
std::shared_ptr<Font_Face> load_file(const std::filesystem::path& path);
std::shared_ptr<Font_Face> load_memory(std::span<const std::byte> data);
void set_default_face(std::shared_ptr<Font_Face> face);
[[nodiscard]] std::shared_ptr<Font_Face> default_face() const;
private:
struct Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace renderive