2025-06-27 00:32:57 +08:00
|
|
|
|
#include "mywin_inc.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//ʹ<>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
static u32 WIN_DrawCharAtCommon (char c,int x,int y);
|
|
|
|
|
static u32 WIN_DrawWordAtCommon (char *c,int x,int y);
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//ʹ<><CAB9><EFBFBD><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
static u32 WIN_DrawCharAtNormal (char c,int x,int y);
|
|
|
|
|
static u32 WIN_DrawWordAtNormal (char *c,int x,int y);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
int WIN_GetFontHight (void)
|
|
|
|
|
{
|
|
|
|
|
return WIN_GetWinStruct()->font.TxtH;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
int WIN_GetFontWidth (void)
|
|
|
|
|
{
|
|
|
|
|
return WIN_GetWinStruct()->font.TxtW;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ<C4A3><CABD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>䱳<EFBFBD><E4B1B3><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䱳<EFBFBD><E4B1B3>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
int WIN_SetFontMode (int mode)
|
|
|
|
|
{
|
|
|
|
|
WIN_GetWinStruct()->lcd->setDrawMode(!mode);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//-------------------------<2D><><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>--------------------------------------
|
2025-06-27 00:32:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int word;
|
|
|
|
|
u32 data_size;
|
|
|
|
|
u8 *data;
|
|
|
|
|
} _font_data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2025-07-05 19:47:28 +08:00
|
|
|
|
u32 buff_size; //<2F>ܴ<EFBFBD>С
|
|
|
|
|
u32 buff_used; //ʹ<><CAB9><EFBFBD>˶<EFBFBD><CBB6><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
_font_data *font_data;
|
|
|
|
|
}WIN_FontBuffStruct;
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>صĸ<D8B5><C4B8><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
#define FONT_NUM 200
|
|
|
|
|
static WIN_FontBuffStruct *g_font;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
WIN_FontBuffStruct *WIN_CreatFontBuff (u32 size)
|
|
|
|
|
{
|
|
|
|
|
WIN_FontBuffStruct *ret=mycalloc( sizeof (WIN_FontBuffStruct));
|
|
|
|
|
if (ret==0) return ret;
|
|
|
|
|
|
|
|
|
|
ret->font_data=mymalloc_exm (sizeof(_font_data)*size);
|
|
|
|
|
if (ret->font_data==0)
|
|
|
|
|
{
|
|
|
|
|
myfree(ret);
|
|
|
|
|
ret=0;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
mymemset(ret->font_data,0,sizeof(_font_data)*size);
|
|
|
|
|
ret->buff_size=size;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//ɾ<><C9BE>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
void WIN_DeleteFontBuff (WIN_FontBuffStruct *font)
|
|
|
|
|
{
|
|
|
|
|
if (font)
|
|
|
|
|
{
|
|
|
|
|
WIN_FontDrawFunStruct *fn=&WIN_GetWinStruct()->font;
|
|
|
|
|
for (int i=0;i<font->buff_used;i++)
|
|
|
|
|
{
|
|
|
|
|
_font_data *font_data=&font->font_data[i];
|
|
|
|
|
if (font_data->data) fn->free(font_data->data);
|
|
|
|
|
}
|
|
|
|
|
myfree(font->font_data);
|
|
|
|
|
myfree(font);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
// <20><>index<65><78>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>Ŀռ<C4BF>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
int WIN_InsertFont(WIN_FontBuffStruct *font, _font_data *data,int index)
|
|
|
|
|
{
|
|
|
|
|
if(font==0) return 0;
|
|
|
|
|
if(index>font->buff_used) return 0;
|
|
|
|
|
WIN_FontDrawFunStruct *fn=&WIN_GetWinStruct()->font;
|
|
|
|
|
int num=font->buff_used-index;
|
|
|
|
|
_font_data *font_data=&font->font_data[index];
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
// index֮<78><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
if(font->buff_used>=font->buff_size)
|
|
|
|
|
{
|
2025-07-05 19:47:28 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
_font_data *end=&font->font_data[font->buff_used-1];
|
|
|
|
|
fn->free(end->data);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
font->buff_used++;
|
|
|
|
|
}
|
2025-07-05 19:47:28 +08:00
|
|
|
|
// ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
for(int i=num;i>0;i--)
|
|
|
|
|
{
|
|
|
|
|
_font_data *end=&font_data[i];
|
|
|
|
|
_font_data *first=&font_data[i-1];
|
|
|
|
|
mymemcpy(end,first,sizeof(_font_data));
|
|
|
|
|
}
|
2025-07-05 19:47:28 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5>ַ<EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
mymemcpy(font_data,data,sizeof(_font_data));
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
int WIN_AddFontData (WIN_FontBuffStruct *font,u8 size,int word,u8 *buff,u32 buff_size)
|
|
|
|
|
{
|
|
|
|
|
if (font)
|
|
|
|
|
{
|
|
|
|
|
_font_data font_data={0};
|
|
|
|
|
font_data.word=(size<<16)|word;
|
|
|
|
|
font_data.data=buff;
|
|
|
|
|
font_data.data_size=buff_size;
|
|
|
|
|
if(WIN_InsertFont(font,&font_data,font->buff_used/2)==0)
|
|
|
|
|
printf("%s:insert font err \r\n",__func__);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_font_data *WIN_FontUsed(WIN_FontBuffStruct *font,int index)
|
|
|
|
|
{
|
|
|
|
|
_font_data *font_data=0;
|
|
|
|
|
font_data=&font->font_data[index];
|
|
|
|
|
if(index!=0)
|
|
|
|
|
{
|
|
|
|
|
_font_data *font_temp=mymalloc(sizeof(_font_data));
|
|
|
|
|
_font_data *font_first=&font->font_data[index-1];
|
|
|
|
|
mymemcpy(font_temp,font_data,sizeof(_font_data));
|
|
|
|
|
mymemcpy(font_data,font_first,sizeof(_font_data));
|
|
|
|
|
mymemcpy(font_first,font_temp,sizeof(_font_data));
|
|
|
|
|
myfree(font_temp);
|
|
|
|
|
font_data=font_first;
|
|
|
|
|
}
|
|
|
|
|
return font_data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
u8 *WIN_SearchFontData (WIN_FontBuffStruct *font,u8 size,int word,u32 *buff_size)
|
|
|
|
|
{
|
|
|
|
|
u8 *ret=0;
|
|
|
|
|
if (font)
|
|
|
|
|
{
|
2025-07-05 19:47:28 +08:00
|
|
|
|
int temp=(size<<16)|word;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
for (int i=0;i<font->buff_used;i++)
|
|
|
|
|
{
|
|
|
|
|
int index=i;
|
|
|
|
|
_font_data *font_data=0;
|
|
|
|
|
font_data=&font->font_data[index];
|
|
|
|
|
if (font_data->word==temp)
|
|
|
|
|
{
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//ʹ<><CAB9><EFBFBD><EFBFBD>һ<EFBFBD>Σ<EFBFBD><CEA3><EFBFBD>λ<EFBFBD><CEBB>ǰ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
font_data=WIN_FontUsed(font,index);
|
|
|
|
|
ret=font_data->data;
|
|
|
|
|
if (buff_size) *buff_size=font_data->data_size;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>о<EFBFBD><D0BE><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>о͵<D0BE><CDB5>û<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>κ<EFBFBD><CEBA><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
u8 *WIN_GetFontData (WIN_FontBuffStruct *font,int word,u32 *buff_size)
|
|
|
|
|
{
|
|
|
|
|
u8 *buff=0;
|
|
|
|
|
WIN_FontDrawFunStruct *fn=&WIN_GetWinStruct()->font;
|
|
|
|
|
buff=WIN_SearchFontData(font,fn->TxtSize,word,buff_size);
|
|
|
|
|
if (buff==0)
|
|
|
|
|
{
|
|
|
|
|
buff=fn->malloc(*buff_size);
|
|
|
|
|
WIN_GetWordData (fn->TxtSize,fn->TxtType,buff,word,*buff_size);
|
|
|
|
|
WIN_AddFontData (font,fn->TxtSize,word,buff,*buff_size);
|
|
|
|
|
}
|
|
|
|
|
return buff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
int WIN_SetFontSize (int size)
|
|
|
|
|
{
|
|
|
|
|
WIN_FontDrawFunStruct *font=&WIN_GetWinStruct()->font;
|
|
|
|
|
int ret=font->TxtSize;
|
|
|
|
|
u8 set_size=size;
|
|
|
|
|
|
|
|
|
|
font->TxtSize=set_size;
|
|
|
|
|
font->TxtH=set_size;
|
|
|
|
|
font->TxtW=set_size;
|
|
|
|
|
if(font->TxtType==0)
|
|
|
|
|
{
|
|
|
|
|
font->drawChar=WIN_DrawCharAtCommon;
|
|
|
|
|
font->drawWord=WIN_DrawWordAtCommon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
int WIN_SetFontType(int type)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
WIN_FontDrawFunStruct *font=&WIN_GetWinStruct()->font;
|
|
|
|
|
int ret=font->TxtType;
|
|
|
|
|
font->TxtType=type?WIN_FONT_TYPE_NORMAL:WIN_FONT_TYPE_BITMAP;
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>岻<EFBFBD><E5B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
if(font->TxtType!=ret)
|
|
|
|
|
{
|
|
|
|
|
WIN_DeleteFontBuff(g_font);
|
|
|
|
|
}
|
|
|
|
|
if(font->TxtType==WIN_FONT_TYPE_BITMAP)
|
|
|
|
|
{
|
|
|
|
|
font->drawChar=WIN_DrawCharAtCommon;
|
|
|
|
|
font->drawWord=WIN_DrawWordAtCommon;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
font->drawChar=WIN_DrawCharAtNormal;
|
|
|
|
|
font->drawWord=WIN_DrawWordAtNormal;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//-------------------------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>--------------------------------------
|
2025-06-27 00:32:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//ͨ<>õĻ<C3B5><C4BB><EFBFBD>Ӣ<EFBFBD><D3A2><EFBFBD>ַ<EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
static u32 WIN_DrawCharAtCommon (char c,int x,int y)
|
|
|
|
|
{
|
|
|
|
|
u8 size=WIN_GetWinStruct()->font.TxtSize;
|
|
|
|
|
u8 wid=size/2;
|
|
|
|
|
u8 hit=size;
|
|
|
|
|
s8 off_left=0;
|
|
|
|
|
s8 off_up=0;
|
|
|
|
|
u8 w_byte=wid/8+1;
|
|
|
|
|
if (wid%8) w_byte++;
|
|
|
|
|
u8 h_byte=hit;
|
|
|
|
|
u32 all_byte= w_byte*h_byte+5;
|
|
|
|
|
u32 ret=0;
|
|
|
|
|
u8 *buff=0;
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ģ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
if (g_font==0) g_font=WIN_CreatFontBuff(FONT_NUM);
|
|
|
|
|
buff=WIN_GetFontData(g_font,c,&all_byte);
|
|
|
|
|
|
|
|
|
|
wid=buff[all_byte-5];
|
|
|
|
|
hit=buff[all_byte-4];
|
|
|
|
|
w_byte=buff[all_byte-3];
|
|
|
|
|
off_left=buff[all_byte-2];
|
|
|
|
|
off_up=(size-buff[all_byte-1])-size/10;
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE>ģ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
for (int j=0;j<hit+0;j++)
|
|
|
|
|
{
|
|
|
|
|
for (int i=0;i<wid+0;i++)
|
|
|
|
|
{
|
|
|
|
|
WIN_DrawPointSafe (x+i+off_left,y+j+off_up,(buff[j*w_byte+i/8]<<(i%8))&0x80);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ret=WIN_GetFontWidth()/2;
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//ͨ<>õĻ<C3B5><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
static u32 WIN_DrawWordAtCommon (char *c,int x,int y)
|
|
|
|
|
{
|
|
|
|
|
u8 size=WIN_GetWinStruct()->font.TxtSize;
|
|
|
|
|
u8 wid=size;
|
|
|
|
|
u8 hit=size;
|
|
|
|
|
s8 off_left=0;
|
|
|
|
|
s8 off_up=0;
|
|
|
|
|
u8 w_byte=wid/8+1;
|
|
|
|
|
if (wid%8) w_byte++;
|
|
|
|
|
u8 h_byte=hit;
|
|
|
|
|
u32 all_byte= w_byte*h_byte+5;
|
|
|
|
|
u32 ret=0;
|
|
|
|
|
u8 *buff=0;
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ģ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
if (g_font==0) g_font=WIN_CreatFontBuff(FONT_NUM);
|
2025-07-05 19:47:28 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>utf8һ<38><D2BB><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD>ֽ<EFBFBD>
|
2025-06-29 11:53:35 +08:00
|
|
|
|
buff=WIN_GetFontData(g_font,(c[0]<<16)|(c[1]<<8)|c[2],&all_byte);
|
2025-06-27 00:32:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wid=buff[all_byte-5];
|
|
|
|
|
hit=buff[all_byte-4];
|
|
|
|
|
w_byte=buff[all_byte-3];
|
|
|
|
|
off_left=buff[all_byte-2];
|
|
|
|
|
off_up=(size-buff[all_byte-1])-size/10;
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE>ģ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
for (int j=0;j<hit+0;j++)
|
|
|
|
|
{
|
|
|
|
|
for (int i=0;i<wid+0;i++)
|
|
|
|
|
{
|
|
|
|
|
WIN_DrawPointSafe (x+i+off_left,y+j+off_up,(buff[j*w_byte+i/8]<<(i%8))&0x80);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ret=WIN_GetFontWidth();
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//ͨ<>õĻ<C3B5><C4BB><EFBFBD>Ӣ<EFBFBD><D3A2><EFBFBD>ַ<EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
static u32 WIN_DrawCharAtNormal (char c,int x,int y)
|
|
|
|
|
{
|
|
|
|
|
u8 size=WIN_GetWinStruct()->font.TxtSize;
|
|
|
|
|
u8 wid=size/2;
|
|
|
|
|
u8 hit=size;
|
|
|
|
|
s8 off_left=0;
|
|
|
|
|
s8 off_up=0;
|
|
|
|
|
u8 w_byte=wid;
|
|
|
|
|
u8 h_byte=hit;
|
|
|
|
|
u32 all_byte= w_byte*h_byte+5;
|
|
|
|
|
u32 ret=0;
|
|
|
|
|
u8 *buff=0;
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ģ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
if (g_font==0) g_font=WIN_CreatFontBuff(FONT_NUM);
|
|
|
|
|
buff=WIN_GetFontData(g_font,c,&all_byte);
|
|
|
|
|
|
|
|
|
|
wid=buff[all_byte-5];
|
|
|
|
|
hit=buff[all_byte-4];
|
|
|
|
|
w_byte=buff[all_byte-3];
|
|
|
|
|
off_left=buff[all_byte-2];
|
|
|
|
|
off_up=(size-buff[all_byte-1])-size/10;
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE>ģ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
u16 color=WIN_GetLcdColor16();
|
|
|
|
|
for (int j=0;j<hit+0;j++)
|
|
|
|
|
{
|
|
|
|
|
for (int i=0;i<wid+0;i++)
|
|
|
|
|
{
|
|
|
|
|
WIN_DrawPointSafeColorAlpha (x+i+off_left,y+j+off_up,color,buff[j*wid+i]>>3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ret=WIN_GetFontWidth()/2;
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//ͨ<>õĻ<C3B5><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
static u32 WIN_DrawWordAtNormal (char *c,int x,int y)
|
|
|
|
|
{
|
|
|
|
|
u8 size=WIN_GetWinStruct()->font.TxtSize;
|
|
|
|
|
u8 wid=size;
|
|
|
|
|
u8 hit=size;
|
|
|
|
|
s8 off_left=0;
|
|
|
|
|
s8 off_up=0;
|
|
|
|
|
u8 w_byte=wid;
|
|
|
|
|
u8 h_byte=hit;
|
|
|
|
|
u32 all_byte= w_byte*h_byte+5;
|
|
|
|
|
u32 ret=0;
|
|
|
|
|
u8 *buff=0;
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ģ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
if (g_font==0) g_font=WIN_CreatFontBuff(FONT_NUM);
|
2025-06-29 16:00:18 +08:00
|
|
|
|
buff=WIN_GetFontData(g_font,(c[0]<<16)|(c[1]<<8)|c[2],&all_byte);
|
2025-06-27 00:32:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wid=buff[all_byte-5];
|
|
|
|
|
hit=buff[all_byte-4];
|
|
|
|
|
w_byte=buff[all_byte-3];
|
|
|
|
|
off_left=buff[all_byte-2];
|
|
|
|
|
off_up=(size-buff[all_byte-1])-size/10;
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE>ģ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
u16 color=WIN_GetLcdColor16();
|
|
|
|
|
for (int j=0;j<hit+0;j++)
|
|
|
|
|
{
|
|
|
|
|
for (int i=0;i<wid+0;i++)
|
|
|
|
|
{
|
|
|
|
|
WIN_DrawPointSafeColorAlpha (x+i+off_left,y+j+off_up,color,buff[j*wid+i]>>3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ret=WIN_GetFontWidth();
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|