* Font type, includes texture and charSet array data. * * The font will be unloaded on object destruction. Use raylib::FontUnmanaged if you're looking to not unload. * * @see raylib::FontUnmanaged */
| 12 | * @see raylib::FontUnmanaged |
| 13 | */ |
| 14 | class Font : public FontUnmanaged { |
| 15 | public: |
| 16 | using FontUnmanaged::FontUnmanaged; |
| 17 | |
| 18 | Font(const Font&) = delete; |
| 19 | Font& operator=(const Font&) = delete; |
| 20 | |
| 21 | Font(Font&& other) noexcept { |
| 22 | set(other); |
| 23 | other.baseSize = 0; |
| 24 | other.glyphCount = 0; |
| 25 | other.glyphPadding = 0; |
| 26 | other.texture = {}; |
| 27 | other.recs = nullptr; |
| 28 | other.glyphs = nullptr; |
| 29 | } |
| 30 | |
| 31 | Font& operator=(Font&& other) noexcept { |
| 32 | if (this == &other) { |
| 33 | return *this; |
| 34 | } |
| 35 | Unload(); |
| 36 | set(other); |
| 37 | other.baseSize = 0; |
| 38 | other.glyphCount = 0; |
| 39 | other.glyphPadding = 0; |
| 40 | other.texture = {}; |
| 41 | other.recs = nullptr; |
| 42 | other.glyphs = nullptr; |
| 43 | return *this; |
| 44 | } |
| 45 | |
| 46 | Font& operator=(const ::Font& font) { |
| 47 | Unload(); |
| 48 | set(font); |
| 49 | return *this; |
| 50 | } |
| 51 | |
| 52 | ~Font() { Unload(); } |
| 53 | |
| 54 | void Load(const std::string& fileName) { |
| 55 | Unload(); |
| 56 | FontUnmanaged::Load(fileName); |
| 57 | } |
| 58 | |
| 59 | void Load(const std::string& fileName, int fontSize, const int* codepoints = nullptr, int codepointCount = 0) { |
| 60 | Unload(); |
| 61 | FontUnmanaged::Load(fileName, fontSize, codepoints, codepointCount); |
| 62 | } |
| 63 | |
| 64 | void Load(const ::Image& image, ::Color key, int firstChar) { |
| 65 | Unload(); |
| 66 | FontUnmanaged::Load(image, key, firstChar); |
| 67 | } |
| 68 | |
| 69 | void Load( |
| 70 | const std::string& fileType, |
| 71 | const unsigned char* fileData, |