|
@@ -5,6 +5,8 @@
|
|
|
#include "luat_log.h"
|
|
#include "luat_log.h"
|
|
|
|
|
|
|
|
extern const uint16_t luat_font_map_gb2312_data[];
|
|
extern const uint16_t luat_font_map_gb2312_data[];
|
|
|
|
|
+extern const lv_font_t luat_fonts_sarasa_bold_16_lvgl;
|
|
|
|
|
+extern const ufont_reg_t ufonts[];
|
|
|
|
|
|
|
|
static int binsearch(const uint16_t *sortedSeq, int seqLength, uint16_t keyData) {
|
|
static int binsearch(const uint16_t *sortedSeq, int seqLength, uint16_t keyData) {
|
|
|
int low = 0, mid, high = seqLength - 1;
|
|
int low = 0, mid, high = seqLength - 1;
|
|
@@ -34,9 +36,9 @@ int luat_font_get_bitmap(luat_font_header_t *font, luat_font_char_desc_t *dsc_ou
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 暂时只支持内存访问模式, 就先拦截掉其他的吧
|
|
// 暂时只支持内存访问模式, 就先拦截掉其他的吧
|
|
|
- //LLOGD("font search letter %04X", letter);
|
|
|
|
|
- //LLOGD("font access_mode %02X", font->access_mode);
|
|
|
|
|
- //LLOGD("font font_data_count %02X", font->font_data_count);
|
|
|
|
|
|
|
+ // LLOGD("font search letter %04X", letter);
|
|
|
|
|
+ // LLOGD("font access_mode %02X", font->access_mode);
|
|
|
|
|
+ // LLOGD("font font_data_count %02X", font->font_data_count);
|
|
|
if (font->access_mode != 0x01) {
|
|
if (font->access_mode != 0x01) {
|
|
|
LLOGW("only ram access mode is supported, for now");
|
|
LLOGW("only ram access mode is supported, for now");
|
|
|
return -3;
|
|
return -3;
|
|
@@ -167,7 +169,7 @@ int luat_ufont_drawUTF8(ui_draw_str_ctx_t* ctx) {
|
|
|
uint32_t str_offset;
|
|
uint32_t str_offset;
|
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
uint16_t draw_offset = 0;
|
|
uint16_t draw_offset = 0;
|
|
|
- char bitmap_buff[512] = {0}; // 不会真的有人用64以上的字号吧?
|
|
|
|
|
|
|
+ uint8_t bitmap_buff[512] = {0}; // 不会真的有人用64以上的字号吧?
|
|
|
|
|
|
|
|
int draw_x = 0;
|
|
int draw_x = 0;
|
|
|
int draw_y = 0;
|
|
int draw_y = 0;
|
|
@@ -187,6 +189,17 @@ int luat_ufont_drawUTF8(ui_draw_str_ctx_t* ctx) {
|
|
|
LLOGW("draw without font?!");
|
|
LLOGW("draw without font?!");
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // LLOGD("font %p", lfont);
|
|
|
|
|
+ // LLOGD("want %p", &luat_fonts_sarasa_bold_16_lvgl);
|
|
|
|
|
+ // LLOGD("ufonts[0].font %p", ufonts[0].font);
|
|
|
|
|
+ // LLOGD("ufonts[0] %p", &ufonts[0]);
|
|
|
|
|
+ // LLOGD("ufonts %p", &ufonts);
|
|
|
|
|
+ // LLOGD("ufonts[0].name %s", ufonts[0].name);
|
|
|
|
|
+ // lfont = &luat_fonts_sarasa_bold_16_lvgl;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 是否填充背景
|
|
// 是否填充背景
|
|
|
bool draw_bg = ctx->draw_mode == 0 ? false : true;
|
|
bool draw_bg = ctx->draw_mode == 0 ? false : true;
|
|
|
|
|
|
|
@@ -236,6 +249,8 @@ int luat_ufont_drawUTF8(ui_draw_str_ctx_t* ctx) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //LLOGD("box %d %d", dsc.box_w, dsc.box_h);
|
|
|
|
|
+
|
|
|
draw_x = x + draw_offset;
|
|
draw_x = x + draw_offset;
|
|
|
draw_offset += dsc.box_w;
|
|
draw_offset += dsc.box_w;
|
|
|
offset = 0;
|
|
offset = 0;
|
|
@@ -250,3 +265,7 @@ int luat_ufont_drawUTF8(ui_draw_str_ctx_t* ctx) {
|
|
|
//ctx->opts.draw_flush(ctx->userdata);
|
|
//ctx->opts.draw_flush(ctx->userdata);
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+lv_font_t* luat_fonts_default_font(void) {
|
|
|
|
|
+ return ufonts[0].font;
|
|
|
|
|
+}
|