1 | /** |
2 | * Copyright (c) 2006-2023 LOVE Development Team |
3 | * |
4 | * This software is provided 'as-is', without any express or implied |
5 | * warranty. In no event will the authors be held liable for any damages |
6 | * arising from the use of this software. |
7 | * |
8 | * Permission is granted to anyone to use this software for any purpose, |
9 | * including commercial applications, and to alter it and redistribute it |
10 | * freely, subject to the following restrictions: |
11 | * |
12 | * 1. The origin of this software must not be misrepresented; you must not |
13 | * claim that you wrote the original software. If you use this software |
14 | * in a product, an acknowledgment in the product documentation would be |
15 | * appreciated but is not required. |
16 | * 2. Altered source versions must be plainly marked as such, and must not be |
17 | * misrepresented as being the original software. |
18 | * 3. This notice may not be removed or altered from any source distribution. |
19 | **/ |
20 | |
21 | #ifndef LOVE_FONT_FONT_H |
22 | #define LOVE_FONT_FONT_H |
23 | |
24 | // LOVE |
25 | #include "Rasterizer.h" |
26 | #include "TrueTypeRasterizer.h" |
27 | #include "image/ImageData.h" |
28 | #include "filesystem/FileData.h" |
29 | #include "common/Module.h" |
30 | #include "common/int.h" |
31 | |
32 | // C++ |
33 | #include <string> |
34 | #include <vector> |
35 | |
36 | namespace love |
37 | { |
38 | namespace font |
39 | { |
40 | |
41 | class Font : public Module |
42 | { |
43 | |
44 | public: |
45 | |
46 | virtual ~Font() {} |
47 | |
48 | virtual Rasterizer *newRasterizer(love::filesystem::FileData *data) = 0; |
49 | |
50 | virtual Rasterizer *newTrueTypeRasterizer(int size, TrueTypeRasterizer::Hinting hinting); |
51 | virtual Rasterizer *newTrueTypeRasterizer(int size, float dpiscale, TrueTypeRasterizer::Hinting hinting); |
52 | virtual Rasterizer *newTrueTypeRasterizer(love::Data *data, int size, TrueTypeRasterizer::Hinting hinting) = 0; |
53 | virtual Rasterizer *newTrueTypeRasterizer(love::Data *data, int size, float dpiscale, TrueTypeRasterizer::Hinting hinting) = 0; |
54 | |
55 | virtual Rasterizer *newBMFontRasterizer(love::filesystem::FileData *fontdef, const std::vector<image::ImageData *> &images, float dpiscale); |
56 | |
57 | virtual Rasterizer *newImageRasterizer(love::image::ImageData *data, const std::string &glyphs, int , float dpiscale); |
58 | virtual Rasterizer *newImageRasterizer(love::image::ImageData *data, uint32 *glyphs, int length, int , float dpiscale); |
59 | |
60 | virtual GlyphData *newGlyphData(Rasterizer *r, const std::string &glyph); |
61 | virtual GlyphData *newGlyphData(Rasterizer *r, uint32 glyph); |
62 | |
63 | // Implement Module. |
64 | virtual ModuleType getModuleType() const { return M_FONT; } |
65 | virtual const char *getName() const = 0; |
66 | |
67 | }; // Font |
68 | |
69 | } // font |
70 | } // love |
71 | |
72 | #endif // LOVE_FONT_FONT_H |
73 | |