//################################################################################################## // // Custom Visualization Core library // Copyright (C) 2011-2012 Ceetron AS // // This library is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This library is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at <> // for more details. // //################################################################################################## #pragma once #include "cvfObject.h" #include "cvfFont.h" #include "cvfGlyph.h" #include "cvfString.h" #include namespace cvf { class TextureImage; class Glyph; //================================================================================================== // // Fixed atlas font class used to generate glyphs for a given character // //================================================================================================== class FixedAtlasFont : public Font { public: enum FontSize { STANDARD, // 8pt LARGE // 16pt }; public: FixedAtlasFont(FontSize size); virtual ~FixedAtlasFont(); virtual const String& name() const; virtual ref getGlyph(wchar_t character); virtual uint advance(wchar_t character, wchar_t nextCharacter); virtual bool isEmpty(); private: // Load/unload font bool load(const char* name, size_t numGlyphs, const short* horizontalBearingsX, const short* horizontalBearingsY, const uint* horizontalAdvances, const uint* characterWidths, const uint* characterHeightss, const size_t textureImageWidth, const size_t textureImageHeight, const size_t numTextureImageDataBlockCount, const char** textureImageData); void unload(); private: String m_name; size_t m_numGlyphs; std::vector m_horizontalBearingsX; std::vector m_horizontalBearingsY; std::vector m_horizontalAdvances; std::vector m_characterWidths; std::vector m_characterHeights; ref m_textureImage; // Glyph cache typedef std::map > MapType; MapType m_atlasMap; }; } // namespace cvf