Fix TAB missing glyphs and tighten mode-page typography.

Use size-12 tabs with full 节/类/型/地/目 coverage, denser MiSans bitmaps, dark row chrome, and safer section-label draw order; skip ASCII regen by default.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yuquanjun 2026-09-03 09:19:29 +08:00
parent c8e32958a7
commit 65f38bb5a3
5 changed files with 840 additions and 833 deletions

View File

@ -35,10 +35,10 @@ GUI_SWITCH ParamGuiData[] =
const LEBEL_UI UI_Label[] = {
{13, 102, 48, 55, (const uint8_t*)"\xD2\xC6\xB5\xF7", LCD_ALIGN_CENTER, WHITE,BLACK,12, LCD_ALIGN_CENTER,WHITE,BLACK,16, GUI_TRANSPOSE},
{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, 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},
/* 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},
{13, 215, 105,54, (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, 164,46, (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},
/* 0902/0819演奏段落 — 与上一行拉开间距,避免顶边被盖住 */
{13, 215, 218,50, (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},
};
@ -60,20 +60,20 @@ const Touch_AreaTypeDef Touch_Areas[] =
{ 126, 176, 48, 102, -1, 0, GUI_SPEED, NULL },
{ 177, 226, 48, 102, 1, 0, GUI_SPEED, NULL },
{ 12, 66, 100, 129, 0, 0, GUI_AUTOBAND_SW, NULL },
{ 72, 127, 100, 129, 0, 1, GUI_AUTOBAND_SW, NULL },
{ 12, 79, 100, 129, 0, 0, GUI_AUTOBAND_SW, NULL },
{ 84, 151, 100, 129, 0, 1, GUI_AUTOBAND_SW, NULL },
{ 13, 120, 130, 163, -1, 0, GUI_MODE_PARAM, NULL },
{ 121, 227, 130, 163, 1, 0, GUI_MODE_PARAM, NULL },
{ 13, 120, 132, 166, -1, 0, GUI_MODE_PARAM, NULL },
{ 121, 227, 132, 166, 1, 0, GUI_MODE_PARAM, NULL },
{ 13, 120, 168, 214, -1, 0, GUI_TIMBRE_SELECT, NULL },
{ 121, 227, 168, 214, 1, 0, GUI_TIMBRE_SELECT, NULL },
{ 13, 120, 172, 214, -1, 0, GUI_TIMBRE_SELECT, NULL },
{ 121, 227, 172, 214, 1, 0, GUI_TIMBRE_SELECT, NULL },
/* 演奏段落 1~4 */
{ 12, 58, 225, 268, 0, 0, GUI_PLAY_SECTION, NULL },
{ 69, 114, 225, 268, 0, 1, GUI_PLAY_SECTION, NULL },
{ 125, 171, 225, 268, 0, 2, GUI_PLAY_SECTION, NULL },
{ 182, 228, 225, 268, 0, 3, GUI_PLAY_SECTION, NULL },
{ 12, 58, 232, 272, 0, 0, GUI_PLAY_SECTION, NULL },
{ 69, 114, 232, 272, 0, 1, GUI_PLAY_SECTION, NULL },
{ 125, 171, 232, 272, 0, 2, GUI_PLAY_SECTION, NULL },
{ 182, 228, 232, 272, 0, 3, GUI_PLAY_SECTION, NULL },
/* 底栏 TAB万能/普通/专业/设置Value=目标 TAB */
{ 0, 79, 280, 319, 0, 0, GUI_NAV_BAR, NULL },

View File

@ -7,15 +7,15 @@ static uint8_t Speed[6] = {0xF0, 0x51, 0x03, 0x00, 0x00, 0xF7};
void Draw_Tab_Mode_Menu(const LEBEL_UI *UI, GUI_SWITCH *Group)
{
/* 0902 TAB ≈55×18四字用 11 号居中并左右留白,避免圆角/底边裁切笔画 */
const uint16_t tab_w = 55;
const uint16_t tab_h = 18;
/* 四字 TAB用 12 号(字库齐全)+ 加宽,避免缺字/裁切 */
const uint16_t tab_w = 68;
const uint16_t tab_h = 22;
const uint8_t tab_r = 6;
const uint8_t tab_font = 11;
const uint8_t tab_font = 12;
const uint16_t start_x = 12;
const uint16_t start_y = UI->y + 3;
const uint16_t start_y = UI->y + 1;
const uint16_t text_y = start_y + (tab_h - tab_font) / 2;
const uint16_t inset = 3;
const uint16_t inset = 6;
uint16_t color_sel_bg = COLOR_GRAD_MID;
uint16_t color_unsel_bg = COLOR_NORMAL_BG;
uint16_t color_text = UI->Text_fc;
@ -23,28 +23,28 @@ void Draw_Tab_Mode_Menu(const LEBEL_UI *UI, GUI_SWITCH *Group)
if(Group->Current == 1)
{
LCD_FillRoundRect(start_x, start_y, 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_FillRoundRect(start_x+tab_w +4, start_y, tab_w, tab_h, tab_r, color_sel_bg);
LCD_ShowChinese_AutoAlign(
start_x + inset, start_x + tab_w - inset, text_y,
(const uint8_t*)"\xBD\xDA\xD7\xE0\xC0\xE0\xD0\xCD",
LCD_ALIGN_CENTER, color_text, color_unsel_bg, 0, tab_font);
LCD_ShowChinese_AutoAlign(
start_x + tab_w + 5 + inset, start_x + tab_w + 5 + tab_w - inset, text_y,
start_x + tab_w + 4 + inset, start_x + tab_w + 4 + tab_w - inset, text_y,
(const uint8_t *)"\xB1\xBE\xB5\xD8\xC7\xFA\xC4\xBF",
LCD_ALIGN_CENTER, color_text, color_sel_bg, 0, tab_font);
}
else
{
LCD_FillRoundRect(start_x, start_y, 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_FillRoundRect(start_x+tab_w +4, start_y, tab_w, tab_h, tab_r, color_unsel_bg);
LCD_ShowChinese_AutoAlign(
start_x + inset, start_x + tab_w - inset, text_y,
(const uint8_t*)"\xBD\xDA\xD7\xE0\xC0\xE0\xD0\xCD",
LCD_ALIGN_CENTER, color_text, color_sel_bg, 0, tab_font);
LCD_ShowChinese_AutoAlign(
start_x + tab_w + 5 + inset, start_x + tab_w + 5 + tab_w - inset, text_y,
start_x + tab_w + 4 + inset, start_x + tab_w + 4 + tab_w - inset, text_y,
(const uint8_t *)"\xB1\xBE\xB5\xD8\xC7\xFA\xC4\xBF",
LCD_ALIGN_CENTER, color_text, color_unsel_bg, 0, tab_font);
}

View File

@ -147,16 +147,10 @@ uint8_t UI_IsFocused(uint8_t widget_id)
void UI_GetFocusGrad(uint8_t widget_id, uint16_t *c_top, uint16_t *c_bot)
{
if (UI_IsFocused(widget_id))
{
*c_top = START_COLOR;
*c_bot = END_COLOR;
}
else
{
*c_top = COLOR_NORMAL_BG;
*c_bot = COLOR_NORMAL_BG;
}
/* 0902行背景保持深色选中态由 TAB/段落按钮自身高亮,避免整行变蓝 */
(void)widget_id;
*c_top = UI0902_ROW_BG;
*c_bot = UI0902_ROW_BG;
}
uint8_t UI_SetFocus(uint8_t widget_id)
@ -300,7 +294,7 @@ void show_Param(const LEBEL_UI *UI, GUI_SWITCH *Group)
{
char Textstr_new[40] = {0};
char NumBuf[8] = {0};
uint16_t text_y = UI->y + 25+5+5;
uint16_t text_y = UI->y + 28;
uint8_t idx = Group->Current + 1;
uint16_t c_top, c_bot;
@ -653,8 +647,8 @@ void label_TimbreSelece_ui(const LEBEL_UI *UI, GUI_SWITCH * Group)
UI->p,
UI->Tab_Align,
UI->Tab_fc,
BLACK,
0,
UI0902_BG_COLOR,
1,
UI->Tab_size
);
LCD_DrawChevron_Left(UI->x + 15, UI->y + 35, 7, 2, WHITE);
@ -695,7 +689,9 @@ void label_TimbreSelece_ui(const LEBEL_UI *UI, GUI_SWITCH * Group)
}
void label_PlaySection_ui(const LEBEL_UI *UI,GUI_SWITCH * Group)
{
/* 标签与下方段落按钮留足间距,避免底边笔画被按钮底盖住 */
/* 先画按钮,再画标签,避免色块盖住「演奏段落」 */
Draw_Tab_Section_Menu(UI,(TAB_SECTION_INDEX)Group->Current);
LCD_FillByColor(UI->x, UI->y, UI->x + UI->w, UI->y + 16, UI0902_BG_COLOR);
LCD_ShowChinese_AutoAlign(
UI->x,
UI->x+UI->w,
@ -703,11 +699,10 @@ void label_PlaySection_ui(const LEBEL_UI *UI,GUI_SWITCH * Group)
UI->p,
UI->Tab_Align,
UI->Tab_fc,
UI->Tab_bc,
0,
UI0902_BG_COLOR,
1,
UI->Tab_size
);
Draw_Tab_Section_Menu(UI,(TAB_SECTION_INDEX)Group->Current);
}
void Draw_Bottom_Bar(uint8_t sel, uint8_t first_back)
@ -749,7 +744,7 @@ void Draw_Tab_Section_Menu(const LEBEL_UI *UI, TAB_SECTION_INDEX select_tab)
const uint8_t tab_r = 5;
const uint8_t pitch = 57;
const uint16_t start_x = 12;
const uint16_t start_y = UI->y + 19;
const uint16_t start_y = UI->y + 22;
const uint16_t text_y = start_y + 11;
const char *nums[4] = {"1", "2", "3", "4"};
uint8_t i;

File diff suppressed because it is too large Load Diff

View File

@ -47,37 +47,33 @@ def gbk_char(h, l):
def render_glyph(ch, size, font, square=True):
"""Rasterize into size×size with 1px margin so CJK strokes are not clipped."""
"""Rasterize CJK into size×size; tight vertical fit, 1px margin."""
if square:
w = h = size
else:
w = size // 2
h = size
img = Image.new("L", (w, h), 0)
draw = ImageDraw.Draw(img)
pad = 1 if size >= 10 else 0
# Render oversized then crop-scale into target for denser strokes
scale = 4
big = Image.new("L", (w * scale, h * scale), 0)
draw = ImageDraw.Draw(big)
bbox = draw.textbbox((0, 0), ch, font=font)
tw = bbox[2] - bbox[0]
th = bbox[3] - bbox[1]
inner_w = max(1, w - 2 * pad)
inner_h = max(1, h - 2 * pad)
tw = max(1, bbox[2] - bbox[0])
th = max(1, bbox[3] - bbox[1])
# Fit into (size-2)*scale with 1px*scale margin
pad = scale
inner_w = w * scale - 2 * pad
inner_h = h * scale - 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)
img = big.resize((w, h), Image.Resampling.LANCZOS)
pixels = []
for row in range(h):
for col in range(w):
pixels.append(1 if img.getpixel((col, row)) > 127 else 0)
pixels.append(1 if img.getpixel((col, row)) > 90 else 0)
return pixels, w, h
@ -241,7 +237,8 @@ def main():
8: "CHS8Table", 11: "CHS11Table", 12: "CHS12Table",
13: "CHS13Table", 15: "CHS15Table", 16: "CHS16Table",
}[size]
font = ImageFont.truetype(medium, max(6, size - 2))
# Point size ≈ cell; supersampled in render_glyph
font = ImageFont.truetype(medium, max(8, size + 2) * 4)
if table_key not in tables:
continue
@ -270,7 +267,12 @@ def main():
with open(HEADER_OUT, "w", encoding="utf-8", newline="\n") as f:
f.write(text)
# English / ASCII fonts
# English / ASCII默认跳过避免破坏已校准的数字字模需要时传 --ascii
if "--ascii" not in sys.argv:
print("Skip English fonts (pass --ascii to regenerate).")
print("Done.")
return
with open(ENG_HEADER_IN, "r", encoding="utf-8", errors="replace") as f:
eng = f.read()