Chronos 0.0
A advanced 2D rendering and animation system
Loading...
Searching...
No Matches
getFontType.cpp File Reference
#include "getFontType.hpp"
#include "fontTypes.hpp"
Include dependency graph for getFontType.cpp:

Go to the source code of this file.

Macros

#define FILL_FONT_STRUCT_NAME(type, size)    Chronos::Engine::FontStructs::type##_##size
 
#define FONT_CASE(size)
 

Macro Definition Documentation

◆ FILL_FONT_STRUCT_NAME

#define FILL_FONT_STRUCT_NAME (   type,
  size 
)     Chronos::Engine::FontStructs::type##_##size

Definition at line 26 of file getFontType.cpp.

29 : \
30 if (fontType == "arial") \
31 return FILL_FONT_STRUCT_NAME(arial, size); \
32 else if (fontType == "arial_bold") \
33 return FILL_FONT_STRUCT_NAME(arial_bold, size); \
34 else if (fontType == "consolas") \
35 return FILL_FONT_STRUCT_NAME(consolas, size); \
36 else if (fontType == "consolas_bold") \
37 return FILL_FONT_STRUCT_NAME(consolas_bold, size); \
38 else if (fontType == "courier") \
39 return FILL_FONT_STRUCT_NAME(courier, size); \
40 else if (fontType == "courier_bold") \
41 return FILL_FONT_STRUCT_NAME(courier_bold, size); \
42 else if (fontType == "times") \
43 return FILL_FONT_STRUCT_NAME(times, size); \
44 else if (fontType == "times_bold") \
45 return FILL_FONT_STRUCT_NAME(times_bold, size); \
46 else \
47 throw std::runtime_error("Font type not found"); \
48 break;
49
51 std::string fontType, int fontSize)
52{
53 switch (fontSize) {
54 FONT_CASE(6)
55 FONT_CASE(7)
56 FONT_CASE(8)
57 FONT_CASE(9)
58 FONT_CASE(10)
59 FONT_CASE(11)
60 FONT_CASE(12)
61 FONT_CASE(13)
62 FONT_CASE(14)
63 FONT_CASE(15)
64 FONT_CASE(16)
65 FONT_CASE(17)
66 FONT_CASE(18)
67 FONT_CASE(19)
68 FONT_CASE(20)
69 FONT_CASE(21)
70 FONT_CASE(22)
71 FONT_CASE(23)
72 FONT_CASE(24)
73 FONT_CASE(25)
74 FONT_CASE(26)
75 FONT_CASE(27)
76 FONT_CASE(28)
77 FONT_CASE(29)
78 FONT_CASE(30)
79 FONT_CASE(31)
80 FONT_CASE(32)
81 FONT_CASE(33)
82 FONT_CASE(34)
83 FONT_CASE(35)
84 FONT_CASE(36)
85 FONT_CASE(37)
86 FONT_CASE(38)
87 FONT_CASE(39)
88 FONT_CASE(40)
89 FONT_CASE(41)
90 FONT_CASE(42)
91 FONT_CASE(43)
92 FONT_CASE(44)
93 FONT_CASE(45)
94 FONT_CASE(46)
95 FONT_CASE(47)
96 FONT_CASE(48)
97 FONT_CASE(49)
98 FONT_CASE(50)
99 default:
100 throw std::runtime_error("Font size not found");
101 }
102}
#define FONT_CASE(size)
#define FILL_FONT_STRUCT_NAME(type, size)
Chronos::Engine::FontTypes getFontType(std::string fontType, int fontSize)
The parameters needed for the font style.
Definition text.hpp:58

◆ FONT_CASE

#define FONT_CASE (   size)
Value:
case size: \
if (fontType == "arial") \
return FILL_FONT_STRUCT_NAME(arial, size); \
else if (fontType == "arial_bold") \
return FILL_FONT_STRUCT_NAME(arial_bold, size); \
else if (fontType == "consolas") \
return FILL_FONT_STRUCT_NAME(consolas, size); \
else if (fontType == "consolas_bold") \
return FILL_FONT_STRUCT_NAME(consolas_bold, size); \
else if (fontType == "courier") \
return FILL_FONT_STRUCT_NAME(courier, size); \
else if (fontType == "courier_bold") \
return FILL_FONT_STRUCT_NAME(courier_bold, size); \
else if (fontType == "times") \
return FILL_FONT_STRUCT_NAME(times, size); \
else if (fontType == "times_bold") \
return FILL_FONT_STRUCT_NAME(times_bold, size); \
else \
throw std::runtime_error("Font type not found"); \
break;

Definition at line 29 of file getFontType.cpp.

30 : \
31 if (fontType == "arial") \
32 return FILL_FONT_STRUCT_NAME(arial, size); \
33 else if (fontType == "arial_bold") \
34 return FILL_FONT_STRUCT_NAME(arial_bold, size); \
35 else if (fontType == "consolas") \
36 return FILL_FONT_STRUCT_NAME(consolas, size); \
37 else if (fontType == "consolas_bold") \
38 return FILL_FONT_STRUCT_NAME(consolas_bold, size); \
39 else if (fontType == "courier") \
40 return FILL_FONT_STRUCT_NAME(courier, size); \
41 else if (fontType == "courier_bold") \
42 return FILL_FONT_STRUCT_NAME(courier_bold, size); \
43 else if (fontType == "times") \
44 return FILL_FONT_STRUCT_NAME(times, size); \
45 else if (fontType == "times_bold") \
46 return FILL_FONT_STRUCT_NAME(times_bold, size); \
47 else \
48 throw std::runtime_error("Font type not found"); \
49 break;