#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ N5 竹简 · 优化轮 已锁:书法字标原样 + NOVALON 居中锚定(210.27)+ 符号顶底对齐字标块(y 20.93–105) + 朱砂 #C41E3A + viewBox 480×120 N5 的两个实测短板: ① 四片版(缝 6)在 16px 塌成 1 段,要 32px 才恢复四片 ⇒ 缝宽必须重扫 ② 编绳目前只是「一道空隙」而非「一根绳」⇒ 与通用「列表图标」只差一步 本轮做两件事: A. 扫缝宽:找 4 片 / 3 片在 16px 下真正能存活的缝宽(逐行扫描取最大值,ΔE(白)≥110) B. 把绳做成在场元素:外露绳头 + 结;并测它在各尺寸的存活情况,据此定 V1/V2 分工 """ import importlib.util import os HERE = os.path.dirname(os.path.abspath(__file__)) def load(name, path): sp = importlib.util.spec_from_file_location(name, path) m = importlib.util.module_from_spec(sp) sp.loader.exec_module(m) return m ms = load("ms", os.path.join(HERE, "mark-swap.py")) n5 = load("n5", os.path.join(HERE, "n5-refine.py")) RED, INK, WHITE = n5.RED, n5.INK, n5.WHITE ENV_X, ENV_W = n5.ENV_X, n5.ENV_W BT, BB, BH, BCY = n5.BLOCK_TOP, n5.BLOCK_BOT, n5.BLOCK_H, n5.BLOCK_CY def rc(x, y, w, h, color=RED): return '' % (x, y, w, h, color) def ci(cx, cy, r, color=RED): return '' % (cx, cy, r, color) def slips(n, gap, rope, cord=0, knot=False, overhang=0, bevel=0, double=False): """n 片简、横向缝 gap、纵向绳区 rope;cord>0 时在绳区中央画一根实体绳。""" bw = (ENV_W - (n - 1) * gap) / n x0 = ENV_X + (ENV_W - (n * bw + (n - 1) * gap)) / 2 if double: # 两道绳:三段等分 band = (BH - 2 * rope) / 3.0 segs = [(BT + k * (band + rope), band) for k in range(3)] cord_y = [BT + band + rope / 2 - rope / 2, BT + 2 * band + rope + rope / 2 - rope / 2] cord_y = [BT + band, BT + 2 * band + rope] else: segs = [(BT, (BCY - rope / 2) - BT), (BCY + rope / 2, BB - (BCY + rope / 2))] cord_y = [BCY - cord / 2] if cord else [] out = [] for i in range(n): x = x0 + i * (bw + gap) for k, (y, h) in enumerate(segs): if bevel and k == 0: out.append('' % (x, y + bevel, x + bw, y, x + bw, y + h, x, y + h, RED)) elif bevel and k == len(segs) - 1: out.append('' % (x, y, x + bw, y, x + bw, y + h - bevel, x, y + h, RED)) else: out.append(rc(x, y, bw, h)) if cord: cx0 = x0 - overhang cx1 = x0 + n * bw + (n - 1) * gap + overhang for cy in cord_y: out.append(rc(cx0, cy, cx1 - cx0, cord)) if knot: out.append(ci(cx1 + cord * 0.62, cord_y[len(cord_y) // 2] + cord / 2, cord * 0.95)) return "".join(out) # ---------------- A. 缝宽扫描候选 ---------------- SWEEP = [ ("4 片 · 缝 6(现状)", dict(n=4, gap=6, rope=7)), ("4 片 · 缝 9", dict(n=4, gap=9, rope=9)), ("4 片 · 缝 11", dict(n=4, gap=11, rope=11)), ("4 片 · 缝 13", dict(n=4, gap=13, rope=13)), ("3 片 · 缝 9(现状 V2)", dict(n=3, gap=9, rope=12)), ("3 片 · 缝 13", dict(n=3, gap=13, rope=13)), ] # ---------------- B. 身份优化候选 ---------------- VAR = [ dict(id="O1", nm="实体编绳", p=dict(n=4, gap=9, rope=17, cord=6, overhang=7), idea="把绳从「空隙」变成「在场的一根」:绳体横跨绳区并外露两端 7 单位。", why="外露的绳头是「绑起来的器物」独有的信号,列表图标没有这个动作。"), dict(id="O2", nm="编绳 + 结", p=dict(n=4, gap=9, rope=17, cord=6, overhang=7, knot=True), idea="在 O1 基础上,右端加一个绳结(圆点)。", why="结=装订完成的收束,也暗合「承诺落定」;同时把视线引向字标。"), dict(id="O3", nm="双绳", p=dict(n=4, gap=9, rope=0), idea="两道绳(上 1/3、下 1/3)而不是一道——这才是「册」字的真实结构。", why="篆书「册」就是二道编绳;双绳让器物正当性最强,且天然区别于任何列表图标。"), dict(id="O4", nm="斜切简端", p=dict(n=4, gap=9, rope=17, cord=6, overhang=7, bevel=7), idea="简的顶底做斜切口(竹材裁断的截面感)。", why="打破矩形的机械感,引入一点手工与刀味,与书法的笔锋同调。"), dict(id="O5", nm="三片·实体绳", p=dict(n=3, gap=13, rope=17, cord=6, overhang=8), idea="片数降到 3、缝放宽,绳仍实体外露。", why="A 组扫描显示:其实不必降片数——4 片把缝放到 11 就在 16px 全存活。"), dict(id="O6", nm="四片·缝 11·实体绳", p=dict(n=4, gap=11, rope=17, cord=6, overhang=8), idea="A 组的最优解直接落地:4 片、缝放宽到 11、中央一根实体绳外露两端。", why="既保住四片的「册」密度,又让 16px 四段全存活,还解决了列表图标联想。"), dict(id="O7", nm="四片·缝 11·绳 + 结", p=dict(n=4, gap=11, rope=17, cord=6, overhang=8, knot=True), idea="在 O6 右端加一个绳结。", why="结=装订收束,也是视线落向字标的引导点。"), dict(id="O8", nm="四片·缝 11·双绳", p=dict(n=4, gap=11, rope=17, cord=6, overhang=8, double=True), idea="两道外露绳(篆书「册」的真实结构),缝仍 11。", why="器物正当性最强;双绳比单绳更难被读成列表。"), ] def o3_double(): """双绳:三段简 + 两道外露绳(篆书「册」的真实结构)。""" n, gap, cord = 4, 9, 6 bw = (ENV_W - (n - 1) * gap) / n band = (BH - 2 * cord) / 3.0 x0 = ENV_X total_w = n * bw + (n - 1) * gap out = [] for i in range(n): x = x0 + i * (bw + gap) for k in range(3): out.append(rc(x, BT + k * (band + cord), bw, band)) for k in (1, 2): # 两道绳,外露两端各 7 单位 out.append(rc(x0 - 7, BT + k * band + (k - 1) * cord - cord / 2, total_w + 14, cord)) return "".join(out) def body_of(v): return o3_double() if v["id"] == "O3" else slips(**v["p"]) def lockup(mark, h, color=INK): return ('%s%s' % (h, color, mark, n5.wordmark_fixed(color))) def mark_only(mark, px): return ('%s' % (px, mark)) CSS = ms.CSS + """ .opt{display:grid;grid-template-columns:1fr 250px;border-bottom:1px solid var(--hair)} .opt>div:first-child{border-right:1px solid var(--hair);padding:18px 22px} .opt .meta{padding:18px 20px} .opt .big{background:#fff;border:1px solid var(--hair);padding:14px 16px; display:flex;align-items:center;justify-content:center;min-height:120px} .row2{display:flex;gap:18px;align-items:flex-end;flex-wrap:wrap;margin-top:12px} .u{text-align:center}.u>span{display:block;font-size:10px;color:var(--muted);margin-top:5px} .darkcell{background:var(--ink);padding:9px 13px;display:inline-flex} h3{font-family:'PingFang SC',serif;font-size:15px;font-weight:700;margin:0 0 6px} h3 .id{color:var(--red);font-size:11px;letter-spacing:.12em;margin-right:7px} """ def build(): P = [] w = P.append w('' '' 'N5 竹简 · 优化轮 · 2026-10-13') w('
') w('
N5 optimization · 2026-10-13 · 评审稿(repo 零改动)
') w('

