BRAND-MANUAL.md 收敛识别方案裁定与实测判据;TOKEN-MIGRATION.md 记 P1/P3/P4 迁移面与孪生缺陷; TEST-PATCH.md 记 P7 的 1→0 实测。随包入库的是结论赖以成立的仪器与证据:check-assets、check-manual、 verify-assets-cross、check-wordmark-copies、check-docsync、check-probes(四段闸,每段带能失败的负例)、 check-baseline-shift.cjs(平移感知基线判据,四合成样本两绿两红自测通过;它取代被证伪的 「diff 包围盒不许越页眉带」)与 measured/baseline-shift-p1.json(第一批 104 张逐张分类,带 _src 出处戳)。 大体积工作件不入库:样机 HTML 与栅格截图 100+MB、字体母版 45MB 留在盘上,入库 690 个文本/矢量件。
298 lines
15 KiB
Python
298 lines
15 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
比 N5 更好看?—— 换轴:不动元素数量,动张力与比例
|
||
|
||
已定稿:原始 N5(4 片 · 缝 6 · 绳区 7)。
|
||
已接受的代价:16px 实测段数 1(四片并成一块)⇒ favicon/app icon 需三片版兜底。
|
||
|
||
前五轮的选择暴露的口味是:一个干净动作 + 大量留白 + 实心朱红 + 零附加细节。
|
||
我之前的"优化"都在做加法(绳、结、桥、收分),方向与这个口味相反,被否是应该的。
|
||
|
||
本轮只做加法之外的事——四版全部保持"一个元素",改变的是:
|
||
E1 一相圆:把均匀环换成有粗细呼吸的笔势环(禅圆),治"几何块 vs 毛笔字"两套语言的根病
|
||
E2 偏心印:把居中的白缺口推到下偏左,用不对称产生张力
|
||
E3 弧抱方:N7 的比例修正版——环抱的对象从圆点换成方,圆与方的咬合更紧
|
||
E4 川:三竖不等长不等粗,用疏密与不齐产生节奏(最接近"什么都没做"的一版)
|
||
|
||
量测口径与前几轮完全一致:16/24/32px 逐行红色行程取最大值、512 栅格墨量密度。
|
||
"""
|
||
import importlib.util
|
||
import math
|
||
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
|
||
CX = ENV_X + ENV_W / 2
|
||
|
||
|
||
def rc(x, y, w, h, color=RED):
|
||
return '<rect x="%g" y="%g" width="%g" height="%g" fill="%s"/>' % (x, y, w, h, color)
|
||
|
||
|
||
def poly(pts, color=RED):
|
||
d = "M " + " L ".join("%g %g" % p for p in pts) + " Z"
|
||
return '<path d="%s" fill="%s"/>' % (d, color)
|
||
|
||
|
||
# ---------------- E1 一相圆(笔势环) ----------------
|
||
def enso(r=37, theta0=-58, sweep=322, w0=15.5, w1=4.0, steps=72):
|
||
"""粗细沿弧线性过渡的开口环:起笔粗、收笔细,末端尖。
|
||
用多边形采样构造,保证是实心 path(可转曲、可单色印刷)。"""
|
||
outer, inner = [], []
|
||
a0 = math.radians(theta0)
|
||
for i in range(steps + 1):
|
||
t = i / steps
|
||
ang = a0 + math.radians(sweep) * t
|
||
w = (w0 + (w1 - w0) * t) / 2.0
|
||
cx, cy = CX, BCY
|
||
outer.append((cx + (r + w) * math.cos(ang), cy + (r + w) * math.sin(ang)))
|
||
inner.append((cx + (r - w) * math.sin(ang + math.pi / 2) * 0 +
|
||
(r - w) * math.cos(ang), cy + (r - w) * math.sin(ang)))
|
||
# 首尾封成尖角:起笔端用宽面,收笔端两点重合
|
||
pts = outer + list(reversed(inner))
|
||
pts.append(outer[0])
|
||
return poly(pts[:-1] if pts[-1] == pts[0] else pts)
|
||
|
||
|
||
# ---------------- E2 偏心方印 ----------------
|
||
def e2():
|
||
"""实心朱方,白缺口偏到下偏左——不对称产生张力,且缺口不居中反而像真的印泥缺了一块。"""
|
||
x, y, s = ENV_X + 0.15, BT, 84
|
||
nx, ny, ns = x + 15, y + 44, 27
|
||
d = ('M %g %g h %g v %g h %g Z '
|
||
'M %g %g h %g v %g h %g Z' % (x, y, s, s, -s, nx, ny, ns, ns, -ns))
|
||
return '<path d="%s" fill="%s" fill-rule="evenodd"/>' % (d, RED)
|
||
|
||
|
||
# ---------------- E3 弧抱方 ----------------
|
||
def e3():
|
||
"""N7 的比例修正:环抱的对象从圆点换成方,方圆咬合;开口朝右上。"""
|
||
r, sw = 33, 12
|
||
a0, a1 = math.radians(-52), math.radians(52 + 250)
|
||
pts = []
|
||
steps = 60
|
||
for i in range(steps + 1):
|
||
ang = a0 + (a1 - a0) * i / steps
|
||
pts.append((CX + (r + sw / 2) * math.cos(ang), BCY + (r + sw / 2) * math.sin(ang)))
|
||
for i in range(steps, -1, -1):
|
||
ang = a0 + (a1 - a0) * i / steps
|
||
pts.append((CX + (r - sw / 2) * math.cos(ang), BCY + (r - sw / 2) * math.sin(ang)))
|
||
ring = poly(pts)
|
||
# 被抱住的方:放在开口方向,尺寸取环内空的 1/3
|
||
q = 21
|
||
qx, qy = CX + 6, BCY - q / 2
|
||
return ring + rc(qx, qy, q, q)
|
||
|
||
|
||
# ---------------- E4 川 ----------------
|
||
def e4():
|
||
"""三竖不等长不等粗、大疏密——最接近"什么都没做"的一版。"""
|
||
bars = [(ENV_X + 0.15, BT + 0.0, 15.0, BH * 0.72),
|
||
(ENV_X + 29.5, BT + 13.0, 10.5, BH * 0.86),
|
||
(ENV_X + 55.0, BT + 0.0, 17.5, BH * 0.62)]
|
||
return "".join(rc(x, y, w, h) for x, y, w, h in bars)
|
||
|
||
|
||
ITEMS = [
|
||
dict(id="E1", nm="一相圆", body=enso,
|
||
axis="笔势",
|
||
idea="把 N7 那种均匀环换成有粗细呼吸的开口环:起笔厚、收笔薄并收成尖。",
|
||
why="这是唯一直接治「几何块配毛笔字=两套语言」这个根病的做法——环本身就像一只手写的。",
|
||
risk="72 段采样,转曲后要检查节点数;收笔尖在 16px 下会先消失。"),
|
||
dict(id="E2", nm="偏心方印", body=e2,
|
||
axis="张力",
|
||
idea="实心朱方,白缺口不居中,推到下偏左。",
|
||
why="居中是安全也是无聊。偏心让方印有了方向感,也留下「被人用过」的痕迹,"
|
||
"同时保住 N1 那种器物正当性。",
|
||
risk="缺口位置需人工定夺,差 3 单位观感就差很多,是四版里最吃手艺的。"),
|
||
dict(id="E3", nm="弧抱方", body=e3,
|
||
axis="比例",
|
||
idea="N7 环抱的比例修正版:环的开口朝右上,被抱的从圆点换成方。",
|
||
why="圆与方的咬合比圆与圆更有内容(外圆内方那条线),"
|
||
"开口方向与阅读方向一致。",
|
||
risk="两个元素,比 E1/E2/E4 多一步;且与 N7 太近,可能被视为「又改了一点」。"),
|
||
dict(id="E4", nm="川", body=e4,
|
||
axis="疏密",
|
||
idea="三竖,不等长不等粗,间距放松。",
|
||
why="最安静的一版。它几乎不做任何动作,只靠三条线自己的疏密站着——"
|
||
"如果你要的是「耐看」而不是「有意思」,就是它。",
|
||
risk="三竖的不齐如果控制不好会像没排齐;且与 N5 同族,可能显得「还没走远」。"),
|
||
]
|
||
|
||
|
||
def lockup(mark, h, color=INK):
|
||
return ('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 120" '
|
||
'style="height:%dpx;width:auto;display:block;color:%s" role="img" '
|
||
'aria-label="睿新致远 NOVALON">%s%s</svg>' % (h, color, mark, n5.wordmark_fixed(color)))
|
||
|
||
|
||
def mark_only(mark, px):
|
||
return ('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 120" '
|
||
'style="height:%dpx;width:auto;display:block">%s</svg>' % (px, mark))
|
||
|
||
|
||
CSS = ms.CSS + """
|
||
.be{display:grid;grid-template-columns:1fr 250px;border-bottom:1px solid var(--hair)}
|
||
.be>div:first-child{border-right:1px solid var(--hair);padding:18px 22px}
|
||
.be .big{background:#fff;border:1px solid var(--hair);padding:14px 16px;display:flex;
|
||
align-items:center;justify-content:center;min-height:112px}
|
||
.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 4px}
|
||
h3 .id{color:var(--red);font-size:11px;letter-spacing:.12em;margin-right:7px}
|
||
.axis{font-size:10.5px;letter-spacing:.1em;color:var(--muted);border:1px solid var(--hair);
|
||
padding:2px 8px;margin-left:6px;vertical-align:2px}
|
||
"""
|
||
|
||
JS = """
|
||
<script>
|
||
const RED=[196,30,58],WHITE=[255,255,255],INK=[10,14,20];
|
||
const D=(a,b)=>Math.hypot(a[0]-b[0],a[1]-b[1],a[2]-b[2]);
|
||
function raster(el,size){
|
||
const c=el.cloneNode(true);c.setAttribute('width',size);c.setAttribute('height',size);
|
||
c.removeAttribute('style');
|
||
const url='data:image/svg+xml;charset=utf-8,'+encodeURIComponent(new XMLSerializer().serializeToString(c));
|
||
return new Promise(res=>{const im=new Image();im.onload=()=>{
|
||
const cv=document.createElement('canvas');cv.width=cv.height=size;
|
||
const x=cv.getContext('2d');x.fillStyle='#fff';x.fillRect(0,0,size,size);
|
||
x.drawImage(im,0,0,size,size);res(x.getImageData(0,0,size,size));};
|
||
im.onerror=()=>res(null);im.src=url;});
|
||
}
|
||
async function stats(el,size){
|
||
const im=await raster(el,size); if(!im) return null;
|
||
const d=im.data,W=im.width,H=im.height;
|
||
let best=0,inked=0,minx=W,maxx=0,miny=H,maxy=0;
|
||
for(let y=0;y<H;y++){let n=0,on=false;
|
||
for(let x=0;x<W;x++){const i=(y*W+x)*4,a=d[i+3],p=[d[i],d[i+1],d[i+2]];
|
||
const ink=a>=40&&D(p,WHITE)>=110, r=ink&&D(p,RED)<D(p,INK);
|
||
if(r&&!on){n++;on=true;}else if(!r)on=false;
|
||
if(ink){inked++;if(x<minx)minx=x;if(x>maxx)maxx=x;if(y<miny)miny=y;if(y>maxy)maxy=y;}}
|
||
if(n>best)best=n;}
|
||
return {runs:best, density:inked/(((maxx-minx+1)*(maxy-miny+1))||1)};
|
||
}
|
||
(async()=>{
|
||
const out={};
|
||
for(const el of document.querySelectorAll('svg[data-src]')){
|
||
const k=el.getAttribute('data-src');out[k]={};
|
||
for(const S of [16,24,32]) out[k][S]=await stats(el,S);
|
||
out[k].dense=await stats(el,512);
|
||
}
|
||
document.querySelectorAll('[data-r]').forEach(td=>{
|
||
const [k,S]=td.getAttribute('data-r').split('@'); const o=out[k]&&out[k][S];
|
||
if(o) td.textContent=o.runs;});
|
||
document.querySelectorAll('[data-d]').forEach(td=>{
|
||
const o=out[td.getAttribute('data-d')];
|
||
if(o&&o.dense) td.textContent=(o.dense.density*100).toFixed(1)+'%';});
|
||
window.__be=out;
|
||
})();
|
||
</script>
|
||
"""
|
||
|
||
|
||
def build():
|
||
P = []
|
||
w = P.append
|
||
w('<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8">'
|
||
'<meta name="viewport" content="width=device-width,initial-scale=1">'
|
||
'<title>比 N5 更好看?· 换轴:张力与比例 · 2026-10-13</title>')
|
||
w('<style>' + CSS.replace("__GEIST__", ms.GEIST_B64) + '</style></head><body><div class="wrap">')
|
||
w('<header class="top"><div class="eyebrow">Beauty, on a different axis · 2026-10-13</div>')
|
||
w('<h1>比 N5 更好看?<em>不动元素数量,动张力与比例</em></h1>')
|
||
w('<p class="lede">N5 已定稿保留。这一页不再给"四片 + 一道空"加任何东西,'
|
||
'而是换一条审美的轴:笔势、张力、比例、疏密。四版全部保持一个元素、大量留白、实心朱红'
|
||
'——这是你五轮选择里一致暴露出的口味。量测口径与前几轮完全一致,便于直接对比。</p>')
|
||
w('<div class="note"><b>先记下 N5 定稿的取舍:</b>缝 6 意味着 16px 实测段数为 1'
|
||
'(四片并成一块)。所以 favicon / app icon 必须用三片版兜底,'
|
||
'或接受标签页上是一枚红方块。这是主动选择,不是疏漏,要写进规格。</div>')
|
||
|
||
# 基准 N5
|
||
w('<section class="band"><h2 class="band">基准与四版</h2>')
|
||
w('<div class="be"><div><div class="big">%s</div>' % lockup(n5.V1, 96))
|
||
w('<div class="row2">')
|
||
for px in (40, 32):
|
||
w('<div class="u">%s<span>%dpx</span></div>' % (lockup(n5.V1, px), px))
|
||
w('<div class="u"><span class="darkcell">%s</span><span>深底 40px</span></div>'
|
||
% lockup(n5.V1, 40, WHITE))
|
||
for px in (32, 16):
|
||
w('<div class="u">%s<span>%dpx</span></div>' % (mark_only(n5.V1, px), px))
|
||
w('</div></div><div class="meta"><h3><span class="id">基准</span>原始 N5<span class="axis">已定稿</span></h3>')
|
||
w('<div class="small">16px <b data-r="n5@16">…</b> · 24px <b data-r="n5@24">…</b> · '
|
||
'32px <b data-r="n5@32">…</b> · 墨量 <b data-d="n5">…</b></div>')
|
||
w('<div class="why">四片、缝 6、绳区 7(纯空隙)。干净、安静、一个动作。</div>')
|
||
w('</div></div>')
|
||
|
||
for it in ITEMS:
|
||
body = it["body"]()
|
||
w('<div class="be"><div>')
|
||
w('<div class="big">%s</div>' % lockup(body, 96))
|
||
w('<div class="row2">')
|
||
for px in (40, 32):
|
||
w('<div class="u">%s<span>%dpx</span></div>' % (lockup(body, px), px))
|
||
w('<div class="u"><span class="darkcell">%s</span><span>深底 40px</span></div>'
|
||
% lockup(body, 40, WHITE))
|
||
for px in (32, 16):
|
||
w('<div class="u">%s<span>%dpx</span></div>' % (mark_only(body, px), px))
|
||
w('<div class="u"><span class="darkcell" style="padding:8px">%s</span><span>深底 32px</span></div>'
|
||
% mark_only(body.replace('fill="%s"' % RED, 'fill="%s"' % WHITE), 32))
|
||
w('</div></div>')
|
||
w('<div class="meta"><h3><span class="id">%s</span>%s<span class="axis">%s</span></h3>'
|
||
% (it["id"], it["nm"], it["axis"]))
|
||
w('<p style="font-family:PingFang SC,serif;font-size:13px;margin:6px 0">%s</p>' % it["idea"])
|
||
w('<div class="why"><b>为什么可能更好看</b>:%s</div>' % it["why"])
|
||
w('<div class="risk"><b>代价</b>:%s</div>' % it["risk"])
|
||
w('<div class="small" style="margin-top:8px">16px <b data-r="%s@16">…</b> · '
|
||
'24px <b data-r="%s@24">…</b> · 32px <b data-r="%s@32">…</b> · 墨量 <b data-d="%s">…</b></div>'
|
||
% (it["id"], it["id"], it["id"], it["id"]))
|
||
w('</div></div>')
|
||
|
||
w('<section class="band"><h2 class="band">还有一条我没做、但可能才是"好看"的关键</h2>')
|
||
w('<p>这四版仍然是<b>程序生成的规则几何</b>。真正让 Bain、保时捷、中国银行那些标识耐看的,'
|
||
'是<b>手工光学修正</b>:竖画比横画细一点、圆比方大一点(视觉错觉补偿)、'
|
||
'相邻笔画共享的空白要比孤立空白窄一点。这些修正每项只有 1–3%,'
|
||
'叠起来就是"说不上来但就是舒服"。</p>')
|
||
w('<div class="note">我可以用代码做到近似(比如给 E4 的三竖做横竖不等粗补偿),'
|
||
'但<b>真正的最后 5% 需要设计师手动描</b>,或者用一套可自由转曲的中文字体'
|
||
'(思源黑体/宋体,OFL 授权)先定字形再修。这一步不做,'
|
||
'无论选哪一版,它都会停在"很好"而不是"漂亮"。</div>')
|
||
w('</section>')
|
||
|
||
w('<div style="position:absolute;width:0;height:0;overflow:hidden" aria-hidden="true">')
|
||
w('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 120" width="108" height="120" '
|
||
'data-src="n5">%s</svg>' % n5.V1)
|
||
for it in ITEMS:
|
||
w('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 120" width="108" height="120" '
|
||
'data-src="%s">%s</svg>' % (it["id"], it["body"]()))
|
||
w('</div>')
|
||
w(JS)
|
||
w('<footer>生成器 <code>beauty.py</code> · 复用 <code>n5-refine.py</code> 的已居中字标 · '
|
||
'量测口径与 n5-opt / n5-bare 一致,可直接横向比较</footer>')
|
||
w('</div></body></html>')
|
||
return "".join(P)
|
||
|
||
|
||
def main():
|
||
path = os.path.join(HERE, "beauty.html")
|
||
with open(path, "w", encoding="utf-8") as f:
|
||
f.write(build())
|
||
print("beauty.html %s B" % f"{os.path.getsize(path):,}")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|