XenevaOS
Loading...
Searching...
No Matches
font.h
Go to the documentation of this file.
1
30#ifndef __FONT_H__
31#define __FONT_H__
32
33#include <stdint.h>
34#include <sys\_keftmngr.h>
35#include <freetype\ftglyph.h>
36#include <_xeneva.h>
37#include "chitralekha.h"
38#include "draw.h"
39#include <ft2build.h>
40#include FT_FREETYPE_H
41
42#ifdef __cplusplus
44#endif
45
46 /* pre-defined system fonts */
47#define ROBOTO_LIGHT "Roboto-Light"
48#define ROBOTO_LIGHT_ITALIC "Roboto-Light-Italic"
49#define ROBOTO_THIN "Roboto-Thin"
50#define CORBEL "Corbel"
51#define CALIBRI "Calibri"
52#define FORTE "Forte"
53#define CONSOLAS "Consolas"
54
55#ifdef ARCH_ARM64
56#define XENEVA_DEFAULT_FONT FORTE
57#else
58 /* default font for xeneva */
59#define XENEVA_DEFAULT_FONT CALIBRI
60#endif
61
76
77
78
79 /*
80 * ChInitialiseFont -- initialise a font by a name
81 * @param fontname -- name of the font
82 */
83 XE_LIB ChFont *ChInitialiseFont(char* fontname);
84
85 /*
86 * ChFontSetSize -- set a font size
87 * @param font -- Pointer to font
88 * @param size -- size of the font
89 */
90 XE_LIB void ChFontSetSize(ChFont* font, int size);
91
92 /*
93 * ChFontDrawText -- draws a text using desired font
94 * @param canv -- Pointer to canvas
95 * @param font -- Pointer to font
96 * @param string -- string to draw
97 * @param penx -- x coordinate
98 * @param peny -- y coordinate
99 * @param sz -- font size
100 * @param color -- color of the font
101 */
102 XE_LIB void ChFontDrawText(ChCanvas *canv, ChFont* font, char* string, int penx, int peny, uint32_t sz, uint32_t color);
103
104 /*
105 * ChFontDrawCharClipped -- draws a character using desired font
106 * @param canv -- Pointer to canvas
107 * @param font -- Pointer to font
108 * @param string -- string to draw
109 * @param penx -- x coordinate
110 * @param peny -- y coordinate
111 * @param sz -- font size
112 * @param color -- color of the font
113 * @param limit -- clippings
114 */
115 void ChFontDrawCharClipped(ChCanvas* canv, ChFont* font, char c, int penx, int peny, uint32_t color, ChRect* limit);
116
117 /*
118 * ChFontDrawChar -- draws a character using desired font
119 * @param canv -- Pointer to canvas
120 * @param font -- Pointer to font
121 * @param string -- string to draw
122 * @param penx -- x coordinate
123 * @param peny -- y coordinate
124 * @param sz -- font size
125 * @param color -- color of the font
126 */
127 XE_LIB void ChFontDrawChar(ChCanvas *canv, ChFont* font, char c, int penx, int peny, uint32_t sz, uint32_t color);
128
129 /*
130 * ChFontDrawTextClipped -- draws text using specific font within
131 * a clipped boundary
132 * @param canv -- Pointer to Canvas
133 * @param font -- Pointer to font to use
134 * @param string -- string to draw
135 * @param penx -- x position
136 * @param peny -- y position
137 * @param color -- color to use
138 * @param limit -- boundary of the rectangle
139 */
140 XE_LIB int ChFontDrawTextClipped(ChCanvas *canv, ChFont* font, char* string, int penx, int peny, uint32_t color, ChRect* limit);
141
142 /*
143 * ChFontGetWidth -- return the total width of font in
144 * pixel size
145 * @param font -- Pointer to font
146 * @param string -- total string
147 */
148 XE_LIB int64_t ChFontGetWidth(ChFont* font, char* string);
149
150 /*
151 * ChFontGetWidthChar -- return the total width of font in
152 * pixel size of one character
153 * @param font -- Pointer to font
154 * @param c -- character
155 */
157
158 /*
159 * ChFontGetHeight -- return the total height of font
160 * in pixel size
161 * @param font -- Pointer to font
162 * @param string -- total string
163 */
164 XE_LIB int64_t ChFontGetHeight(ChFont* font, char* string);
165
166 /*
167 * ChFontGetHeightChar -- return the total width of font in
168 * pixel size of one character
169 * @param font -- Pointer to font
170 * @param c -- character
171 */
173
174 /*
175 * ChFontClose -- closes an opened font
176 * @param font -- Pointer to font
177 */
178 XE_LIB int ChFontClose(ChFont* font);
179
180#ifdef __cplusplus
181}
182#endif
183
184#endif
XE_LIB int ChFontDrawTextClipped(ChCanvas *canv, ChFont *font, char *string, int penx, int peny, uint32_t color, ChRect *limit)
Definition font.cpp:440
XE_LIB int64_t ChFontGetHeightChar(ChFont *font, char c)
Definition font.cpp:404
void ChFontDrawCharClipped(ChCanvas *canv, ChFont *font, char c, int penx, int peny, uint32_t color, ChRect *limit)
Definition font.cpp:220
XE_LIB int64_t ChFontGetHeight(ChFont *font, char *string)
Definition font.cpp:376
XE_LIB void ChFontSetSize(ChFont *font, int size)
Definition font.cpp:88
XE_LIB int64_t ChFontGetWidth(ChFont *font, char *string)
Definition font.cpp:320
XE_LIB int64_t ChFontGetWidthChar(ChFont *font, char c)
Definition font.cpp:350
XE_LIB int ChFontClose(ChFont *font)
Definition font.cpp:536
XE_LIB ChFont * ChInitialiseFont(char *fontname)
Definition font.cpp:47
XE_LIB void ChFontDrawChar(ChCanvas *canv, ChFont *font, char c, int penx, int peny, uint32_t sz, uint32_t color)
Definition font.cpp:163
struct _ch_font_ ChFont
XE_LIB void ChFontDrawText(ChCanvas *canv, ChFont *font, char *string, int penx, int peny, uint32_t sz, uint32_t color)
Definition font.cpp:106
#define XE_LIB
Definition _xeneva.h:55
#define XE_EXTERN
Definition _xeneva.h:50
unsigned int uint32_t
Definition acefiex.h:163
COMPILER_DEPENDENT_INT64 int64_t
Definition acefiex.h:164
unsigned char uint8_t
Definition acefiex.h:161
unsigned short int uint16_t
Definition acefiex.h:162
Definition freetype.h:1042
Definition freetype.h:1878
Definition ftobjs.h:896
Definition chitralekha.h:43
Definition font.h:62
uint32_t fontSz
Definition font.h:65
uint8_t * buffer
Definition font.h:64
uint32_t kern
Definition font.h:67
uint16_t key
Definition font.h:66
uint32_t lineHeight
Definition font.h:68
int fileSz
Definition font.h:63
uint32_t fontHeight
Definition font.h:69
Definition draw.h:43