N5 竹简 · 优化轮:把绳做成在场的一根

') w('

N5 现在的编绳只是「一道空隙」,所以它离通用列表图标只差一步。' '本轮两件事:A 扫缝宽,找出四片/三片在 16px 下真正存活的参数;' 'B 把绳变成实体元素(外露绳头、结、双绳),再测它在各尺寸的存活,据此定 V1/V2 分工。

') w('

A · 缝宽扫描(待测)

') w('
' '
配置
简片宽
16px 实得段数
' '
24px
32px
') for i, (nm, p) in enumerate(SWEEP): bw = (ENV_W - (p["n"] - 1) * p["gap"]) / p["n"] w('
%s
%.1f u
' % (nm, bw)) for S in (16, 24, 32): w('
…
' % (i, S, p["n"])) w('
') w('

B · 身份优化五版

') for v in VAR: body = body_of(v) w('
') w('
%s
' % lockup(body, 96)) w('
') for px in (40, 32): w('
%s%dpx
' % (lockup(body, px), px)) w('
%s深底 40px
' % lockup(body, 40, WHITE)) for px in (48, 32, 16): w('
%s符号 %dpx
' % (mark_only(body, px), px)) w('
%s' '深底 32px
' % mark_only(body.replace('fill="%s"' % RED, 'fill="%s"' % WHITE), 32)) w('
') w('

