52 constexpr Descriptor(std::string name, std::filesystem::path fontPath, std::vector<CharsetRange> charsetRanges,
const float minimalScale = 48.0f,
const float miterLimit = 1.0f)
58 m_RuntimeID(s_NextRuntimeID.fetch_add(1, std::memory_order_relaxed))
63 [[nodiscard]] uint32_t
GetRuntimeID()
const {
return m_RuntimeID; }
66 return m_RuntimeID == other.m_RuntimeID;
71 return std::hash<uint32_t>{}(descriptor.m_RuntimeID);
82 const uint32_t m_RuntimeID{ 0 };
83 inline static std::atomic<uint32_t> s_NextRuntimeID{ 1 };
94 [[nodiscard]]
static std::shared_ptr<Font>
Create(
const std::filesystem::path& path,
const std::vector<CharsetRange>& charsets,
const float minimalScale = 48.0f,
const float miterLimit = 1.0f);
104 [[nodiscard]]
static std::shared_ptr<Font>
Create(
const Descriptor& descriptor);
108 void Load(
void* font,
const std::vector<CharsetRange>& charsets,
const std::filesystem::path& fontPath,
const float minimalScale,
const float miterLimit);
Used when you want to manually control the asset lifetime, loading, preloading, unloading.
Font Descriptor meant to be used with AssetManager only.
const std::vector< CharsetRange > m_CharsetRanges
constexpr Descriptor(std::string name, std::filesystem::path fontPath, std::vector< CharsetRange > charsetRanges, const float minimalScale=48.0f, const float miterLimit=1.0f)
Constructs a descriptor.
const float m_MinimalScale
uint32_t GetRuntimeID() const
const std::filesystem::path m_FontPath
constexpr bool operator==(const Descriptor &other) const
AssetStatus GetStatus() const
static std::shared_ptr< Font > Create(const std::filesystem::path &path, const std::vector< CharsetRange > &charsets, const float minimalScale=48.0f, const float miterLimit=1.0f)
Creates a Font object.
For InstanceMetrics to work with a type it should derive from this.
Almost everything connected to graphics is in this namespace.
These are predefined UTF-32 charset ranges to be used when creating a Font.
static constexpr CharsetRange CyrillicExtendedB
static constexpr CharsetRange Cyrillic
static constexpr CharsetRange Latin
static constexpr CharsetRange LatinExtendedA
static constexpr CharsetRange LatinExtendedB
static constexpr CharsetRange CyrillicExtendedA
std::size_t operator()(const Descriptor &descriptor) const