| 1 | // Aseprite |
| 2 | // Copyright (C) 2020 Igara Studio S.A. |
| 3 | // Copyright (C) 2017 David Capello |
| 4 | // |
| 5 | // This program is distributed under the terms of |
| 6 | // the End-User License Agreement for Aseprite. |
| 7 | |
| 8 | #ifndef APP_UI_SKIN_FONT_DATA_H_INCLUDED |
| 9 | #define APP_UI_SKIN_FONT_DATA_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "base/disable_copying.h" |
| 13 | #include "os/font.h" |
| 14 | |
| 15 | #include <map> |
| 16 | |
| 17 | namespace app { |
| 18 | namespace skin { |
| 19 | |
| 20 | class FontData { |
| 21 | public: |
| 22 | FontData(os::FontType type); |
| 23 | |
| 24 | void setFilename(const std::string& filename) { m_filename = filename; } |
| 25 | void setAntialias(bool antialias) { m_antialias = antialias; } |
| 26 | void setFallback(FontData* fallback, int fallbackSize) { |
| 27 | m_fallback = fallback; |
| 28 | m_fallbackSize = fallbackSize; |
| 29 | } |
| 30 | |
| 31 | os::FontRef getFont(int size); |
| 32 | |
| 33 | private: |
| 34 | os::FontType m_type; |
| 35 | std::string m_filename; |
| 36 | bool m_antialias; |
| 37 | std::map<int, os::FontRef> m_fonts; // key=font size, value=real font |
| 38 | FontData* m_fallback; |
| 39 | int m_fallbackSize; |
| 40 | |
| 41 | DISABLE_COPYING(FontData); |
| 42 | }; |
| 43 | |
| 44 | } // namespace skin |
| 45 | } // namespace app |
| 46 | |
| 47 | #endif |
| 48 | |