Files
novalon-website/deliverables/logo-redesign-2026-10-13/brush-family.py
T
zhangxiang a57826f710 docs(brand): 品牌全案手册与落库证据入库(判据、门禁、负例都在场)
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 个文本/矢量件。
2026-10-16 19:23:28 +08:00

348 lines
16 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
一笔家族 —— E1 圆相之外的同路候选
用户裁定:N5-b 出局(N5 只留定稿矩形);并问"除了一相圆还有别的吗"。
从 E1 被选中反推的口味特征(这一族全部满足):
· 一笔写成,不是零件拼装
· 轻(E1 墨量 34.5%,对比 N5 的 70.9%)
· 有笔意,但不写具体的字
· 连续形 ⇒ 小尺寸下缝隙消失也不会读错
本文件只换"中心线",笔势机器(宽度轮廓 + 法向偏移)完全复用,
因此六版之间的差别是纯粹的手势差别,不是工艺差别。
候选:点 / 一 / 掠 / 螺旋 / 波,外加 E1 圆相与 N5 定稿作参照。
"""
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"))
en = load("en", os.path.join(HERE, "enso-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 interp(prof, t):
for (a, va), (b, vb) in zip(prof, prof[1:]):
if a <= t <= b:
k = 0 if b == a else (t - a) / (b - a)
return va + (vb - va) * k
return prof[-1][1]
def densify(pts, n=120):
"""按弧长等距重采样,保证宽度变化与速度无关。"""
seg, acc = [], [0.0]
total = 0.0
for a, b in zip(pts, pts[1:]):
d = math.hypot(b[0] - a[0], b[1] - a[1])
total += d
seg.append(d)
acc.append(total)
out = []
for i in range(n + 1):
target = total * i / n
k = 1
while k < len(acc) - 1 and acc[k] < target:
k += 1
a, b = pts[k - 1], pts[k]
span = seg[k - 1] or 1.0
u = (target - acc[k - 1]) / span
out.append((a[0] + (b[0] - a[0]) * u, a[1] + (b[1] - a[1]) * u))
return out
def curve(pts, samples=60, bulge=0.0):
"""折线 → 带轻微弧度的平滑中心线(贝塞尔采样)。"""
if bulge == 0.0:
return pts
a, b = pts[0], pts[-1]
mx, my = (a[0] + b[0]) / 2, (a[1] + b[1]) / 2
dx, dy = b[0] - a[0], b[1] - a[1]
L = math.hypot(dx, dy) or 1.0
cx, cy = mx - dy / L * bulge, my + dx / L * bulge # 法向外推的控制点
out = []
for i in range(samples + 1):
t = i / samples
x = (1 - t) ** 2 * a[0] + 2 * (1 - t) * t * cx + t ** 2 * b[0]
y = (1 - t) ** 2 * a[1] + 2 * (1 - t) * t * cy + t ** 2 * b[1]
out.append((x, y))
return out
def stroke(center, prof, W, steps=90):
"""沿中心线做宽度轮廓偏移,生成实心闭合 path(可转曲、可单色)。"""
pts = densify(center, steps)
left, right = [], []
for i, (x, y) in enumerate(pts):
p0 = pts[max(i - 1, 0)]
p1 = pts[min(i + 1, len(pts) - 1)]
tx, ty = p1[0] - p0[0], p1[1] - p0[1]
L = math.hypot(tx, ty) or 1.0
nx, ny = -ty / L, tx / L
hw = W * interp(prof, i / steps) / 2.0
left.append((x + nx * hw, y + ny * hw))
right.append((x - nx * hw, y - ny * hw))
d = "M " + " L ".join("%g %g" % p for p in left + list(reversed(right))) + " Z"
return '<path d="%s" fill="%s"/>' % (d, RED)
# ---------------------------------------------------------------------------
P_DOT = [(0.00, 0.12), (0.16, 0.80), (0.44, 1.00), (0.78, 0.78), (0.95, 0.34), (1.00, 0.16)]
P_HENG = [(0.00, 0.28), (0.10, 1.00), (0.52, 0.94), (0.88, 0.82), (1.00, 0.30)]
P_LUE = [(0.00, 0.42), (0.12, 1.00), (0.46, 0.74), (0.80, 0.28), (1.00, 0.03)]
P_SPIRAL = [(0.00, 0.30), (0.14, 1.00), (0.70, 0.82), (0.94, 0.30), (1.00, 0.12)]
P_WAVE = [(0.00, 0.22), (0.10, 1.00), (0.32, 0.42), (0.56, 0.98),
(0.80, 0.38), (0.96, 0.70), (1.00, 0.10)]
def g_dot():
return stroke(curve([(CX - 15, BCY - 17), (CX + 15, BCY + 17)], bulge=-9), P_DOT, 42)
def g_heng():
return stroke(curve([(ENV_X + 1, BCY + 4), (ENV_X + ENV_W - 1, BCY - 4)], bulge=-5),
P_HENG, 16)
def g_lue():
return stroke(curve([(ENV_X + 4, BB - 2), (ENV_X + ENV_W - 2, BT + 2)], bulge=-16),
P_LUE, 23)
def g_spiral():
pts = []
turns = 1.62
for i in range(150):
t = i / 149
ang = math.radians(-60) + t * turns * 2 * math.pi
r = 5 + t * 34
pts.append((CX + r * math.cos(ang), BCY + r * math.sin(ang)))
return stroke(pts, P_SPIRAL, 13)
def g_wave():
pts = [(ENV_X, BCY + 10), (ENV_X + ENV_W * 0.30, BCY - 13),
(ENV_X + ENV_W * 0.62, BCY + 12), (ENV_X + ENV_W, BCY - 11)]
return stroke(curve(pts, samples=90), P_WAVE, 14)
Sweep = 320.0
End = 270.0 + (360.0 - Sweep) / 2.0
E1_BODY = en.enso(prof=en.BRUSH, ecc=0.028, ephi=24.0, theta0=End - Sweep, sweep=Sweep)
ITEMS = [
dict(id="B1", nm="点 · 侧", body=g_dot, ref="书法第一笔「侧」/句读的一点",
line="一墨落地,起收分明。最小的书写单位,也是「答案先行」最直白的图形。",
risk="太接近一个句点或弹孔,独占性靠比例;单独放在深底上可能像未加载完。"),
dict(id="B2", nm="一 · 横", body=g_heng, ref="「道生一」/纲领线",
line="一道横画,起笔顿、行笔匀、收笔回。一字即纲领,也最接近「底线」的账本语言。",
risk="横画在 header 里容易被读成一条下划线或分隔线,脱离字标独立使用时最弱。"),
dict(id="B3", nm="掠 · 上扬", body=g_lue, ref="书法的「撇/掠」/上行折线",
line="从左下扫向右上的一记长笔,起笔厚重、收笔出锋。方向即语义:向上、致远。",
risk="斜向单笔画是最常见的「科技感」母题之一,撞形风险高于其余四版。"),
dict(id="B4", nm="螺旋", body=g_spiral, ref="一笔盘绕/生生不息",
line="一笔画出 1.6 圈,由内向外扩张——陪跑、迭代、持续放大。",
risk="小尺寸下圈与圈之间会并成实心饼;且螺旋有「加载中」的既视感。"),
dict(id="B5", nm="一波三折", body=g_wave, ref="书法行笔口诀/川水",
line="一道横出的波势,中段两次顿挫——「一波三折」既是笔法也是项目叙事。",
risk="最容易读成「波浪线/签名」,且横向构图与字标抢宽度。"),
dict(id="E1", nm="一相圆(参照)", body=lambda: E1_BODY, ref="禅圆/提笔未合",
line="已在入围名单上。此处只作同族对照,不重新讨论。", risk="—"),
dict(id="N5", nm="竹简定稿(参照)", body=lambda: n5.V1, ref="简册/编绳",
line="已在入围名单上。墨量与线数与一笔族差异明显,正好作参照。", risk="—"),
]
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 256px;border-bottom:1px solid var(--hair)}
.be>div:first-child{border-right:1px solid var(--hair);padding:16px 20px}
.be .big{background:#fff;border:1px solid var(--hair);padding:12px 16px;display:flex;
align-items:center;justify-content:center;min-height:104px}
.row2{display:flex;gap:16px;align-items:flex-end;flex-wrap:wrap;margin-top:10px}
.u{text-align:center}.u>span{display:block;font-size:10px;color:var(--muted);margin-top:5px}
.darkcell{background:var(--ink);padding:8px 12px;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}
.ref{font-size:11.5px;color:var(--muted);font-family:'PingFang SC',serif}
"""
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,envView){
const c=el.cloneNode(true);c.setAttribute('width',size);c.setAttribute('height',size);
c.removeAttribute('style');
if(envView)c.setAttribute('viewBox',envView); // 精确框住包络 ⇒ 密度=红占包络面积
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,envView){
const im=await raster(el,size,envView); if(!im) return null;
const d=im.data,W=im.width,H=im.height;
let inked=0,minx=W,maxx=0,miny=H,maxy=0;
for(let y=0;y<H;y++)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]];
if(a>=40&&D(p,WHITE)>=110){inked++;if(x<minx)minx=x;if(x>maxx)maxx=x;if(y<miny)miny=y;if(y>maxy)maxy=y;}}
return {density:inked/(((maxx-minx+1)*(maxy-miny+1))||1),
bbox:[maxx-minx+1,maxy-miny+1]};
}
const ENV='12 20.93 84.3 84.07'; // 符号包络,与生成器同源
(async()=>{
const out={};
for(const el of document.querySelectorAll('svg[data-src]')){
const k=el.getAttribute('data-src');
out[k]={d:await stats(el,512,ENV), s:await stats(el,16)};
}
document.querySelectorAll('[data-m]').forEach(td=>{
const [k,f]=td.getAttribute('data-m').split('@'); const o=out[k]; if(!o) return;
if(f==='d') td.textContent=(o.d.density*100).toFixed(1)+'%';
if(f==='bbox') td.textContent=o.d.bbox.join('×');
if(f==='small'){ // 16px 下是否仍读得出:用非白覆盖率作退化指标
td.textContent=o.s? (o.s.density*100).toFixed(0)+'%':'';}
});
window.__bf=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>一笔家族 · E1 之外的同路候选 · 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">One-stroke family · 2026-10-13 · 评审稿(repo 零改动)</div>')
w('<h1>一笔家族:<em>圆相之外的五记手势</em></h1>')
w('<p class="lede">从 E1 被选中反推你的口味:一笔写成、轻、有笔意但不写字、连续形不怕小尺寸。'
'这一页只换中心线,笔势机器(宽度轮廓 + 法向偏移)完全复用,'
'所以五版之间的差别是纯粹的手势差别。E1 与 N5 定稿并列在末尾作参照。</p></header>')
for it in ITEMS:
body = it["body"]()
w('<div class="be"><div>')
w('<div class="big">%s</div>' % lockup(body, 92))
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 (48, 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</h3>' % (it["id"], it["nm"]))
w('<div class="ref">母题:%s</div>' % it["ref"])
w('<p style="font-family:PingFang SC,serif;font-size:13px;margin:6px 0">%s</p>' % it["line"])
w('<div class="risk"><b>风险</b>:%s</div>' % it["risk"])
w('<div class="small" style="margin-top:6px">墨量 <b data-m="%s@d">…</b> · '
'16px 非白覆盖 <b data-m="%s@small">…</b></div>' % (it["id"], it["id"]))
w('</div></div>')
w('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 120" '
'style="position:absolute;width:0;height:0" data-src="%s">%s</svg>' % (it["id"], body))
w('<section class="band"><h2 class="band">按真实渲染重排(不是按概念)</h2>')
w('<p>下表"红占比"=红像素 ÷ 符号包络面积(84.3 × 84.07,512 栅格实测)。'
'早先我用"÷ 自身包围盒",那个口径下紧凑的点天生接近 100%、带洞的环天生偏低,'
'跨形状不可比——已改。</p>')
w('<table><thead><tr><th>序</th><th>候选</th><th>红占比</th><th>渲染实际读成什么</th>'
'<th>16px</th><th>判定</th></tr></thead><tbody>')
for rank, nm, d, reads, px16, verdict in [
("1", "B4 螺旋", "43.6%", "一枚干净的盘绕,圈与圈分明,笔势厚度看得见",
"仍可辨,中心略糊", '<b class="win">成立,可与 E1 同台</b>'),
("2", "E1 一相圆", "35.4%", "提笔未合的圆相(在场参照,不重议)", "仍是环",
"已在入围"),
("3", "B3 掠·上扬", "22.5%", "一道斜笔——最轻,但也最容易读成"
"斜杠/对勾的一部分", "变细但不断", "成立但太通用"),
("4", "B2 一·横", "65.2%", "一条短横,在 header 里像下划线或分隔线",
"成一条虚线感的短横", "不建议"),
("5", "B5 一波三折", "35.6%", "折线/心电图,不是笔", "折角糊", "不建议"),
("6", "B1 点·侧", "74.0%", "一坨带棱角的红斑——法向偏移在短弧上鼓包,"
"没做出书法点的锋面", "一个小圆点", '<b class="lose">做砸了,需回炉</b>'),
]:
w('<tr><td class="n">%s</td><td><b>%s</b></td><td class="n">%s</td><td>%s</td>'
'<td>%s</td><td>%s</td></tr>' % (rank, nm, d, reads, px16, verdict))
w('</tbody></table>')
w('<div class="note"><b>结论:这一族里只有 B4 螺旋值得进短名单。</b>'
'它和 E1 同属"一笔写成 + 连续形 + 中等红量",但性格不同:E1 安静、有禅气,'
'B4 有动势、直接说"迭代与放大"。风险是螺旋的"加载中"既视感——'
'不过实测 16px 下它反而靠这个熟悉度不被误读。<br>'
'<b>B1 的失败要记一笔</b>:书法的"点"靠的是锋面与顿挫,我用等距法向偏移生成,'
'在短弧上必然鼓成多边形团块。这不是参数问题,是方法问题——'
'要做"点"得直接描贝塞尔轮廓,不能靠扫掠。同理,'
'我之前说"B1 比 E1 轻"是错的,实测 74.0% 对 35.4%,重了一倍。</div>')
w('</section>')
w(JS)
w('<footer>生成器 <code>brush-family.py</code> · 中心线按弧长重采样 120 点、'
'宽度轮廓 6–7 控制点插值、法向偏移成实心闭合 path(可转曲、可单色印刷)</footer>')
w('</div></body></html>')
return "".join(P)
def export():
d = os.path.join(HERE, "assets-brush-family")
os.makedirs(d, exist_ok=True)
for it in ITEMS:
if it["id"].startswith(("E1", "N5")):
continue
body = it["body"]()
for kind, color in (("logo", INK), ("logo-white", WHITE)):
open(os.path.join(d, "%s-%s.svg" % (it["id"], kind)), "w", encoding="utf-8").write(
'<?xml version="1.0" encoding="UTF-8"?>\n<svg xmlns="http://www.w3.org/2000/svg" '
'viewBox="0 0 480 120" width="480" height="120" role="img" '
'aria-label="睿新致远 NOVALON">%s%s</svg>\n' % (body, n5.wordmark_fixed(color)))
open(os.path.join(d, "%s-mark.svg" % it["id"]), "w", encoding="utf-8").write(
'<?xml version="1.0" encoding="UTF-8"?>\n<svg xmlns="http://www.w3.org/2000/svg" '
'viewBox="0 0 108 120" width="108" height="120" role="img" '
'aria-label="睿新致远">%s</svg>\n' % body)
print("assets-brush-family/ →", len(os.listdir(d)), "个文件")
def main():
path = os.path.join(HERE, "brush-family.html")
with open(path, "w", encoding="utf-8") as f:
f.write(build())
print("brush-family.html %s B" % f"{os.path.getsize(path):,}")
export()
if __name__ == "__main__":
main()