Choco OS  V.0.16.9.0
Join to the chocolate world
oc_font.h
Go to the documentation of this file.
1 
28 #ifndef SYSTEM_LIBRARIES_INC_OC_FONT_H_
29 #define SYSTEM_LIBRARIES_INC_OC_FONT_H_
30 
31 #include <oc_stdtypes.h>
32 #include <oc_1word.h>
33 #include <oc_null.h>
34 #include <stdbool.h>
35 #include <oc_stdlib.h>
36 #include <oc_pixel.h>
37 
38 typedef struct
39 {
40  const uint8_t WidthBits;
41  const uint16_t Offset;
43 
44 typedef struct
45 {
46  const uint8_t HeightPages;
47  const uint16_t StartChar;
48  const uint16_t EndChar;
49  const oC_Font_CharacterInfo_t* CharInfo;
50  const uint8_t* Data;
51  const char * FontName;
53 
54 typedef struct
55 {
56  uint8_t Width;
57  uint8_t Height;
58  const uint8_t* Data;
60 
61 typedef const oC_FontInfo_t * oC_Font_t;
62 
68 #define _________________________________________MACROS_SECTION_____________________________________________________________________________
69 
70 #define oC_Font_IsPrintableCharacter( Font , Ascii ) ( (Ascii) >= Font->StartChar && (Ascii) <= Font->EndChar )
71 
72 #undef _________________________________________MACROS_SECTION_____________________________________________________________________________
73 
74 
80 #define _________________________________________PREDEFINED_FONTS_SECTION___________________________________________________________________
81 
82 #define oC_Font_(FontName) &oC_1WORD_FROM_2(oC_FontInfo_ , FontName)
83 
84 extern const oC_FontInfo_t oC_FontInfo_Consolas;
85 
86 #undef _________________________________________PREDEFINED_FONTS_SECTION___________________________________________________________________
87 
93 #define _________________________________________STATIC_INLINE_SECTION______________________________________________________________________
94 
95 static inline bool oC_Font_ReadCharacterMap( oC_Font_t Font , uint16_t C , oC_Font_CharacterMap_t * outCharacterMap )
96 {
97  bool success = false;
98 
99  if(isaddresscorrect(Font) && isram(outCharacterMap) && oC_Font_IsPrintableCharacter(Font,C))
100  {
101  const oC_Font_CharacterInfo_t characterInfo = Font->CharInfo[C - Font->StartChar];
102 
103  outCharacterMap->Data = &Font->Data[characterInfo.Offset];
104  outCharacterMap->Height = Font->HeightPages;
105  outCharacterMap->Width = characterInfo.WidthBits;
106 
107  success = true;
108  }
109 
110  return success;
111 }
112 
113 #undef _________________________________________STATIC_INLINE_SECTION______________________________________________________________________
114 
115 
116 #endif /* SYSTEM_LIBRARIES_INC_OC_FONT_H_ */
Contains macros for creating one word from more words in macros.
The file with interface for the GPIO driver.
Definition of the null pointer.
FILE__DESCRIPTION