/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* FontLibrary.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/18 09:26:03 by maldavid #+# #+# */ /* Updated: 2024/03/28 22:21:53 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef __MLX_FONT_LIBRARY__ #define __MLX_FONT_LIBRARY__ #include #include #include namespace mlx { using FontID = std::uint32_t; constexpr FontID nullfont = 0; class FontLibrary : public Singleton { friend class Singleton; public: std::shared_ptr GetFontData(FontID id); FontID AddFontToLibrary(std::shared_ptr font); void RemoveFontFromLibrary(FontID id); void ClearLibrary(); private: FontLibrary() = default; ~FontLibrary() = default; private: std::unordered_map> m_cache; std::vector m_invalid_ids; FontID m_current_id = 1; }; } #endif