17 #if defined (VG_FEATURE_FONT) && defined (VG_FEATURE_FONT_FREETYPE_BITMAP) && (VG_FEATURE_FONT == VG_FEATURE_FONT_FREETYPE_BITMAP) 26 #include <LLVG_impl.h> 27 #include <LLVG_PATH_impl.h> 28 #include <LLVG_GRADIENT_impl.h> 29 #include <LLVG_MATRIX_impl.h> 30 #include <LLVG_FONT_impl.h> 31 #include <LLVG_FONT_PAINTER_impl.h> 53 extern FT_Library library;
54 extern FT_Renderer renderer;
81 void __draw_string(MICROUI_GraphicsContext* gc, FT_Face face, jfloat size, jchar* text, jint length, jint x, jint y, jint alpha, jint blend, jfloat letterSpacing, SNI_callback callback);
89 jint LLVG_FONT_PAINTER_IMPL_draw_string(MICROUI_GraphicsContext* gc, jchar* text, jint faceHandle, jfloat size, jfloat x, jfloat y, jfloat* matrix, jint alpha, jint blend, jfloat letterSpacing){
90 FT_Face face = (FT_Face) faceHandle;
91 int length = SNI_getArrayLength(text);
94 int local_x = (int) (x + matrix[2]);
95 int local_y = (int) (y + matrix[5]);
97 __draw_string(gc, face, size, text, length, (jint)local_x, (jint)local_y, alpha, blend, letterSpacing, (SNI_callback)&LLVG_FONT_PAINTER_IMPL_draw_string);
99 return (jint)LLVG_SUCCESS;
103 jint LLVG_FONT_PAINTER_IMPL_draw_string_gradient(MICROUI_GraphicsContext* gc, jchar* text, jint faceHandle, jfloat size, jfloat x, jfloat y, jfloat* matrix, jint alpha, jint blend, jfloat letterSpacing, jint *gradientData, jfloat *gradientMatrix){
116 (void)(letterSpacing);
117 (void)(gradientData);
118 (void)(gradientMatrix);
120 return (jint)LLVG_DATA_INVALID;
123 jint LLVG_FONT_PAINTER_IMPL_draw_string_on_circle(MICROUI_GraphicsContext* gc, jchar* text, jint faceHandle, jfloat size, jint x, jint y, jfloat* matrix, jint alpha, jint blend, jfloat letterSpacing, jfloat radius, jint direction){
136 (void)(letterSpacing);
140 return (jint)LLVG_DATA_INVALID;
143 jint LLVG_FONT_PAINTER_IMPL_draw_string_on_circle_gradient(MICROUI_GraphicsContext* gc, jchar* text, jint faceHandle, jfloat size, jint x, jint y, jfloat* matrix, jint alpha, jint blend, jfloat letterSpacing, jfloat radius, jint direction, jint *gradientData, jfloat *gradientMatrix){
156 (void)(letterSpacing);
159 (void)(gradientData);
160 (void)(gradientMatrix);
162 return (jint)LLVG_DATA_INVALID;
170 void __draw_string(MICROUI_GraphicsContext* gc, FT_Face face, jfloat size, jchar* text, jint length, jint x, jint y, jint alpha, jint blend, jfloat letterSpacing, SNI_callback callback){
173 if(!LLUI_DISPLAY_requestDrawing(gc, callback)){
174 MEJ_LOG_INFO_MICROVG(
"request drawing declined \n");
178 local_freetype_context.library = library;
179 local_freetype_context.renderer = renderer;
180 local_freetype_context.face = face;
182 int char_height = (int)size;
183 local_freetype_context.error = FT_Set_Pixel_Sizes( local_freetype_context.face, 0, char_height);
184 if(FT_ERR(Ok) != local_freetype_context.error){
185 MEJ_LOG_INFO_MICROVG(
"error while setting font face size: %d\n", local_freetype_context.error);
189 jint y_adapt = (jint) LLVG_FONT_IMPL_get_baseline_position((jint)local_freetype_context.face, size);
190 MEJ_LOG_INFO_MICROVG(
"y_adapt = %d \n", y_adapt);
193 font_color = (gc->foreground_color & 0x00FFFFFF) + (alpha << 24);
195 (void)
ft_helper_print_jstring_clipped(gc, &local_freetype_context, text, length, x, y + y_adapt, font_color, alpha, size, blend, letterSpacing);
196 if(!LLUI_DISPLAY_setDrawingLimits(x, y, gc->clip_x2, y+char_height)){
197 MEJ_LOG_INFO_MICROVG(
"Warning, drawing area out of the given graphics context!\n");
199 LLUI_DISPLAY_setDrawingStatus(DRAWING_DONE);
207 #endif // #if (VG_FEATURE_FONT == VG_FEATURE_FONT_FREETYPE_BITMAP) MicroEJ MicroVG library low level API: helper to implement library natives methods.
#define FREETYPE_NOT_IMPLEMENTED
Data structure for pack all the variables required by freetype handler.
int ft_helper_print_jstring_clipped(MICROUI_GraphicsContext *gc, Freetype_context_type *freetype_context, jchar *string, jint s_size, jint x, jint y, jint color, jint alpha, jfloat size, jint blend, jfloat letterSpacing)
Prints a string in a buffer respecting the clipping area of the MicroUI Graphics Context.
MicroEJ MicroVG library low level API: implementation over FreeType.
Freetype bitmap helper implementation header for VectorGraphics Low Level API.
MicroEJ MicroVG library low level API: enable some features according to the hardware capacities...