取消代码中utf8的编码转换
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "mywin_inc.h"
|
||||
#include "mywin_inc.h"
|
||||
#include "rtthread.h"
|
||||
#include "main.h"
|
||||
#include "system_updata.h"
|
||||
@@ -36,7 +36,7 @@ void WIN_FontInit (char *path,char *en_path)
|
||||
ft_error=FT_New_Face (g_ft_library,path,0,&ft_face);
|
||||
if (ft_error==0)
|
||||
{
|
||||
|
||||
|
||||
if(g_ft_face) {FT_Done_Face(g_ft_face);g_ft_face=0;}
|
||||
g_ft_face=ft_face;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void WIN_InitCfg (void)
|
||||
g_lcd.exitLayerBuff=LCD_ExitLayerBuff;
|
||||
//g_lcd.setScreenDis=LCD_SetScreenDis;
|
||||
g_lcd.setWindow=LCD_SetWindow;
|
||||
g_lcd.setDrawMode=LCD_SetLcdDrawMode;
|
||||
g_lcd.setDrawMode=LCD_SetLcdDrawMode;
|
||||
g_lcd.getLcdSizeX=LCD_GetLcdSizeX;
|
||||
g_lcd.getLcdSizeY=LCD_GetLcdSizeY;
|
||||
// g_lcd.getWindowSizeX=LCD_GetWindowSizeX;
|
||||
@@ -110,22 +110,22 @@ void WIN_InitCfg (void)
|
||||
g_lcd.setLcdColor=(u16(*)(u16))LCD_SetLcdColor16;
|
||||
g_lcd.setLcdBkColor=(u16(*)(u16))LCD_SetLcdBkColor16;
|
||||
ewin->lcd=&g_lcd;
|
||||
|
||||
|
||||
//字体初始化
|
||||
WIN_FontInit("simfang.ttf",0);
|
||||
// WIN_FontInit("0:/ttf/simsun6.ttc",0);
|
||||
// WIN_FontInit("0:/ttf/华文中宋.ttf","0:/ttf/Agency-FB.ttf");
|
||||
|
||||
|
||||
WIN_FontDrawFunStruct *font=&WIN_GetWinStruct()->font;
|
||||
// font->malloc=mymalloc_ccm;
|
||||
// font->free=myfree_ccm;
|
||||
font->malloc=mymalloc_exm;
|
||||
font->free=myfree;
|
||||
|
||||
|
||||
//设置默认字体
|
||||
WIN_SetFontSize(24);
|
||||
WIN_SetFontType(WIN_FONT_TYPE_NORMAL);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -153,15 +153,15 @@ void WIN_Delay_ms (u32 ms)
|
||||
static struct rt_semaphore g_gui={0};
|
||||
static rt_err_t g_gui_err=RT_ERROR;
|
||||
|
||||
|
||||
|
||||
#define GUI_CREAT() {g_gui_err=rt_sem_init(&g_gui,"g_gui",1,RT_IPC_FLAG_FIFO);\
|
||||
rt_sem_take (&g_gui,RT_WAITING_FOREVER);}
|
||||
#define GUI_DELETE() {g_gui_err=rt_sem_release (&g_gui);\
|
||||
if (g_gui_err==RT_EOK) rt_sem_detach(&g_gui);}
|
||||
#define GUI_WAIT() {while (g_gui_err==RT_ERROR) rt_thread_delay(10);\
|
||||
rt_sem_take (&g_gui,RT_WAITING_FOREVER);}
|
||||
rt_sem_take (&g_gui,RT_WAITING_FOREVER);}
|
||||
#define GUI_WAIT_END() {}
|
||||
|
||||
|
||||
|
||||
#else
|
||||
#define GUI_CREAT() {}
|
||||
@@ -213,7 +213,7 @@ WIN_WorkFunStruct *WIN_CreatThread (int (*fun)(void *),void *ptr,int *ret)
|
||||
mymemset (handle,0,sizeof (WIN_ThreadHandle));
|
||||
handle->tackSize=4096;
|
||||
handle->tack=mymalloc (handle->tackSize);
|
||||
|
||||
|
||||
WIN_WorkFunStruct *work=mymalloc (sizeof (WIN_WorkFunStruct));
|
||||
mymemset (work,0,sizeof (WIN_WorkFunStruct));
|
||||
work->fun=fun;
|
||||
@@ -240,7 +240,7 @@ WIN_WorkFunStruct *WIN_CreatThreadPro (int (*fun)(void *),void *ptr,int *ret,u8
|
||||
mymemset (handle,0,sizeof (WIN_ThreadHandle));
|
||||
handle->tackSize=4096;
|
||||
handle->tack=mymalloc (handle->tackSize);
|
||||
|
||||
|
||||
WIN_WorkFunStruct *work=mymalloc (sizeof (WIN_WorkFunStruct));
|
||||
mymemset (work,0,sizeof (WIN_WorkFunStruct));
|
||||
work->fun=fun;
|
||||
@@ -284,8 +284,8 @@ void WIN_ExWorkFunClear (WIN_WorkFunStruct *w)
|
||||
//解码png图片,成功返回1,失败返回0
|
||||
static int decode_png(WIN_PicStruct *pic,const char *name)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
int png_err=0;
|
||||
|
||||
png_image image; /* The control structure used by libpng */
|
||||
@@ -331,7 +331,7 @@ int WIN_DecodeImg(WIN_PicStruct *pic,const char *name)
|
||||
//判断图片格式
|
||||
int str_len=strlen(name);
|
||||
const char *p_str=&name[str_len-4];
|
||||
|
||||
|
||||
//解码时显示提示,这个函数是阻塞的
|
||||
if (strcmp (p_str,".png")==0)
|
||||
{
|
||||
@@ -395,35 +395,35 @@ int WIN_DecodeImg(WIN_PicStruct *pic,const char *name)
|
||||
//根据字体类型获取字模数据
|
||||
int WIN_GetWordData(u8 size,u8 type,unsigned char *buff, int word, int buff_size)
|
||||
{
|
||||
|
||||
|
||||
u8 gbk[4]={0};
|
||||
u8 uni[3]={0};
|
||||
|
||||
|
||||
if (word>0x80)
|
||||
{
|
||||
gbk[0]=(word>>16)&0xff;
|
||||
gbk[1]=(word>>8)&0xff;
|
||||
gbk[2]=word&0xff;
|
||||
// gbk[2]=word&0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
gbk[0]=word;
|
||||
}
|
||||
|
||||
utf82uni_str(gbk,uni);
|
||||
|
||||
|
||||
gbk2uni_str(gbk,uni);
|
||||
|
||||
|
||||
if (g_ft_face)
|
||||
{
|
||||
FT_Error ft_error=0;
|
||||
|
||||
|
||||
load_char:
|
||||
ft_error=FT_Set_Pixel_Sizes(g_ft_face, size, size);
|
||||
if(type==WIN_FONT_TYPE_BITMAP)
|
||||
ft_error=FT_Load_Char (g_ft_face,(uni[0]<<8)|uni[1],FT_LOAD_RENDER|FT_LOAD_MONOCHROME);
|
||||
else
|
||||
ft_error=FT_Load_Char (g_ft_face,(uni[0]<<8)|uni[1],FT_LOAD_RENDER);
|
||||
// if(ft_error)
|
||||
// if(ft_error)
|
||||
// {
|
||||
// printf("%s:err,ft_error=0x%02x,c=%s,uni=%02x,%02x\r\n",__func__,ft_error,gbk,uni[0],uni[1]);
|
||||
// WIN_FontInit("华文中宋.ttf",0);
|
||||
@@ -431,7 +431,7 @@ int WIN_GetWordData(u8 size,u8 type,unsigned char *buff, int word, int buff_size
|
||||
// }
|
||||
|
||||
FT_GlyphSlot slot = g_ft_face->glyph;
|
||||
|
||||
|
||||
int w_byte=slot->bitmap.pitch;
|
||||
u8 *buf=slot->bitmap.buffer;
|
||||
mymemcpy (buff,buf,buff_size-5);
|
||||
@@ -440,7 +440,7 @@ int WIN_GetWordData(u8 size,u8 type,unsigned char *buff, int word, int buff_size
|
||||
buff[buff_size-3]=slot->bitmap.pitch;
|
||||
buff[buff_size-2]=slot->bitmap_left;
|
||||
buff[buff_size-1]=slot->bitmap_top;
|
||||
|
||||
|
||||
return slot->bitmap.width;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user