1 // SHE library 2 // Copyright (C) 2012-2017 David Capello 3 // 4 // This file is released under the terms of the MIT license. 5 // Read LICENSE.txt for more information. 6 7 #ifndef SHE_FONT_H_INCLUDED 8 #define SHE_FONT_H_INCLUDED 9 #pragma once 10 11 #include <string> 12 13 namespace she { 14 15 enum class FontType { 16 kUnknown, 17 kSpriteSheet, 18 kTrueType, 19 }; 20 21 class Font { 22 public: Font()23 Font() : m_fallback(nullptr) { } ~Font()24 virtual ~Font() { } 25 virtual void dispose() = 0; 26 virtual FontType type() = 0; 27 virtual int height() const = 0; 28 virtual int textLength(const std::string& str) const = 0; 29 virtual bool isScalable() const = 0; 30 virtual void setSize(int size) = 0; 31 virtual void setAntialias(bool antialias) = 0; 32 virtual bool hasCodePoint(int codepoint) const = 0; 33 fallback()34 she::Font* fallback() const { 35 return m_fallback; 36 } setFallback(she::Font * font)37 void setFallback(she::Font* font) { 38 m_fallback = font; 39 } 40 41 private: 42 she::Font* m_fallback; 43 }; 44 45 } // namespace she 46 47 #endif 48