#pragma once #include "AftrOpenGLIncludes.h" #include #include namespace Aftr { class AftrFrameBufferObject; struct pimpl_freetype_hider; struct CharcodeData { GLuint textureHandle; size_t charWidth; size_t charHeight; size_t charAdvance; int charTop; }; class FontDataShared { public: FontDataShared( std::string& fontPath, size_t fontSize ); virtual ~FontDataShared(); bool operator <( const FontDataShared& tex ) const; void init(); size_t getFontSize() { return fontSize; } std::string getFontPath() { return fontPath; } size_t maxWidth = 0; size_t maxHeight = 0; #ifdef AFTR_CONFIG_USE_FREE_TYPE CharcodeData& getCharcodeData( unsigned char x );///< returns the CharcodeData for a given character from the map if it exists; if not, it loads it #endif //bool isCached( const std::string& str ); //void cacheString( const std::string& str, AftrFrameBufferObject* fbo );///< returns true if item is in cache, false otherwise //std::map< std::string, AftrFrameBufferObject* > cache; protected: std::string fontPath; size_t fontSize; //pimpl wrapper to avoid including FreeType headers in this header file. std::unique_ptr< pimpl_freetype_hider > ft_data; }; }