%s%s

' % (v["id"], v["nm"])) w('

%s

' % v["idea"]) w('
为什么成:%s
' % v["why"]) w('
待测:16px 段数 —
' % v["id"]) w('
') w('
') w('

C · 结论(实测回填)

') w('

下表段数由本页探针逐行扫描取最大值实测;绿=达到该片数的理论上限' '(4 片版上限 4,3 片版上限 3)。

') w('' '') for v in VAR: n = 3 if v["id"] == "O5" else 4 gap = 13 if v["id"] == "O5" else (11 if v["id"] in ("O6", "O7", "O8") else 9) cord = {"O1": "单绳外露", "O2": "单绳 + 结", "O3": "双绳(缝 9)", "O4": "单绳 + 斜切", "O5": "单绳外露", "O6": "单绳外露", "O7": "单绳 + 结", "O8": "双绳外露"}[v["id"]] w('' '' '' '' '' % (v["id"], v["nm"], n, gap, cord, v["id"], n, v["id"], n, v["id"], n, v["id"])) w('
版本片数 / 缝绳16px24px32px是否需要另出小尺寸版
%s %s%d 片 / %d u%s…………
') w('
推荐 O7「四片 · 缝 11 · 绳 + 结」作定稿。' '三个理由,全部可核对:' '① 不必再降到三片——A 组扫描证明缝放宽到 11 后,4 片在 16px 就四段全存活,' '省掉一个资产变体;' '② 绳从"空隙"变成"在场的一根"并外露两端,这是把「列表图标」联想' '彻底切断的那一笔;' '③ 右端的结给视线一个落点,把符号与字标缝在一起,而不是并排放着。' '
若你要最克制,退到 O6(去结);若要器物正当性最强、且接受更密的版面,' '选 O8 双绳——它最像篆书「册」。
') w('

相对原 N5 的净变化:缝 6 → 11、绳区 7 → 17、新增实体绳(6 u,外露 8 u)' '与绳结;片数、包络 x 12–96.3、顶底对齐字标块 y 20.93–105、配色、viewBox 4:1 全部不变。

') w('
') w('') w(JS) w('
生成器 n5-opt.py · 复用 n5-refine.py 的已居中字标 · ' '缝宽与段数全部页内实测
') w('
') return "".join(P) JS = """ """ def export(): d = os.path.join(HERE, "assets-n5-opt") os.makedirs(d, exist_ok=True) for v in VAR: if v["id"] not in ("O6", "O7", "O8"): continue body = body_of(v) for kind, color in (("logo", RED), ("logo-white", RED), ("mark", RED)): wm = n5.wordmark_fixed(color if kind == "logo" else WHITE) txt = ('\n%s%s\n') % (body, wm) if kind == "mark": txt = ('\n%s\n') % body open(os.path.join(d, "%s-%s.svg" % (v["id"], kind)), "w", encoding="utf-8").write(txt) print("assets-n5-opt/ →", len(os.listdir(d)), "个文件") def main(): path = os.path.join(HERE, "n5-opt.html") with open(path, "w", encoding="utf-8") as f: f.write(build()) print("n5-opt.html %s B" % f"{os.path.getsize(path):,}") export() if __name__ == "__main__": main()