/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* font_library.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/18 09:26:03 by maldavid #+# #+# */ /* Updated: 2024/03/25 19:08:18 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> _cache; std::vector _invalid_ids; FontID _current_id = 1; }; } #endif