解决字体大小异常的bug

This commit is contained in:
2025-10-12 17:01:37 +08:00
parent f6d2ef948f
commit 653d3cfcc9
2 changed files with 6 additions and 6 deletions

View File

@@ -103,7 +103,7 @@ 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.word = (size << 24) | word;
font_data.data = buff;
font_data.data_size = buff_size;
if (WIN_InsertFont(font, &font_data, font->buff_used / 2) == 0)
@@ -132,7 +132,7 @@ u8 *WIN_SearchFontData(WIN_FontBuffStruct *font, u8 size, int word,
u32 *buff_size) {
u8 *ret = 0;
if (font) {
int temp = (size << 16) | word; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int temp = (size << 24) | word; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i = 0; i < font->buff_used; i++) {
int index = i;
_font_data *font_data = 0;
@@ -261,7 +261,7 @@ static u32 WIN_DrawWordAtCommon(char *c, int x, int y) {
if (g_font == 0)
g_font = WIN_CreatFontBuff(FONT_NUM);
// <20><><EFBFBD><EFBFBD>utf8һ<38><D2BB><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD>ֽ<EFBFBD>
buff = WIN_GetFontData(g_font, (c[0] << 16) | (c[1] << 8) | c[2], &all_byte);
buff = WIN_GetFontData(g_font, (c[0] << 8) | (c[1] << 0), &all_byte);
wid = buff[all_byte - 5];
hit = buff[all_byte - 4];
@@ -334,7 +334,7 @@ static u32 WIN_DrawWordAtNormal(char *c, int x, int y) {
// <20><>ȡ<EFBFBD><C8A1>ģ
if (g_font == 0)
g_font = WIN_CreatFontBuff(FONT_NUM);
buff = WIN_GetFontData(g_font, (c[0] << 16) | (c[1] << 8) | c[2], &all_byte);
buff = WIN_GetFontData(g_font, (c[0] << 8) | (c[1] << 0), &all_byte);
wid = buff[all_byte - 5];
hit = buff[all_byte - 4];

View File

@@ -307,8 +307,8 @@ int WIN_GetWordData(u8 size, u8 type, unsigned char *buff, int word,
u8 uni[3] = {0};
if (word > 0x80) {
gbk[0] = (word >> 16) & 0xff;
gbk[1] = (word >> 8) & 0xff;
gbk[0] = (word >> 8) & 0xff;
gbk[1] = (word >> 0) & 0xff;
// gbk[2]=word&0xff;
} else {
gbk[0] = word;