microui  14.1.1
microui
ui_font_drawing.c
1 /*
2  * C
3  *
4  * Copyright 2024 MicroEJ Corp. All rights reserved.
5  * Use of this source code is governed by a BSD-style license that can be found with this software.
6  */
7 
8 /*
9  * @file
10  * @brief Implementation of all drawing functions of ui_font_drawing.h.
11  * @author MicroEJ Developer Team
12  * @version 14.1.1
13  * @see ui_font_drawing.h
14  */
15 
16 // --------------------------------------------------------------------------------
17 // Includes
18 // --------------------------------------------------------------------------------
19 
20 #include <LLUI_DISPLAY.h>
21 
22 #include "ui_font_drawing.h"
23 #include "ui_drawing_soft.h"
24 #include "dw_drawing_soft.h"
25 #include "ui_drawing_stub.h"
26 #include "ui_configuration.h"
27 #include "bsp_util.h"
28 
29 #if defined(UI_FEATURE_FONT_CUSTOM_FORMATS)
30 
31 /*
32  * VEE Port supports several fonts formats: internal (Font Generator RAW format) and one or
33  * several custom formats. The next functions and tables redirect the font drawing
34  * to the right font manager (stub, soft or custom).
35  *
36  * VEE Port may support several destination formats: display format, one or several
37  * standard formats and one or several custom formats. See _get_table_index().
38  *
39  * Note: The functions are called by ui_drawing.c. The use of GPU should be checked
40  * in ui_drawing.c and not here.
41  */
42 
43 // --------------------------------------------------------------------------------
44 // Defines
45 // --------------------------------------------------------------------------------
46 
47 /*
48  * @brief Indices in the tables UI_FONT_DRAWING_xxx_custom[]
49  */
50 #define TABLE_INDEX_STUB 0 // index to call functions stub
51 #define TABLE_INDEX_SOFT 1 // index to call functions in software
52 #define TABLE_INDEX_CUSTOM_OFFSET 2 // index to call VEE Port functions
53 
54 #define GET_CUSTOM_FONT_INDEX(font) (((uint8_t)TABLE_INDEX_CUSTOM_OFFSET) + ((uint8_t)MICROUI_FONT_FORMAT_CUSTOM_0) - \
55  ((uint8_t)((font)->format)))
56 
57 // --------------------------------------------------------------------------------
58 // Extern functions
59 // --------------------------------------------------------------------------------
60 
61 /*
62  * @brief Set of drawing functions according to the source font format.
63  *
64  * These functions must be declared in other H files.
65  */
66 
67 extern jint UI_FONT_DRAWING_stringWidth_custom0(jchar *chars, jint length, MICROUI_Font *font);
68 extern jint UI_FONT_DRAWING_stringWidth_custom1(jchar *chars, jint length, MICROUI_Font *font);
69 extern jint UI_FONT_DRAWING_stringWidth_custom2(jchar *chars, jint length, MICROUI_Font *font);
70 extern jint UI_FONT_DRAWING_stringWidth_custom3(jchar *chars, jint length, MICROUI_Font *font);
71 extern jint UI_FONT_DRAWING_stringWidth_custom4(jchar *chars, jint length, MICROUI_Font *font);
72 extern jint UI_FONT_DRAWING_stringWidth_custom5(jchar *chars, jint length, MICROUI_Font *font);
73 extern jint UI_FONT_DRAWING_stringWidth_custom6(jchar *chars, jint length, MICROUI_Font *font);
74 extern jint UI_FONT_DRAWING_stringWidth_custom7(jchar *chars, jint length, MICROUI_Font *font);
75 
76 extern jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom0(jchar *chars, jint length, MICROUI_Font *font,
77  MICROUI_RenderableString *renderableString);
78 extern jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom1(jchar *chars, jint length, MICROUI_Font *font,
79  MICROUI_RenderableString *renderableString);
80 extern jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom2(jchar *chars, jint length, MICROUI_Font *font,
81  MICROUI_RenderableString *renderableString);
82 extern jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom3(jchar *chars, jint length, MICROUI_Font *font,
83  MICROUI_RenderableString *renderableString);
84 extern jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom4(jchar *chars, jint length, MICROUI_Font *font,
85  MICROUI_RenderableString *renderableString);
86 extern jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom5(jchar *chars, jint length, MICROUI_Font *font,
87  MICROUI_RenderableString *renderableString);
88 extern jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom6(jchar *chars, jint length, MICROUI_Font *font,
89  MICROUI_RenderableString *renderableString);
90 extern jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom7(jchar *chars, jint length, MICROUI_Font *font,
91  MICROUI_RenderableString *renderableString);
92 
93 extern DRAWING_Status UI_FONT_DRAWING_drawString_custom0(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
94  MICROUI_Font *font, jint x, jint y);
95 extern DRAWING_Status UI_FONT_DRAWING_drawString_custom1(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
96  MICROUI_Font *font, jint x, jint y);
97 extern DRAWING_Status UI_FONT_DRAWING_drawString_custom2(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
98  MICROUI_Font *font, jint x, jint y);
99 extern DRAWING_Status UI_FONT_DRAWING_drawString_custom3(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
100  MICROUI_Font *font, jint x, jint y);
101 extern DRAWING_Status UI_FONT_DRAWING_drawString_custom4(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
102  MICROUI_Font *font, jint x, jint y);
103 extern DRAWING_Status UI_FONT_DRAWING_drawString_custom5(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
104  MICROUI_Font *font, jint x, jint y);
105 extern DRAWING_Status UI_FONT_DRAWING_drawString_custom6(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
106  MICROUI_Font *font, jint x, jint y);
107 extern DRAWING_Status UI_FONT_DRAWING_drawString_custom7(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
108  MICROUI_Font *font, jint x, jint y);
109 
110 extern DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom0(MICROUI_GraphicsContext *gc, jchar *chars,
111  jint length, MICROUI_Font *font, jint width,
112  MICROUI_RenderableString *renderableString, jint x,
113  jint y);
114 extern DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom1(MICROUI_GraphicsContext *gc, jchar *chars,
115  jint length, MICROUI_Font *font, jint width,
116  MICROUI_RenderableString *renderableString, jint x,
117  jint y);
118 extern DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom2(MICROUI_GraphicsContext *gc, jchar *chars,
119  jint length, MICROUI_Font *font, jint width,
120  MICROUI_RenderableString *renderableString, jint x,
121  jint y);
122 extern DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom3(MICROUI_GraphicsContext *gc, jchar *chars,
123  jint length, MICROUI_Font *font, jint width,
124  MICROUI_RenderableString *renderableString, jint x,
125  jint y);
126 extern DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom4(MICROUI_GraphicsContext *gc, jchar *chars,
127  jint length, MICROUI_Font *font, jint width,
128  MICROUI_RenderableString *renderableString, jint x,
129  jint y);
130 extern DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom5(MICROUI_GraphicsContext *gc, jchar *chars,
131  jint length, MICROUI_Font *font, jint width,
132  MICROUI_RenderableString *renderableString, jint x,
133  jint y);
134 extern DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom6(MICROUI_GraphicsContext *gc, jchar *chars,
135  jint length, MICROUI_Font *font, jint width,
136  MICROUI_RenderableString *renderableString, jint x,
137  jint y);
138 extern DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom7(MICROUI_GraphicsContext *gc, jchar *chars,
139  jint length, MICROUI_Font *font, jint width,
140  MICROUI_RenderableString *renderableString, jint x,
141  jint y);
142 
143 extern DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom0(MICROUI_GraphicsContext *gc, jchar *chars,
144  jint length, MICROUI_Font *font, jint x, jint y,
145  jfloat xRatio, jfloat yRatio);
146 extern DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom1(MICROUI_GraphicsContext *gc, jchar *chars,
147  jint length, MICROUI_Font *font, jint x, jint y,
148  jfloat xRatio, jfloat yRatio);
149 extern DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom2(MICROUI_GraphicsContext *gc, jchar *chars,
150  jint length, MICROUI_Font *font, jint x, jint y,
151  jfloat xRatio, jfloat yRatio);
152 extern DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom3(MICROUI_GraphicsContext *gc, jchar *chars,
153  jint length, MICROUI_Font *font, jint x, jint y,
154  jfloat xRatio, jfloat yRatio);
155 extern DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom4(MICROUI_GraphicsContext *gc, jchar *chars,
156  jint length, MICROUI_Font *font, jint x, jint y,
157  jfloat xRatio, jfloat yRatio);
158 extern DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom5(MICROUI_GraphicsContext *gc, jchar *chars,
159  jint length, MICROUI_Font *font, jint x, jint y,
160  jfloat xRatio, jfloat yRatio);
161 extern DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom6(MICROUI_GraphicsContext *gc, jchar *chars,
162  jint length, MICROUI_Font *font, jint x, jint y,
163  jfloat xRatio, jfloat yRatio);
164 extern DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom7(MICROUI_GraphicsContext *gc, jchar *chars,
165  jint length, MICROUI_Font *font, jint x, jint y,
166  jfloat xRatio, jfloat yRatio);
167 
168 extern DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom0(MICROUI_GraphicsContext *gc,
169  jchar *chars, jint length,
170  MICROUI_Font *font, jint width,
171  MICROUI_RenderableString *
172  renderableString, jint x, jint y,
173  jfloat xRatio, jfloat yRatio);
174 extern DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom1(MICROUI_GraphicsContext *gc,
175  jchar *chars, jint length,
176  MICROUI_Font *font, jint width,
177  MICROUI_RenderableString *
178  renderableString, jint x, jint y,
179  jfloat xRatio, jfloat yRatio);
180 extern DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom2(MICROUI_GraphicsContext *gc,
181  jchar *chars, jint length,
182  MICROUI_Font *font, jint width,
183  MICROUI_RenderableString *
184  renderableString, jint x, jint y,
185  jfloat xRatio, jfloat yRatio);
186 extern DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom3(MICROUI_GraphicsContext *gc,
187  jchar *chars, jint length,
188  MICROUI_Font *font, jint width,
189  MICROUI_RenderableString *
190  renderableString, jint x, jint y,
191  jfloat xRatio, jfloat yRatio);
192 extern DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom4(MICROUI_GraphicsContext *gc,
193  jchar *chars, jint length,
194  MICROUI_Font *font, jint width,
195  MICROUI_RenderableString *
196  renderableString, jint x, jint y,
197  jfloat xRatio, jfloat yRatio);
198 extern DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom5(MICROUI_GraphicsContext *gc,
199  jchar *chars, jint length,
200  MICROUI_Font *font, jint width,
201  MICROUI_RenderableString *
202  renderableString, jint x, jint y,
203  jfloat xRatio, jfloat yRatio);
204 extern DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom6(MICROUI_GraphicsContext *gc,
205  jchar *chars, jint length,
206  MICROUI_Font *font, jint width,
207  MICROUI_RenderableString *
208  renderableString, jint x, jint y,
209  jfloat xRatio, jfloat yRatio);
210 extern DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom7(MICROUI_GraphicsContext *gc,
211  jchar *chars, jint length,
212  MICROUI_Font *font, jint width,
213  MICROUI_RenderableString *
214  renderableString, jint x, jint y,
215  jfloat xRatio, jfloat yRatio);
216 
217 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom0(MICROUI_GraphicsContext *gc, jchar c,
218  MICROUI_Font *font, jint x, jint y,
219  jint xRotation, jint yRotation, jfloat angle,
220  jint alpha);
221 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom1(MICROUI_GraphicsContext *gc, jchar c,
222  MICROUI_Font *font, jint x, jint y,
223  jint xRotation, jint yRotation, jfloat angle,
224  jint alpha);
225 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom2(MICROUI_GraphicsContext *gc, jchar c,
226  MICROUI_Font *font, jint x, jint y,
227  jint xRotation, jint yRotation, jfloat angle,
228  jint alpha);
229 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom3(MICROUI_GraphicsContext *gc, jchar c,
230  MICROUI_Font *font, jint x, jint y,
231  jint xRotation, jint yRotation, jfloat angle,
232  jint alpha);
233 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom4(MICROUI_GraphicsContext *gc, jchar c,
234  MICROUI_Font *font, jint x, jint y,
235  jint xRotation, jint yRotation, jfloat angle,
236  jint alpha);
237 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom5(MICROUI_GraphicsContext *gc, jchar c,
238  MICROUI_Font *font, jint x, jint y,
239  jint xRotation, jint yRotation, jfloat angle,
240  jint alpha);
241 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom6(MICROUI_GraphicsContext *gc, jchar c,
242  MICROUI_Font *font, jint x, jint y,
243  jint xRotation, jint yRotation, jfloat angle,
244  jint alpha);
245 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom7(MICROUI_GraphicsContext *gc, jchar c,
246  MICROUI_Font *font, jint x, jint y,
247  jint xRotation, jint yRotation, jfloat angle,
248  jint alpha);
249 
250 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom0(MICROUI_GraphicsContext *gc, jchar c,
251  MICROUI_Font *font, jint x, jint y,
252  jint xRotation, jint yRotation,
253  jfloat angle, jint alpha);
254 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom1(MICROUI_GraphicsContext *gc, jchar c,
255  MICROUI_Font *font, jint x, jint y,
256  jint xRotation, jint yRotation,
257  jfloat angle, jint alpha);
258 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom2(MICROUI_GraphicsContext *gc, jchar c,
259  MICROUI_Font *font, jint x, jint y,
260  jint xRotation, jint yRotation,
261  jfloat angle, jint alpha);
262 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom3(MICROUI_GraphicsContext *gc, jchar c,
263  MICROUI_Font *font, jint x, jint y,
264  jint xRotation, jint yRotation,
265  jfloat angle, jint alpha);
266 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom4(MICROUI_GraphicsContext *gc, jchar c,
267  MICROUI_Font *font, jint x, jint y,
268  jint xRotation, jint yRotation,
269  jfloat angle, jint alpha);
270 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom5(MICROUI_GraphicsContext *gc, jchar c,
271  MICROUI_Font *font, jint x, jint y,
272  jint xRotation, jint yRotation,
273  jfloat angle, jint alpha);
274 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom6(MICROUI_GraphicsContext *gc, jchar c,
275  MICROUI_Font *font, jint x, jint y,
276  jint xRotation, jint yRotation,
277  jfloat angle, jint alpha);
278 extern DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom7(MICROUI_GraphicsContext *gc, jchar c,
279  MICROUI_Font *font, jint x, jint y,
280  jint xRotation, jint yRotation,
281  jfloat angle, jint alpha);
282 
283 // --------------------------------------------------------------------------------
284 // Typedef of drawing functions
285 // --------------------------------------------------------------------------------
286 
287 typedef jint (*UI_FONT_DRAWING_stringWidth_t)(jchar *chars, jint length, MICROUI_Font *font);
288 typedef jint (*UI_FONT_DRAWING_initializeRenderableStringSNIContext_t)(jchar *chars, jint length, MICROUI_Font *font,
289  MICROUI_RenderableString *renderableString);
290 typedef DRAWING_Status (*UI_FONT_DRAWING_drawString_t)(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
291  MICROUI_Font *font, jint x, jint y);
292 typedef DRAWING_Status (*UI_FONT_DRAWING_drawRenderableString_t)(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
293  MICROUI_Font *font, jint width,
294  MICROUI_RenderableString *renderableString, jint x,
295  jint y);
296 typedef DRAWING_Status (*UI_FONT_DRAWING_drawScaledStringBilinear_t)(MICROUI_GraphicsContext *gc, jchar *chars,
297  jint length, MICROUI_Font *font, jint x, jint y,
298  jfloat xRatio, jfloat yRatio);
299 typedef DRAWING_Status (*UI_FONT_DRAWING_drawScaledRenderableStringBilinear_t)(MICROUI_GraphicsContext *gc,
300  jchar *chars, jint length,
301  MICROUI_Font *font, jint width,
302  MICROUI_RenderableString *
303  renderableString, jint x, jint y,
304  jfloat xRatio, jfloat yRatio);
305 typedef DRAWING_Status (*UI_FONT_DRAWING_drawCharWithRotationBilinear_t)(MICROUI_GraphicsContext *gc, jchar c,
306  MICROUI_Font *font, jint x, jint y,
307  jint xRotation, jint yRotation, jfloat angle,
308  jint alpha);
309 typedef DRAWING_Status (*UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_t)(MICROUI_GraphicsContext *gc, jchar c,
310  MICROUI_Font *font, jint x, jint y,
311  jint xRotation, jint yRotation,
312  jfloat angle, jint alph);
313 
314 // --------------------------------------------------------------------------------
315 // Tables according to the source font format.
316 // --------------------------------------------------------------------------------
317 
318 static const UI_FONT_DRAWING_stringWidth_t UI_FONT_DRAWING_stringWidth_custom[] = {
319  &UI_DRAWING_STUB_stringWidth,
320  &UI_DRAWING_SOFT_stringWidth,
321  &UI_FONT_DRAWING_stringWidth_custom0,
322  &UI_FONT_DRAWING_stringWidth_custom1,
323  &UI_FONT_DRAWING_stringWidth_custom2,
324  &UI_FONT_DRAWING_stringWidth_custom3,
325  &UI_FONT_DRAWING_stringWidth_custom4,
326  &UI_FONT_DRAWING_stringWidth_custom5,
327  &UI_FONT_DRAWING_stringWidth_custom6,
328  &UI_FONT_DRAWING_stringWidth_custom7,
329 };
330 
331 static const UI_FONT_DRAWING_initializeRenderableStringSNIContext_t
332  UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom[] = {
333  &UI_DRAWING_STUB_initializeRenderableStringSNIContext,
334  &UI_DRAWING_SOFT_initializeRenderableStringSNIContext,
335  &UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom0,
336  &UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom1,
337  &UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom2,
338  &UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom3,
339  &UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom4,
340  &UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom5,
341  &UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom6,
342  &UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom7,
343 };
344 
345 static const UI_FONT_DRAWING_drawString_t UI_FONT_DRAWING_drawString_custom[] = {
346  &UI_DRAWING_STUB_drawString,
347  &UI_DRAWING_SOFT_drawString,
348  &UI_FONT_DRAWING_drawString_custom0,
349  &UI_FONT_DRAWING_drawString_custom1,
350  &UI_FONT_DRAWING_drawString_custom2,
351  &UI_FONT_DRAWING_drawString_custom3,
352  &UI_FONT_DRAWING_drawString_custom4,
353  &UI_FONT_DRAWING_drawString_custom5,
354  &UI_FONT_DRAWING_drawString_custom6,
355  &UI_FONT_DRAWING_drawString_custom7,
356 };
357 
358 static const UI_FONT_DRAWING_drawRenderableString_t UI_FONT_DRAWING_drawRenderableString_custom[] = {
359  &UI_DRAWING_STUB_drawRenderableString,
360  &UI_DRAWING_SOFT_drawRenderableString,
361  &UI_FONT_DRAWING_drawRenderableString_custom0,
362  &UI_FONT_DRAWING_drawRenderableString_custom1,
363  &UI_FONT_DRAWING_drawRenderableString_custom2,
364  &UI_FONT_DRAWING_drawRenderableString_custom3,
365  &UI_FONT_DRAWING_drawRenderableString_custom4,
366  &UI_FONT_DRAWING_drawRenderableString_custom5,
367  &UI_FONT_DRAWING_drawRenderableString_custom6,
368  &UI_FONT_DRAWING_drawRenderableString_custom7,
369 };
370 
371 static const UI_FONT_DRAWING_drawScaledStringBilinear_t UI_FONT_DRAWING_drawScaledStringBilinear_custom[] = {
372  &UI_DRAWING_STUB_drawScaledStringBilinear,
373  &DW_DRAWING_SOFT_drawScaledStringBilinear,
374  &UI_FONT_DRAWING_drawScaledStringBilinear_custom0,
375  &UI_FONT_DRAWING_drawScaledStringBilinear_custom1,
376  &UI_FONT_DRAWING_drawScaledStringBilinear_custom2,
377  &UI_FONT_DRAWING_drawScaledStringBilinear_custom3,
378  &UI_FONT_DRAWING_drawScaledStringBilinear_custom4,
379  &UI_FONT_DRAWING_drawScaledStringBilinear_custom5,
380  &UI_FONT_DRAWING_drawScaledStringBilinear_custom6,
381  &UI_FONT_DRAWING_drawScaledStringBilinear_custom7,
382 };
383 
384 static const UI_FONT_DRAWING_drawScaledRenderableStringBilinear_t
385  UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom[] = {
386  &UI_DRAWING_STUB_drawScaledRenderableStringBilinear,
387  &DW_DRAWING_SOFT_drawScaledRenderableStringBilinear,
388  &UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom0,
389  &UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom1,
390  &UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom2,
391  &UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom3,
392  &UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom4,
393  &UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom5,
394  &UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom6,
395  &UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom7,
396 };
397 
398 static const UI_FONT_DRAWING_drawCharWithRotationBilinear_t UI_FONT_DRAWING_drawCharWithRotationBilinear_custom[] = {
399  &UI_DRAWING_STUB_drawCharWithRotationBilinear,
400  &DW_DRAWING_SOFT_drawCharWithRotationBilinear,
401  &UI_FONT_DRAWING_drawCharWithRotationBilinear_custom0,
402  &UI_FONT_DRAWING_drawCharWithRotationBilinear_custom1,
403  &UI_FONT_DRAWING_drawCharWithRotationBilinear_custom2,
404  &UI_FONT_DRAWING_drawCharWithRotationBilinear_custom3,
405  &UI_FONT_DRAWING_drawCharWithRotationBilinear_custom4,
406  &UI_FONT_DRAWING_drawCharWithRotationBilinear_custom5,
407  &UI_FONT_DRAWING_drawCharWithRotationBilinear_custom6,
408  &UI_FONT_DRAWING_drawCharWithRotationBilinear_custom7,
409 };
410 
411 static const UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_t
412  UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom[] = {
413  &UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor,
414  &DW_DRAWING_SOFT_drawCharWithRotationNearestNeighbor,
415  &UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom0,
416  &UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom1,
417  &UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom2,
418  &UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom3,
419  &UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom4,
420  &UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom5,
421  &UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom6,
422  &UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom7,
423 };
424 
425 // --------------------------------------------------------------------------------
426 // Private functions
427 // --------------------------------------------------------------------------------
428 
429 static inline uint32_t _get_table_index(MICROUI_GraphicsContext *gc, MICROUI_Font *font) {
430  uint32_t index;
431  if (!LLUI_DISPLAY_isCustomFormat(font->format)) {
432 #if !defined(UI_GC_SUPPORTED_FORMATS) || (UI_GC_SUPPORTED_FORMATS <= 1)
433  (void)gc;
434  // standard font in display GC -> can use soft algo
435  index = TABLE_INDEX_SOFT;
436 #else
437  index = LLUI_DISPLAY_isDisplayFormat(gc->image.format) ? TABLE_INDEX_SOFT : TABLE_INDEX_STUB;
438 #endif
439  } else {
440  // use the specific font manager to draw the custom font
441  // (this manager must check the destination format)
442  // cppcheck-suppress [misra-c2012-10.6] convert font format to an index
443  index = GET_CUSTOM_FONT_INDEX(font);
444  }
445  return index;
446 }
447 
448 // --------------------------------------------------------------------------------
449 // ui_font_drawing.h functions
450 // --------------------------------------------------------------------------------
451 
452 // See the header file for the function documentation
453 jint UI_FONT_DRAWING_stringWidth(jchar *chars, jint length, MICROUI_Font *font) {
454  uint32_t index;
455  if (!LLUI_DISPLAY_isCustomFormat(font->format)) {
456  index = TABLE_INDEX_SOFT;
457  } else {
458  // use the specific font manager to manage the custom font
459  // cppcheck-suppress [misra-c2012-10.6] convert font format to an index
460  index = GET_CUSTOM_FONT_INDEX(font);
461  }
462  return (*UI_FONT_DRAWING_stringWidth_custom[index])(chars, length, font);
463 }
464 
465 // See the header file for the function documentation
466 jint UI_FONT_DRAWING_initializeRenderableStringSNIContext(jchar *chars, jint length, MICROUI_Font *font,
467  MICROUI_RenderableString *renderableString) {
468  uint32_t index;
469  if (!LLUI_DISPLAY_isCustomFormat(font->format)) {
470  index = TABLE_INDEX_SOFT;
471  } else {
472  // use the specific font manager to manage the custom font
473  // cppcheck-suppress [misra-c2012-10.6] convert font format to an index
474  index = GET_CUSTOM_FONT_INDEX(font);
475  }
476  return (*UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom[index])(chars, length, font, renderableString);
477 }
478 
479 // See the header file for the function documentation
480 DRAWING_Status UI_FONT_DRAWING_drawString(MICROUI_GraphicsContext *gc, jchar *chars, jint length, MICROUI_Font *font,
481  jint x, jint y) {
482  return (*UI_FONT_DRAWING_drawString_custom[_get_table_index(gc, font)])(gc, chars, length, font, x, y);
483 }
484 
485 // See the header file for the function documentation
486 DRAWING_Status UI_FONT_DRAWING_drawRenderableString(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
487  MICROUI_Font *font, jint width,
488  MICROUI_RenderableString *renderableString, jint x, jint y) {
489  return (*UI_FONT_DRAWING_drawRenderableString_custom[_get_table_index(gc, font)])(gc, chars, length, font, width,
490  renderableString, x, y);
491 }
492 
493 // See the header file for the function documentation
494 DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
495  MICROUI_Font *font, jint x, jint y, jfloat xRatio,
496  jfloat yRatio) {
497  return (*UI_FONT_DRAWING_drawScaledStringBilinear_custom[_get_table_index(gc, font)])(gc, chars, length, font, x, y,
498  xRatio, yRatio);
499 }
500 
501 // See the header file for the function documentation
502 DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear(MICROUI_GraphicsContext *gc, jchar *chars,
503  jint length, MICROUI_Font *font, jint width,
504  MICROUI_RenderableString *renderableString, jint x,
505  jint y, jfloat xRatio, jfloat yRatio) {
506  return (*UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom[_get_table_index(gc, font)])(gc, chars, length,
507  font, width,
508  renderableString, x,
509  y, xRatio, yRatio);
510 }
511 
512 // See the header file for the function documentation
513 DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear(MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
514  jint x, jint y, jint xRotation, jint yRotation,
515  jfloat angle, jint alpha) {
516  return (*UI_FONT_DRAWING_drawCharWithRotationBilinear_custom[_get_table_index(gc, font)])(gc, c, font, x, y,
517  xRotation, yRotation,
518  angle, alpha);
519 }
520 
521 // See the header file for the function documentation
522 DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor(MICROUI_GraphicsContext *gc, jchar c,
523  MICROUI_Font *font, jint x, jint y, jint xRotation,
524  jint yRotation, jfloat angle, jint alpha) {
525  return (*UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom[_get_table_index(gc, font)])(gc, c, font, x, y,
526  xRotation,
527  yRotation, angle,
528  alpha);
529 }
530 
531 // --------------------------------------------------------------------------------
532 // Table weak functions
533 // --------------------------------------------------------------------------------
534 
535 // See the header file for the function documentation
536 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_stringWidth_custom0(jchar *chars, jint length, MICROUI_Font *font) {
537  return UI_DRAWING_STUB_stringWidth(chars, length, font);
538 }
539 
540 // See the header file for the function documentation
541 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_stringWidth_custom1(jchar *chars, jint length, MICROUI_Font *font) {
542  return UI_DRAWING_STUB_stringWidth(chars, length, font);
543 }
544 
545 // See the header file for the function documentation
546 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_stringWidth_custom2(jchar *chars, jint length, MICROUI_Font *font) {
547  return UI_DRAWING_STUB_stringWidth(chars, length, font);
548 }
549 
550 // See the header file for the function documentation
551 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_stringWidth_custom3(jchar *chars, jint length, MICROUI_Font *font) {
552  return UI_DRAWING_STUB_stringWidth(chars, length, font);
553 }
554 
555 // See the header file for the function documentation
556 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_stringWidth_custom4(jchar *chars, jint length, MICROUI_Font *font) {
557  return UI_DRAWING_STUB_stringWidth(chars, length, font);
558 }
559 
560 // See the header file for the function documentation
561 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_stringWidth_custom5(jchar *chars, jint length, MICROUI_Font *font) {
562  return UI_DRAWING_STUB_stringWidth(chars, length, font);
563 }
564 
565 // See the header file for the function documentation
566 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_stringWidth_custom6(jchar *chars, jint length, MICROUI_Font *font) {
567  return UI_DRAWING_STUB_stringWidth(chars, length, font);
568 }
569 
570 // See the header file for the function documentation
571 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_stringWidth_custom7(jchar *chars, jint length, MICROUI_Font *font) {
572  return UI_DRAWING_STUB_stringWidth(chars, length, font);
573 }
574 
575 // See the header file for the function documentation
576 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom0(jchar *chars, jint length,
577  MICROUI_Font *font,
578  MICROUI_RenderableString *
579  renderableString) {
580  return UI_DRAWING_STUB_initializeRenderableStringSNIContext(chars, length, font, renderableString);
581 }
582 
583 // See the header file for the function documentation
584 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom1(jchar *chars, jint length,
585  MICROUI_Font *font,
586  MICROUI_RenderableString *
587  renderableString) {
588  return UI_DRAWING_STUB_initializeRenderableStringSNIContext(chars, length, font, renderableString);
589 }
590 
591 // See the header file for the function documentation
592 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom2(jchar *chars, jint length,
593  MICROUI_Font *font,
594  MICROUI_RenderableString *
595  renderableString) {
596  return UI_DRAWING_STUB_initializeRenderableStringSNIContext(chars, length, font, renderableString);
597 }
598 
599 // See the header file for the function documentation
600 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom3(jchar *chars, jint length,
601  MICROUI_Font *font,
602  MICROUI_RenderableString *
603  renderableString) {
604  return UI_DRAWING_STUB_initializeRenderableStringSNIContext(chars, length, font, renderableString);
605 }
606 
607 // See the header file for the function documentation
608 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom4(jchar *chars, jint length,
609  MICROUI_Font *font,
610  MICROUI_RenderableString *
611  renderableString) {
612  return UI_DRAWING_STUB_initializeRenderableStringSNIContext(chars, length, font, renderableString);
613 }
614 
615 // See the header file for the function documentation
616 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom5(jchar *chars, jint length,
617  MICROUI_Font *font,
618  MICROUI_RenderableString *
619  renderableString) {
620  return UI_DRAWING_STUB_initializeRenderableStringSNIContext(chars, length, font, renderableString);
621 }
622 
623 // See the header file for the function documentation
624 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom6(jchar *chars, jint length,
625  MICROUI_Font *font,
626  MICROUI_RenderableString *
627  renderableString) {
628  return UI_DRAWING_STUB_initializeRenderableStringSNIContext(chars, length, font, renderableString);
629 }
630 
631 // See the header file for the function documentation
632 BSP_DECLARE_WEAK_FCNT jint UI_FONT_DRAWING_initializeRenderableStringSNIContext_custom7(jchar *chars, jint length,
633  MICROUI_Font *font,
634  MICROUI_RenderableString *
635  renderableString) {
636  return UI_DRAWING_STUB_initializeRenderableStringSNIContext(chars, length, font, renderableString);
637 }
638 
639 // See the header file for the function documentation
640 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawString_custom0(MICROUI_GraphicsContext *gc, jchar *chars,
641  jint length, MICROUI_Font *font, jint x,
642  jint y) {
643  return UI_DRAWING_STUB_drawString(gc, chars, length, font, x, y);
644 }
645 
646 // See the header file for the function documentation
647 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawString_custom1(MICROUI_GraphicsContext *gc, jchar *chars,
648  jint length, MICROUI_Font *font, jint x,
649  jint y) {
650  return UI_DRAWING_STUB_drawString(gc, chars, length, font, x, y);
651 }
652 
653 // See the header file for the function documentation
654 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawString_custom2(MICROUI_GraphicsContext *gc, jchar *chars,
655  jint length, MICROUI_Font *font, jint x,
656  jint y) {
657  return UI_DRAWING_STUB_drawString(gc, chars, length, font, x, y);
658 }
659 
660 // See the header file for the function documentation
661 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawString_custom3(MICROUI_GraphicsContext *gc, jchar *chars,
662  jint length, MICROUI_Font *font, jint x,
663  jint y) {
664  return UI_DRAWING_STUB_drawString(gc, chars, length, font, x, y);
665 }
666 
667 // See the header file for the function documentation
668 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawString_custom4(MICROUI_GraphicsContext *gc, jchar *chars,
669  jint length, MICROUI_Font *font, jint x,
670  jint y) {
671  return UI_DRAWING_STUB_drawString(gc, chars, length, font, x, y);
672 }
673 
674 // See the header file for the function documentation
675 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawString_custom5(MICROUI_GraphicsContext *gc, jchar *chars,
676  jint length, MICROUI_Font *font, jint x,
677  jint y) {
678  return UI_DRAWING_STUB_drawString(gc, chars, length, font, x, y);
679 }
680 
681 // See the header file for the function documentation
682 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawString_custom6(MICROUI_GraphicsContext *gc, jchar *chars,
683  jint length, MICROUI_Font *font, jint x,
684  jint y) {
685  return UI_DRAWING_STUB_drawString(gc, chars, length, font, x, y);
686 }
687 
688 // See the header file for the function documentation
689 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawString_custom7(MICROUI_GraphicsContext *gc, jchar *chars,
690  jint length, MICROUI_Font *font, jint x,
691  jint y) {
692  return UI_DRAWING_STUB_drawString(gc, chars, length, font, x, y);
693 }
694 
695 // See the header file for the function documentation
696 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom0(MICROUI_GraphicsContext *gc,
697  jchar *chars, jint length,
698  MICROUI_Font *font, jint width,
699  MICROUI_RenderableString *
700  renderableString, jint x, jint y) {
701  return UI_DRAWING_STUB_drawRenderableString(gc, chars, length, font, width, renderableString, x, y);
702 }
703 
704 // See the header file for the function documentation
705 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom1(MICROUI_GraphicsContext *gc,
706  jchar *chars, jint length,
707  MICROUI_Font *font, jint width,
708  MICROUI_RenderableString *
709  renderableString, jint x, jint y) {
710  return UI_DRAWING_STUB_drawRenderableString(gc, chars, length, font, width, renderableString, x, y);
711 }
712 
713 // See the header file for the function documentation
714 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom2(MICROUI_GraphicsContext *gc,
715  jchar *chars, jint length,
716  MICROUI_Font *font, jint width,
717  MICROUI_RenderableString *
718  renderableString, jint x, jint y) {
719  return UI_DRAWING_STUB_drawRenderableString(gc, chars, length, font, width, renderableString, x, y);
720 }
721 
722 // See the header file for the function documentation
723 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom3(MICROUI_GraphicsContext *gc,
724  jchar *chars, jint length,
725  MICROUI_Font *font, jint width,
726  MICROUI_RenderableString *
727  renderableString, jint x, jint y) {
728  return UI_DRAWING_STUB_drawRenderableString(gc, chars, length, font, width, renderableString, x, y);
729 }
730 
731 // See the header file for the function documentation
732 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom4(MICROUI_GraphicsContext *gc,
733  jchar *chars, jint length,
734  MICROUI_Font *font, jint width,
735  MICROUI_RenderableString *
736  renderableString, jint x, jint y) {
737  return UI_DRAWING_STUB_drawRenderableString(gc, chars, length, font, width, renderableString, x, y);
738 }
739 
740 // See the header file for the function documentation
741 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom5(MICROUI_GraphicsContext *gc,
742  jchar *chars, jint length,
743  MICROUI_Font *font, jint width,
744  MICROUI_RenderableString *
745  renderableString, jint x, jint y) {
746  return UI_DRAWING_STUB_drawRenderableString(gc, chars, length, font, width, renderableString, x, y);
747 }
748 
749 // See the header file for the function documentation
750 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom6(MICROUI_GraphicsContext *gc,
751  jchar *chars, jint length,
752  MICROUI_Font *font, jint width,
753  MICROUI_RenderableString *
754  renderableString, jint x, jint y) {
755  return UI_DRAWING_STUB_drawRenderableString(gc, chars, length, font, width, renderableString, x, y);
756 }
757 
758 // See the header file for the function documentation
759 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawRenderableString_custom7(MICROUI_GraphicsContext *gc,
760  jchar *chars, jint length,
761  MICROUI_Font *font, jint width,
762  MICROUI_RenderableString *
763  renderableString, jint x, jint y) {
764  return UI_DRAWING_STUB_drawRenderableString(gc, chars, length, font, width, renderableString, x, y);
765 }
766 
767 // See the header file for the function documentation
768 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom0(MICROUI_GraphicsContext *gc,
769  jchar *chars, jint length,
770  MICROUI_Font *font, jint x,
771  jint y, jfloat xRatio,
772  jfloat yRatio) {
773  return UI_DRAWING_STUB_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
774 }
775 
776 // See the header file for the function documentation
777 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom1(MICROUI_GraphicsContext *gc,
778  jchar *chars, jint length,
779  MICROUI_Font *font, jint x,
780  jint y, jfloat xRatio,
781  jfloat yRatio) {
782  return UI_DRAWING_STUB_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
783 }
784 
785 // See the header file for the function documentation
786 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom2(MICROUI_GraphicsContext *gc,
787  jchar *chars, jint length,
788  MICROUI_Font *font, jint x,
789  jint y, jfloat xRatio,
790  jfloat yRatio) {
791  return UI_DRAWING_STUB_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
792 }
793 
794 // See the header file for the function documentation
795 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom3(MICROUI_GraphicsContext *gc,
796  jchar *chars, jint length,
797  MICROUI_Font *font, jint x,
798  jint y, jfloat xRatio,
799  jfloat yRatio) {
800  return UI_DRAWING_STUB_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
801 }
802 
803 // See the header file for the function documentation
804 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom4(MICROUI_GraphicsContext *gc,
805  jchar *chars, jint length,
806  MICROUI_Font *font, jint x,
807  jint y, jfloat xRatio,
808  jfloat yRatio) {
809  return UI_DRAWING_STUB_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
810 }
811 
812 // See the header file for the function documentation
813 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom5(MICROUI_GraphicsContext *gc,
814  jchar *chars, jint length,
815  MICROUI_Font *font, jint x,
816  jint y, jfloat xRatio,
817  jfloat yRatio) {
818  return UI_DRAWING_STUB_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
819 }
820 
821 // See the header file for the function documentation
822 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom6(MICROUI_GraphicsContext *gc,
823  jchar *chars, jint length,
824  MICROUI_Font *font, jint x,
825  jint y, jfloat xRatio,
826  jfloat yRatio) {
827  return UI_DRAWING_STUB_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
828 }
829 
830 // See the header file for the function documentation
831 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear_custom7(MICROUI_GraphicsContext *gc,
832  jchar *chars, jint length,
833  MICROUI_Font *font, jint x,
834  jint y, jfloat xRatio,
835  jfloat yRatio) {
836  return UI_DRAWING_STUB_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
837 }
838 
839 // See the header file for the function documentation
840 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom0(
841  MICROUI_GraphicsContext *gc, jchar *chars,
842  jint length, MICROUI_Font *font, jint width,
843  MICROUI_RenderableString *renderableString, jint x, jint y,
844  jfloat xRatio, jfloat yRatio) {
845  return UI_DRAWING_STUB_drawScaledRenderableStringBilinear(gc, chars, length, font, width, renderableString, x, y,
846  xRatio, yRatio);
847 }
848 
849 // See the header file for the function documentation
850 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom1(
851  MICROUI_GraphicsContext *gc, jchar *chars,
852  jint length, MICROUI_Font *font, jint width,
853  MICROUI_RenderableString *renderableString, jint x, jint y,
854  jfloat xRatio, jfloat yRatio) {
855  return UI_DRAWING_STUB_drawScaledRenderableStringBilinear(gc, chars, length, font, width, renderableString, x, y,
856  xRatio, yRatio);
857 }
858 
859 // See the header file for the function documentation
860 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom2(
861  MICROUI_GraphicsContext *gc, jchar *chars,
862  jint length, MICROUI_Font *font, jint width,
863  MICROUI_RenderableString *renderableString, jint x, jint y,
864  jfloat xRatio, jfloat yRatio) {
865  return UI_DRAWING_STUB_drawScaledRenderableStringBilinear(gc, chars, length, font, width, renderableString, x, y,
866  xRatio, yRatio);
867 }
868 
869 // See the header file for the function documentation
870 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom3(
871  MICROUI_GraphicsContext *gc, jchar *chars,
872  jint length, MICROUI_Font *font, jint width,
873  MICROUI_RenderableString *renderableString, jint x, jint y,
874  jfloat xRatio, jfloat yRatio) {
875  return UI_DRAWING_STUB_drawScaledRenderableStringBilinear(gc, chars, length, font, width, renderableString, x, y,
876  xRatio, yRatio);
877 }
878 
879 // See the header file for the function documentation
880 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom4(
881  MICROUI_GraphicsContext *gc, jchar *chars,
882  jint length, MICROUI_Font *font, jint width,
883  MICROUI_RenderableString *renderableString, jint x, jint y,
884  jfloat xRatio, jfloat yRatio) {
885  return UI_DRAWING_STUB_drawScaledRenderableStringBilinear(gc, chars, length, font, width, renderableString, x, y,
886  xRatio, yRatio);
887 }
888 
889 // See the header file for the function documentation
890 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom5(
891  MICROUI_GraphicsContext *gc, jchar *chars,
892  jint length, MICROUI_Font *font, jint width,
893  MICROUI_RenderableString *renderableString, jint x, jint y,
894  jfloat xRatio, jfloat yRatio) {
895  return UI_DRAWING_STUB_drawScaledRenderableStringBilinear(gc, chars, length, font, width, renderableString, x, y,
896  xRatio, yRatio);
897 }
898 
899 // See the header file for the function documentation
900 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom6(
901  MICROUI_GraphicsContext *gc, jchar *chars,
902  jint length, MICROUI_Font *font, jint width,
903  MICROUI_RenderableString *renderableString, jint x, jint y,
904  jfloat xRatio, jfloat yRatio) {
905  return UI_DRAWING_STUB_drawScaledRenderableStringBilinear(gc, chars, length, font, width, renderableString, x, y,
906  xRatio, yRatio);
907 }
908 
909 // See the header file for the function documentation
910 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear_custom7(
911  MICROUI_GraphicsContext *gc, jchar *chars,
912  jint length, MICROUI_Font *font, jint width,
913  MICROUI_RenderableString *renderableString, jint x, jint y,
914  jfloat xRatio, jfloat yRatio) {
915  return UI_DRAWING_STUB_drawScaledRenderableStringBilinear(gc, chars, length, font, width, renderableString, x, y,
916  xRatio, yRatio);
917 }
918 
919 // See the header file for the function documentation
920 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom0(MICROUI_GraphicsContext *gc,
921  jchar c, MICROUI_Font *font,
922  jint x, jint y,
923  jint xRotation,
924  jint yRotation, jfloat angle,
925  jint alpha) {
926  return UI_DRAWING_STUB_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
927 }
928 
929 // See the header file for the function documentation
930 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom1(MICROUI_GraphicsContext *gc,
931  jchar c, MICROUI_Font *font,
932  jint x, jint y,
933  jint xRotation,
934  jint yRotation, jfloat angle,
935  jint alpha) {
936  return UI_DRAWING_STUB_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
937 }
938 
939 // See the header file for the function documentation
940 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom2(MICROUI_GraphicsContext *gc,
941  jchar c, MICROUI_Font *font,
942  jint x, jint y,
943  jint xRotation,
944  jint yRotation, jfloat angle,
945  jint alpha) {
946  return UI_DRAWING_STUB_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
947 }
948 
949 // See the header file for the function documentation
950 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom3(MICROUI_GraphicsContext *gc,
951  jchar c, MICROUI_Font *font,
952  jint x, jint y,
953  jint xRotation,
954  jint yRotation, jfloat angle,
955  jint alpha) {
956  return UI_DRAWING_STUB_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
957 }
958 
959 // See the header file for the function documentation
960 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom4(MICROUI_GraphicsContext *gc,
961  jchar c, MICROUI_Font *font,
962  jint x, jint y,
963  jint xRotation,
964  jint yRotation, jfloat angle,
965  jint alpha) {
966  return UI_DRAWING_STUB_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
967 }
968 
969 // See the header file for the function documentation
970 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom5(MICROUI_GraphicsContext *gc,
971  jchar c, MICROUI_Font *font,
972  jint x, jint y,
973  jint xRotation,
974  jint yRotation, jfloat angle,
975  jint alpha) {
976  return UI_DRAWING_STUB_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
977 }
978 
979 // See the header file for the function documentation
980 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom6(MICROUI_GraphicsContext *gc,
981  jchar c, MICROUI_Font *font,
982  jint x, jint y,
983  jint xRotation,
984  jint yRotation, jfloat angle,
985  jint alpha) {
986  return UI_DRAWING_STUB_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
987 }
988 
989 // See the header file for the function documentation
990 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear_custom7(MICROUI_GraphicsContext *gc,
991  jchar c, MICROUI_Font *font,
992  jint x, jint y,
993  jint xRotation,
994  jint yRotation, jfloat angle,
995  jint alpha) {
996  return UI_DRAWING_STUB_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
997 }
998 
999 // See the header file for the function documentation
1000 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom0(
1001  MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1002  jint x, jint y,
1003  jint xRotation, jint yRotation,
1004  jfloat angle,
1005  jint alpha) {
1006  return UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1007 }
1008 
1009 // See the header file for the function documentation
1010 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom1(
1011  MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1012  jint x, jint y,
1013  jint xRotation, jint yRotation,
1014  jfloat angle,
1015  jint alpha) {
1016  return UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1017 }
1018 
1019 // See the header file for the function documentation
1020 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom2(
1021  MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1022  jint x, jint y,
1023  jint xRotation, jint yRotation,
1024  jfloat angle,
1025  jint alpha) {
1026  return UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1027 }
1028 
1029 // See the header file for the function documentation
1030 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom3(
1031  MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1032  jint x, jint y,
1033  jint xRotation, jint yRotation,
1034  jfloat angle,
1035  jint alpha) {
1036  return UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1037 }
1038 
1039 // See the header file for the function documentation
1040 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom4(
1041  MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1042  jint x, jint y,
1043  jint xRotation, jint yRotation,
1044  jfloat angle,
1045  jint alpha) {
1046  return UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1047 }
1048 
1049 // See the header file for the function documentation
1050 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom5(
1051  MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1052  jint x, jint y,
1053  jint xRotation, jint yRotation,
1054  jfloat angle,
1055  jint alpha) {
1056  return UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1057 }
1058 
1059 // See the header file for the function documentation
1060 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom6(
1061  MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1062  jint x, jint y,
1063  jint xRotation, jint yRotation,
1064  jfloat angle,
1065  jint alpha) {
1066  return UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1067 }
1068 
1069 // See the header file for the function documentation
1070 BSP_DECLARE_WEAK_FCNT DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor_custom7(
1071  MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1072  jint x, jint y,
1073  jint xRotation, jint yRotation,
1074  jfloat angle,
1075  jint alpha) {
1076  return UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1077 }
1078 
1079 #else // #if defined(UI_FEATURE_FONT_CUSTOM_FORMATS)
1080 
1081 /*
1082  * VEE Port supports only standard fonts format (Font Generator RAW format). The
1083  * next functions redirect the font drawing to the software algorithms.
1084  *
1085  * VEE Port may support several destination formats: display format and one or several
1086  * standard formats.
1087  *
1088  * Note: The functions are called by ui_drawing.c. The use of GPU should be checked
1089  * in ui_drawing.c and not here.
1090  */
1091 
1092 // --------------------------------------------------------------------------------
1093 // Private functions
1094 // --------------------------------------------------------------------------------
1095 
1096 static inline bool _can_call_soft_algo(MICROUI_GraphicsContext *gc) {
1097 #if !defined(UI_GC_SUPPORTED_FORMATS) || (UI_GC_SUPPORTED_FORMATS <= 1)
1098  (void)gc;
1099  // standard font in display GC -> can use soft algo
1100  return true;
1101 #else
1102  return LLUI_DISPLAY_isDisplayFormat(gc->image.format);
1103 #endif
1104 }
1105 
1106 // --------------------------------------------------------------------------------
1107 // ui_font_drawing.h functions
1108 // --------------------------------------------------------------------------------
1109 
1110 // See the header file for the function documentation
1111 jint UI_FONT_DRAWING_stringWidth(jchar *chars, jint length, MICROUI_Font *font) {
1112  return UI_DRAWING_SOFT_stringWidth(chars, length, font);
1113 }
1114 
1115 // See the header file for the function documentation
1116 jint UI_FONT_DRAWING_initializeRenderableStringSNIContext(jchar *chars, jint length, MICROUI_Font *font,
1117  MICROUI_RenderableString *renderableString) {
1118  return UI_DRAWING_SOFT_initializeRenderableStringSNIContext(chars, length, font, renderableString);
1119 }
1120 
1121 // See the header file for the function documentation
1122 DRAWING_Status UI_FONT_DRAWING_drawString(MICROUI_GraphicsContext *gc, jchar *chars, jint length, MICROUI_Font *font,
1123  jint x, jint y) {
1124  return _can_call_soft_algo(gc) ? UI_DRAWING_SOFT_drawString(gc, chars, length, font, x, y)
1125  : UI_DRAWING_STUB_drawString(gc, chars, length, font, x, y);
1126 }
1127 
1128 // See the header file for the function documentation
1129 DRAWING_Status UI_FONT_DRAWING_drawRenderableString(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
1130  MICROUI_Font *font, jint width,
1131  MICROUI_RenderableString *renderableString, jint x, jint y) {
1132  return _can_call_soft_algo(gc) ? UI_DRAWING_SOFT_drawRenderableString(gc, chars, length, font, width,
1133  renderableString, x, y)
1134  : UI_DRAWING_STUB_drawRenderableString(gc, chars, length, font, width, renderableString, x, y);
1135 }
1136 
1137 // See the header file for the function documentation
1138 DRAWING_Status UI_FONT_DRAWING_drawScaledStringBilinear(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
1139  MICROUI_Font *font, jint x, jint y, jfloat xRatio,
1140  jfloat yRatio) {
1141  return _can_call_soft_algo(gc) ? DW_DRAWING_SOFT_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio,
1142  yRatio)
1143  : UI_DRAWING_STUB_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
1144 }
1145 
1146 // See the header file for the function documentation
1147 DRAWING_Status UI_FONT_DRAWING_drawScaledRenderableStringBilinear(MICROUI_GraphicsContext *gc, jchar *chars,
1148  jint length, MICROUI_Font *font, jint width,
1149  MICROUI_RenderableString *renderableString, jint x,
1150  jint y, jfloat xRatio, jfloat yRatio) {
1151  return _can_call_soft_algo(gc) ? DW_DRAWING_SOFT_drawScaledRenderableStringBilinear(gc, chars, length, font, width,
1152  renderableString, x, y, xRatio,
1153  yRatio)
1154  : UI_DRAWING_STUB_drawScaledRenderableStringBilinear(gc, chars, length, font, width, renderableString, x, y,
1155  xRatio, yRatio);
1156 }
1157 
1158 // See the header file for the function documentation
1159 DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationBilinear(MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1160  jint x, jint y, jint xRotation, jint yRotation,
1161  jfloat angle, jint alpha) {
1162  return _can_call_soft_algo(gc) ? DW_DRAWING_SOFT_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation,
1163  yRotation, angle, alpha)
1164  : UI_DRAWING_STUB_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1165 }
1166 
1167 // See the header file for the function documentation
1168 DRAWING_Status UI_FONT_DRAWING_drawCharWithRotationNearestNeighbor(MICROUI_GraphicsContext *gc, jchar c,
1169  MICROUI_Font *font, jint x, jint y, jint xRotation,
1170  jint yRotation, jfloat angle, jint alpha) {
1171  return _can_call_soft_algo(gc) ? DW_DRAWING_SOFT_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation,
1172  yRotation, angle, alpha)
1173  : UI_DRAWING_STUB_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation, angle, alpha);
1174 }
1175 
1176 #endif // #if defined(UI_FEATURE_FONT_CUSTOM_FORMATS)
1177 
1178 // --------------------------------------------------------------------------------
1179 // EOF
1180 // --------------------------------------------------------------------------------
MicroEJ MicroUI library low level API: enable some features according to the hardware capabilities.