Merge branch 'master' of git://github.com/thepowersgang/acess2
[tpg/acess2.git] / Usermode / Applications / axwin4_src / Server / include / draw_text.hpp
1 /*
2  * Acess2 GUI v4
3  * - By John Hodge (thePowersGang)
4  *
5  * draw_text.hpp
6  * - Text drawing classes
7  */
8 #ifndef _DRAW_TEXT_HPP_
9 #define _DRAW_TEXT_HPP_
10
11 #include "IFontFace.hpp"
12
13 namespace AxWin {
14
15 class CFontFallback:
16         public IFontFace
17 {
18 public:
19         CFontFallback();
20
21         CRect Size(const ::std::string& text, unsigned int Size) const override;
22         void Render(CSurface& dest, const CRect& rect, const ::std::string& text, unsigned int Size) override;
23 private:
24         void renderAtRes(CSurface& dest, const CRect& rect, uint32_t cp, unsigned int Size, uint32_t FGC);
25         static uint8_t getValueAtPt(const uint8_t* char_ptr, unsigned int xf16, unsigned int yf16);
26         static uint8_t getValueAtRaw(const uint8_t* char_ptr, unsigned int x, unsigned int y);
27         unsigned int unicodeToCharmap(uint32_t cp) const;
28 };
29
30 #if FREETYPE_ENABLED
31 class CFontFT:
32         public IFontFace
33 {
34         FT_Face m_face;
35 public:
36         CFontFT(const char *Filename);
37         ~CFontFT();
38
39         CRect Size(const ::std::string& text, unsigned int Size) const override;
40         void Render(CSurface& dest, const CRect& rect, const ::std::string& text, unsigned int Size) override;
41 };
42 #endif  // FREETYPE_ENABLED
43
44 }
45
46 #endif
47

UCC git Repository :: git.ucc.asn.au