Restore 演奏段落 and reduce Chinese glyph clipping.
Widen TAB text margins at 11px, regenerate section/timbre labels, and regenerate MiSans bitmaps with padding so strokes are not cut. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
805ca0c94b
commit
c8e32958a7
|
|
@ -37,7 +37,8 @@ const LEBEL_UI UI_Label[] = {
|
||||||
{126,101, 48, 55, (const uint8_t*)"\xCB\xD9\xB6\xC8", LCD_ALIGN_CENTER, WHITE,BLACK,12, LCD_ALIGN_CENTER,WHITE,BLACK,16, GUI_SPEED},
|
{126,101, 48, 55, (const uint8_t*)"\xCB\xD9\xB6\xC8", LCD_ALIGN_CENTER, WHITE,BLACK,12, LCD_ALIGN_CENTER,WHITE,BLACK,16, GUI_SPEED},
|
||||||
{13, 215, 105,51, (const uint8_t*)"\xB8\xE8\xC7\xFA\xD1\xA1\xD2\xE9", LCD_ALIGN_LEFT,WHITE,BLACK,11,LCD_ALIGN_CENTER,WHITE,BLACK,13,GUI_MODE_PARAM},
|
{13, 215, 105,51, (const uint8_t*)"\xB8\xE8\xC7\xFA\xD1\xA1\xD2\xE9", LCD_ALIGN_LEFT,WHITE,BLACK,11,LCD_ALIGN_CENTER,WHITE,BLACK,13,GUI_MODE_PARAM},
|
||||||
{13, 215, 161,50, (const uint8_t*)"\xCF\xD2\xD2\xF4\xC9\xAB\xD1\xA1\xD2\xE9",LCD_ALIGN_LEFT,WHITE,BLACK,11,LCD_ALIGN_CENTER,WHITE,BLACK,13,GUI_TIMBRE_SELECT},
|
{13, 215, 161,50, (const uint8_t*)"\xCF\xD2\xD2\xF4\xC9\xAB\xD1\xA1\xD2\xE9",LCD_ALIGN_LEFT,WHITE,BLACK,11,LCD_ALIGN_CENTER,WHITE,BLACK,13,GUI_TIMBRE_SELECT},
|
||||||
{13, 215, 210,55, (const uint8_t*)"\xB6\xCE\xC2\xE4",LCD_ALIGN_LEFT,WHITE,BLACK,11,LCD_ALIGN_CENTER,WHITE,BLACK,13,GUI_PLAY_SECTION},
|
/* 0902/0819:演奏段落(勿缩成「段落」) */
|
||||||
|
{13, 215, 210,55, (const uint8_t*)"\xD1\xDD\xD7\xE0\xB6\xCE\xC2\xE4",LCD_ALIGN_LEFT,WHITE,BLACK,11,LCD_ALIGN_CENTER,WHITE,BLACK,13,GUI_PLAY_SECTION},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
100
UI/UI_SongMode.c
100
UI/UI_SongMode.c
|
|
@ -7,98 +7,46 @@ static uint8_t Speed[6] = {0xF0, 0x51, 0x03, 0x00, 0x00, 0xF7};
|
||||||
|
|
||||||
void Draw_Tab_Mode_Menu(const LEBEL_UI *UI, GUI_SWITCH *Group)
|
void Draw_Tab_Mode_Menu(const LEBEL_UI *UI, GUI_SWITCH *Group)
|
||||||
{
|
{
|
||||||
// ===================== TAB 閰嶇疆鍙傛暟 =====================
|
/* 0902 TAB ≈55×18;四字用 11 号居中并左右留白,避免圆角/底边裁切笔画 */
|
||||||
const uint16_t tab_w = 55; // TAB瀹藉<E780B9>????
|
const uint16_t tab_w = 55;
|
||||||
const uint16_t tab_h = 18; // TAB楂樺<E6A582>????
|
const uint16_t tab_h = 18;
|
||||||
const uint8_t tab_r = 6; // 鍦嗚<E98DA6>????
|
const uint8_t tab_r = 6;
|
||||||
//const uint8_t space = 3; // 闂<>?<3F>窛
|
const uint8_t tab_font = 11;
|
||||||
const uint16_t start_x = 12; // 璧峰X
|
const uint16_t start_x = 12;
|
||||||
const uint16_t start_y = UI->y + 3; // 璧峰Y
|
const uint16_t start_y = UI->y + 3;
|
||||||
const uint16_t text_y = UI->y + 6; // 鏂囧<E98F82>????Y
|
const uint16_t text_y = start_y + (tab_h - tab_font) / 2;
|
||||||
|
const uint16_t inset = 3;
|
||||||
// ===================== 棰滆壊瀹氫<E780B9>???? =====================
|
|
||||||
uint16_t color_sel_bg = COLOR_GRAD_MID;
|
uint16_t color_sel_bg = COLOR_GRAD_MID;
|
||||||
uint16_t color_unsel_bg = COLOR_NORMAL_BG;
|
uint16_t color_unsel_bg = COLOR_NORMAL_BG;
|
||||||
uint16_t color_text = UI->Text_fc; // 鏂囧瓧棰滆<E6A3B0>??
|
uint16_t color_text = UI->Text_fc;
|
||||||
|
|
||||||
// 鏄剧ず锛氳嚜鍔ㄤ即濂忓紑 / <20>?????
|
|
||||||
if(Group->Current == 1)
|
if(Group->Current == 1)
|
||||||
{
|
{
|
||||||
LCD_FillRoundRect(start_x,
|
LCD_FillRoundRect(start_x, start_y, tab_w, tab_h, tab_r, color_unsel_bg);
|
||||||
start_y,
|
LCD_FillRoundRect(start_x+tab_w +5, start_y, tab_w, tab_h, tab_r, color_sel_bg);
|
||||||
tab_w,
|
|
||||||
tab_h,
|
|
||||||
tab_r,
|
|
||||||
color_unsel_bg);
|
|
||||||
|
|
||||||
LCD_FillRoundRect(start_x+tab_w +5,
|
|
||||||
start_y,
|
|
||||||
tab_w,
|
|
||||||
tab_h,
|
|
||||||
tab_r,
|
|
||||||
color_sel_bg);
|
|
||||||
|
|
||||||
LCD_ShowChinese_AutoAlign(
|
LCD_ShowChinese_AutoAlign(
|
||||||
start_x,
|
start_x + inset, start_x + tab_w - inset, text_y,
|
||||||
start_x + tab_w,
|
|
||||||
text_y,
|
|
||||||
(const uint8_t*)"\xBD\xDA\xD7\xE0\xC0\xE0\xD0\xCD",
|
(const uint8_t*)"\xBD\xDA\xD7\xE0\xC0\xE0\xD0\xCD",
|
||||||
UI->Text_Align,
|
LCD_ALIGN_CENTER, color_text, color_unsel_bg, 0, tab_font);
|
||||||
color_text,
|
|
||||||
color_unsel_bg,
|
|
||||||
0,
|
|
||||||
12
|
|
||||||
);
|
|
||||||
LCD_ShowChinese_AutoAlign(
|
LCD_ShowChinese_AutoAlign(
|
||||||
start_x + tab_w + 5,
|
start_x + tab_w + 5 + inset, start_x + tab_w + 5 + tab_w - inset, text_y,
|
||||||
start_x + tab_w + 5 + tab_w,
|
|
||||||
text_y,
|
|
||||||
(const uint8_t *)"\xB1\xBE\xB5\xD8\xC7\xFA\xC4\xBF",
|
(const uint8_t *)"\xB1\xBE\xB5\xD8\xC7\xFA\xC4\xBF",
|
||||||
UI->Text_Align,
|
LCD_ALIGN_CENTER, color_text, color_sel_bg, 0, tab_font);
|
||||||
color_text,
|
|
||||||
color_sel_bg,
|
|
||||||
0,
|
|
||||||
12
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LCD_FillRoundRect(start_x,
|
LCD_FillRoundRect(start_x, start_y, tab_w, tab_h, tab_r, color_sel_bg);
|
||||||
start_y,
|
LCD_FillRoundRect(start_x+tab_w +5, start_y, tab_w, tab_h, tab_r, color_unsel_bg);
|
||||||
tab_w,
|
|
||||||
tab_h,
|
|
||||||
tab_r,
|
|
||||||
color_sel_bg);
|
|
||||||
|
|
||||||
LCD_FillRoundRect(start_x+tab_w +5,
|
|
||||||
start_y,
|
|
||||||
tab_w,
|
|
||||||
tab_h,
|
|
||||||
tab_r,
|
|
||||||
color_unsel_bg);
|
|
||||||
|
|
||||||
LCD_ShowChinese_AutoAlign(
|
LCD_ShowChinese_AutoAlign(
|
||||||
start_x,
|
start_x + inset, start_x + tab_w - inset, text_y,
|
||||||
start_x + tab_w,
|
(const uint8_t*)"\xBD\xDA\xD7\xE0\xC0\xE0\xD0\xCD",
|
||||||
text_y,
|
LCD_ALIGN_CENTER, color_text, color_sel_bg, 0, tab_font);
|
||||||
(const uint8_t*)"\xBD\xDA\xD7\xE0\xC0\xE0\xD0\xCD", //节<>?<3F>类<EFBFBD>?
|
|
||||||
UI->Text_Align,
|
|
||||||
color_text,
|
|
||||||
color_sel_bg,
|
|
||||||
0,
|
|
||||||
12
|
|
||||||
);
|
|
||||||
LCD_ShowChinese_AutoAlign(
|
LCD_ShowChinese_AutoAlign(
|
||||||
start_x + tab_w + 5,
|
start_x + tab_w + 5 + inset, start_x + tab_w + 5 + tab_w - inset, text_y,
|
||||||
start_x + tab_w + 5 + tab_w,
|
(const uint8_t *)"\xB1\xBE\xB5\xD8\xC7\xFA\xC4\xBF",
|
||||||
text_y,
|
LCD_ALIGN_CENTER, color_text, color_unsel_bg, 0, tab_font);
|
||||||
(const uint8_t *)"\xB1\xBE\xB5\xD8\xC7\xFA\xC4\xBF", //<2F>?地曲<E59CB0>?
|
|
||||||
UI->Text_Align,
|
|
||||||
color_text,
|
|
||||||
color_unsel_bg,
|
|
||||||
0,
|
|
||||||
12
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -649,7 +649,7 @@ void label_TimbreSelece_ui(const LEBEL_UI *UI, GUI_SWITCH * Group)
|
||||||
LCD_ShowChinese_AutoAlign(
|
LCD_ShowChinese_AutoAlign(
|
||||||
UI->x,
|
UI->x,
|
||||||
UI->x+UI->w,
|
UI->x+UI->w,
|
||||||
UI->y+5,
|
UI->y + 3,
|
||||||
UI->p,
|
UI->p,
|
||||||
UI->Tab_Align,
|
UI->Tab_Align,
|
||||||
UI->Tab_fc,
|
UI->Tab_fc,
|
||||||
|
|
@ -695,11 +695,11 @@ void label_TimbreSelece_ui(const LEBEL_UI *UI, GUI_SWITCH * Group)
|
||||||
}
|
}
|
||||||
void label_PlaySection_ui(const LEBEL_UI *UI,GUI_SWITCH * Group)
|
void label_PlaySection_ui(const LEBEL_UI *UI,GUI_SWITCH * Group)
|
||||||
{
|
{
|
||||||
// 显示<E698BE>?<3F>?
|
/* 标签与下方段落按钮留足间距,避免底边笔画被按钮底盖住 */
|
||||||
LCD_ShowChinese_AutoAlign(
|
LCD_ShowChinese_AutoAlign(
|
||||||
UI->x, // 坐标<E59D90>?
|
UI->x,
|
||||||
UI->x+UI->w,
|
UI->x+UI->w,
|
||||||
UI->y+5,
|
UI->y + 2,
|
||||||
UI->p,
|
UI->p,
|
||||||
UI->Tab_Align,
|
UI->Tab_Align,
|
||||||
UI->Tab_fc,
|
UI->Tab_fc,
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -47,6 +47,7 @@ def gbk_char(h, l):
|
||||||
|
|
||||||
|
|
||||||
def render_glyph(ch, size, font, square=True):
|
def render_glyph(ch, size, font, square=True):
|
||||||
|
"""Rasterize into size×size with 1px margin so CJK strokes are not clipped."""
|
||||||
if square:
|
if square:
|
||||||
w = h = size
|
w = h = size
|
||||||
else:
|
else:
|
||||||
|
|
@ -55,12 +56,22 @@ def render_glyph(ch, size, font, square=True):
|
||||||
|
|
||||||
img = Image.new("L", (w, h), 0)
|
img = Image.new("L", (w, h), 0)
|
||||||
draw = ImageDraw.Draw(img)
|
draw = ImageDraw.Draw(img)
|
||||||
|
pad = 1 if size >= 10 else 0
|
||||||
|
|
||||||
bbox = draw.textbbox((0, 0), ch, font=font)
|
bbox = draw.textbbox((0, 0), ch, font=font)
|
||||||
tw = bbox[2] - bbox[0]
|
tw = bbox[2] - bbox[0]
|
||||||
th = bbox[3] - bbox[1]
|
th = bbox[3] - bbox[1]
|
||||||
x = (w - tw) // 2 - bbox[0]
|
inner_w = max(1, w - 2 * pad)
|
||||||
y = (h - th) // 2 - bbox[1]
|
inner_h = max(1, h - 2 * pad)
|
||||||
|
x = pad + (inner_w - tw) // 2 - bbox[0]
|
||||||
|
y = pad + (inner_h - th) // 2 - bbox[1]
|
||||||
|
# Prefer keeping top/bottom strokes inside the bitmap
|
||||||
|
if y < pad:
|
||||||
|
y = pad
|
||||||
|
if y + th > h - pad:
|
||||||
|
y = max(pad, h - pad - th)
|
||||||
|
if x < pad:
|
||||||
|
x = pad
|
||||||
draw.text((x, y), ch, fill=255, font=font)
|
draw.text((x, y), ch, fill=255, font=font)
|
||||||
|
|
||||||
pixels = []
|
pixels = []
|
||||||
|
|
@ -230,7 +241,7 @@ def main():
|
||||||
8: "CHS8Table", 11: "CHS11Table", 12: "CHS12Table",
|
8: "CHS8Table", 11: "CHS11Table", 12: "CHS12Table",
|
||||||
13: "CHS13Table", 15: "CHS15Table", 16: "CHS16Table",
|
13: "CHS13Table", 15: "CHS15Table", 16: "CHS16Table",
|
||||||
}[size]
|
}[size]
|
||||||
font = ImageFont.truetype(medium, size - 1)
|
font = ImageFont.truetype(medium, max(6, size - 2))
|
||||||
|
|
||||||
if table_key not in tables:
|
if table_key not in tables:
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue