Files
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

326 lines
18 KiB
Python
Raw Permalink 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 -*-
"""
睿新致远 —— N5 竹简 · 选定方案细化 + 落地资产
本轮两处调整(均为浏览器实测驱动,不靠估算):
① NOVALON 右移居中
书法「睿新致遠」ink 中心 x = 210.27(组内局部 x = 100.27)
NOVALON ink 中心 x = 182.75 ⇒ 偏左 27.52 单位(40px 档 = 9.2 CSS px)
做法:不写死 x,改 text-anchor="middle" 锚到 100.27,
再补 letter-spacing 尾距(Georgia ls=4,bbox 含尾距 ⇒ 视觉中心右移 2)
⇒ x = 102.27。好处:换字体/换平台时字宽变了也仍然居中,不会再次跑偏。
② 符号高度对齐字标块
字标块 y 20.93..105,中心 62.97
旧印章 y 11.11..102.09,中心 56.6 ⇒ 符号比字标高 6.37 单位,视觉上不成一个矩形
做法:简片改为 y 20.93..105(与字标块同顶同底),编绳落在 62.97。
密度阶梯(解决我自己给 N5 标注的代价:15 单位简片在 16px 只剩 2.2px):
V1 全量版 4 简 × 编绳 7 —— 符号高 ≥ 28px(header/footer/封面)
V2 小尺寸版 3 简 × 编绳 12 —— 符号高 12–28px(favicon/app icon/头像)
"""
import importlib.util
import os
import re
HERE = os.path.dirname(os.path.abspath(__file__))
spec = importlib.util.spec_from_file_location("ms", os.path.join(HERE, "mark-swap.py"))
ms = importlib.util.module_from_spec(spec)
spec.loader.exec_module(ms)
INK, RED, WHITE = ms.INK, ms.RED, ms.WHITE
# ---- 实测锚点 -------------------------------------------------------------
CAL_CX = 210.27 # 书法 ink 中心(viewBox 绝对 x)
CAL_CX_LOCAL = 100.27 # 组内局部 x(组 translate(110,60))
EN_LS = 4 # 原 NOVALON letter-spacing
EN_X_LOCAL = CAL_CX_LOCAL + EN_LS / 2.0 # 102.27,补偿尾距
BLOCK_TOP, BLOCK_BOT = 20.93, 105.0
BLOCK_CY = (BLOCK_TOP + BLOCK_BOT) / 2 # 62.97
BLOCK_H = BLOCK_BOT - BLOCK_TOP # 84.07
ENV_X, ENV_W = 12.0, 84.3 # 旧印章包络(左边界不动,字标零位移)
def rc(x, y, w, h, color):
return '<rect x="%g" y="%g" width="%g" height="%g" fill="%s"/>' % (x, y, w, h, color)
def slips(n, bw, gap, rope, color=RED, mid="m"):
"""显式 rect(上下两排),编绳=两排之间的空档。
曾用「整块 plate + mask 挖空」实现,本函数改为显式 rect。
但必须澄清归因:实测对比(同参数、同阈值、16/32px 逐像素)表明
**mask 版与 rect 版输出完全一致**,所以改 rect 不是因为 mask 丢细节,
只是为了少一层 mask 语义、文件更小、跨渲染器行为更可预测。
真正导致"看起来塌了"的是探针的白色阈值(见 n5-vs-p5.py §03 口径)。
"""
total = n * bw + (n - 1) * gap
x0 = ENV_X + (ENV_W - total) / 2
top_h = (BLOCK_CY - rope / 2) - BLOCK_TOP
bot_y = BLOCK_CY + rope / 2
bot_h = BLOCK_BOT - bot_y
out = []
for i in range(n):
x = x0 + i * (bw + gap)
out.append(rc(x, BLOCK_TOP, bw, top_h, color))
out.append(rc(x, bot_y, bw, bot_h, color))
return "".join(out), x0, total
V1, V1_X0, V1_W = slips(4, 15, 6, 7, RED, "mkV1")
V2, V2_X0, V2_W = slips(3, 22, 9, 12, RED, "mkV2")
def wordmark_fixed(color=INK):
"""原字标 path 原样,仅给 NOVALON 加 text-anchor 并把 x 改到居中锚点。"""
wm = ms.wordmark_filled(color)
new, n = re.subn(r'<text x="24" y="42"',
'<text x="%g" y="42" text-anchor="middle"' % EN_X_LOCAL, wm)
assert n == 1, "NOVALON 的 <text> 定位属性没匹配上(原文件结构变了?)"
return new
def lockup(mark, color=INK, mid_suffix=""):
return ('<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>'
% (mark, wordmark_fixed(color)))
def inline_lockup(mark, px, 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>' % (px, color, mark, wordmark_fixed()))
def inline_mark(mark, px, vb="0 0 108 120"):
return ('<svg xmlns="http://www.w3.org/2000/svg" viewBox="%s" '
'style="height:%dpx;width:auto;display:block">%s</svg>' % (vb, px, mark))
# ---------------------------------------------------------------------------
def build():
a = []
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>' + ms.CSS.replace("__GEIST__", ms.GEIST_B64) + '</style></head><body><div class="wrap">')
w('<header class="top"><div class="eyebrow">Selected · refinement &amp; spec · 2026-10-13</div>')
w('<h1>N5 竹简 · <em>选定方案细化</em></h1>')
w('<p class="lede">书法字标与朱砂简片全部保留原样,本轮只做两处对齐调整,'
'并补上密度阶梯、净空规则与可落地资产。所有数值为浏览器实测,非估算。</p></header>')
# 主展示
w('<section class="band"><h2 class="band">定稿外观</h2>')
w('<div class="row"><div class="art">')
w('<div class="big">%s</div>' % inline_lockup(V1, 100))
w('<div class="smalls">')
w('<div class="u">%s<span>header 40px</span></div>' % inline_lockup(V1, 40))
w('<div class="u">%s<span>32px</span></div>' % inline_lockup(V1, 32))
w('<div class="u"><span class="darkcell">%s</span><span>深色 Hero 40px</span></div>'
% inline_lockup(V1, 40, WHITE))
w('<div class="u">%s<span>单色</span></div>'
% inline_lockup(V1.replace('fill="%s"' % RED, 'fill="%s"' % INK), 40))
w('</div></div><div class="meta">')
w('<h2 style="margin:0"><span class="id">V1</span>全量版</h2>')
w('<div class="line">4 简 × 编绳 7 单位。用于符号高 ≥ 28px 的一切场合:header、footer、'
'案例封面、合同落款。</div>')
w('<div class="why"><b>本轮调整</b>:简片改为与字标块同顶同底(y 20.93–105),'
'编绳落在块中心 62.97;NOVALON 居中锚定。</div>')
w('<div class="risk"><b>不要用</b>在符号高 &lt; 28px 处——那时切 V2。</div>')
w('</div></div>')
w('<div class="row"><div class="art">')
w('<div class="big">%s</div>' % inline_mark(V2, 96, "0 0 108 120"))
w('<div class="smalls">')
for px in (48, 32, 24, 16):
w('<div class="u">%s<span>%dpx</span></div>' % (inline_mark(V2, px), px))
w('<div class="u"><span class="darkcell" style="padding:8px">%s</span><span>深底 32px</span></div>'
% inline_mark(V2.replace('fill="%s"' % RED, 'fill="%s"' % WHITE), 32))
w('</div></div><div class="meta">')
w('<h2 style="margin:0"><span class="id">V2</span>小尺寸版</h2>')
w('<div class="line">3 简 × 编绳 12 单位。用于符号高 12–28px:favicon、app icon、头像、水印。</div>')
w('<div class="why"><b>为什么必须另出一版</b>:V1 的简片宽 15 单位,在 16px 下只剩 2px、'
'缝 0.8px,四片会并成一块红;编绳 7 单位在 16px 下 0.93px 直接消失。'
'V2 把简片加宽到 22(16px 下 2.9px)、编绳加粗到 12(1.6px),三片仍读得出"简"。</div>')
w('<div class="risk"><b>代价</b>:三片版比四片更接近通用「列表图标」,器物感降一层——'
'这是尺寸换来的,不是设计选择。</div>')
w('</div></div></section>')
# 几何规格
w('<section class="band"><h2 class="band">几何规格(viewBox 0 0 480 120)</h2>')
w('<table><thead><tr><th>元素</th><th>x</th><th>y</th><th>宽</th><th>高</th><th>说明</th></tr></thead><tbody>')
for nm, x, y, ww, hh, note in [
("符号包络", ENV_X, 11.11, ENV_W, 90.98, "沿用旧印章实测 ink 范围,故字标零位移"),
("V1 简片 ×4", round(V1_X0, 2), BLOCK_TOP, V1_W, BLOCK_H,
"简宽 15 · 缝 6 · 居中于包络;顶底与字标块对齐"),
("V1 编绳(挖空)", round(V1_X0 - 6, 2), round(BLOCK_CY - 3.5, 2), V1_W + 12, 7,
"mask 真挖空,非白块覆盖"),
("V2 简片 ×3", round(V2_X0, 2), BLOCK_TOP, V2_W, BLOCK_H, "简宽 22 · 缝 9"),
("V2 编绳(挖空)", round(V2_X0 - 6, 2), round(BLOCK_CY - 6, 2), V2_W + 12, 12, "小尺寸下仍可辨"),
("书法字标组", 110, 60, "—", "—", "translate(110,60),path 原样未动"),
("NOVALON", EN_X_LOCAL, 42, "—", "—",
'text-anchor="middle" ⇒ 绝对中心 x 210.27,与书法 ink 中心对齐'),
]:
w('<tr><td>%s</td><td class="n">%s</td><td class="n">%s</td><td class="n">%s</td>'
'<td class="n">%s</td><td>%s</td></tr>' % (nm, x, y, ww, hh, note))
w('</tbody></table>')
w('<h3>本轮两处调整的实测依据</h3>')
w('<table><thead><tr><th>调整</th><th>实测前</th><th>偏差</th><th>实测后</th></tr></thead><tbody>')
w('<tr><td>NOVALON 居中</td><td class="n">ink 中心 x 182.75</td>'
'<td class="n">偏左 <b>27.52</b> 单位(40px 档 9.2 CSS px)</td>'
'<td class="n">锚到书法中心 <b>210.27</b></td></tr>')
w('<tr><td>符号高度对齐</td><td class="n">印章 y 11.11–102.09,中心 56.6</td>'
'<td class="n">比字标块中心高 <b>6.37</b> 单位</td>'
'<td class="n">简片 y 20.93–105,中心 <b>62.97</b></td></tr>')
w('</tbody></table>')
w('<div class="note"><b>为什么用 text-anchor 而不是直接改 x:</b>NOVALON 是 '
'<code>&lt;text&gt;</code>,宽度随宿主字体浮动(Georgia 缺失时回退 Times New Roman/serif,'
'实测本机 Georgia 宽 97.5 单位)。写死 x 只在这台机器上居中,换平台会再次跑偏;'
'锚定 middle 后由浏览器自己居中,跨平台稳定。</div>')
w('</section>')
# 净空与最小尺寸
w('<section class="band"><h2 class="band">净空 · 最小尺寸 · 色彩</h2>')
w('<div class="grid c2" style="gap:26px">')
w('<div><h3>净空(clear space)</h3>'
'<p>四周留白 ≥ <b>1 枚简宽</b>(V1 简宽 15 单位 ⇒ 占符号高的 17.8%)。'
'上图为最小净空示意;任何元素不得进入该范围。</p></div>')
w('<div><h3>最小尺寸</h3><ul>'
'<li>整幅 lockup:高 ≥ <b>24px</b>(现 header 移动档 h-8 = 32px ✓)</li>'
'<li>V1 单用:符号高 ≥ <b>32px</b>(逐行扫描实测:16px 仅剩 1 段、24px 3 段、32px 才恢复 4 段)</li>'
'<li>V2 单用:符号高 ≥ <b>16px</b>(实测 16/24/32px 均稳定 3 段,favicon ✓)</li></ul></div>')
w('</div>')
w('<h3>色彩变体(四支,不多做)</h3>')
w('<div class="grid c2" style="gap:0">')
for label, bg, color, mark_color, note in [
("① 墨 · 浅底(默认)", "#fff", INK, RED, "用于白 / mist 分区"),
("② 白 · 深底", INK, WHITE, RED, "用于深色 Hero 与 footer"),
("③ 全单色(墨)", "#fff", INK, INK, "合同、发票、报纸等一色印刷"),
("④ 朱底反白", RED, WHITE, WHITE, "品牌红区块上的落款"),
]:
body = V1 if mark_color == RED else V1.replace('fill="%s"' % RED, 'fill="%s"' % mark_color)
w('<div class="cell" style="padding:14px 0"><div style="background:%s;padding:16px;'
'display:flex;align-items:center;justify-content:center;border:1px solid var(--hair)">'
'%s</div><div class="tag" style="margin-top:8px">%s — %s</div></div>'
% (bg, inline_lockup(body, 34, color), label, note))
w('</div></section>')
# 真实场景
w('<section class="band"><h2 class="band">真实场景</h2>')
w('<h3>浅色 header(40px)</h3>')
w('<div class="head-mock"><div>%s</div><div class="nav"><span>产品</span><span>解决方案</span>'
'<span>服务</span><span>洞察</span><span>关于我们</span></div></div>' % inline_lockup(V1, 40))
w('<h3>深色全出血 Hero(40px)</h3>')
w('<div class="head-mock dark"><div>%s</div><div class="nav"><span>产品</span>'
'<span>解决方案</span><span>服务</span><span>洞察</span></div></div>'
% inline_lockup(V1, 40, WHITE))
w('<h3>深色 footer(48px)+ 浏览器标签页 + 移动档(32px)</h3>')
w('<div class="grid c3">')
w('<div class="cell"><div class="bcard">%s<div class="rest">智连未来 · 成长伙伴<br>'
'四川睿新致远科技有限公司<br>contact@novalon.cn</div></div></div>' % inline_lockup(V1, 48, WHITE))
w('<div class="cell"><div style="background:var(--mist);padding:14px;border:1px solid var(--hair);'
'display:flex;align-items:center;gap:8px"><span class="tabmock">%s<b>睿新致远 — 数字化转型</b></span>'
'</div><div class="tag" style="margin-top:8px">V2 @16px 标签页</div></div>'
% inline_mark(V2, 16))
w('<div class="cell"><div style="padding:14px;border:1px solid var(--hair)">%s</div>'
'<div class="tag" style="margin-top:8px">移动档 h-8 = 32px</div></div>' % inline_lockup(V1, 32))
w('</div></section>')
# 落地
w('<section class="band"><h2 class="band">落地资产与随动项</h2>')
w('<p>本目录 <code>assets-n5/</code> 已导出可直接替换的文件;'
'以下随动项<b>本稿一项未动</b>,需你授权后才执行。</p>')
w('<ol>')
for li in [
'<b>替换</b> <code>public/logo.svg</code>(墨)与 <code>public/logo-white.svg</code>(白):'
'体积 43,059 B → 约 21,500 B(<b>−50%</b>),省掉的正是印章内那 4 个书法字的重复副本。',
'<b>删除</b>(确认零引用后):<code>logo-light.svg</code>、<code>logo-calligraphy.svg</code>、'
'<code>logo-v4-backup.svg</code>、<code>logo.webp</code>,再省约 129KB。',
'<b>favicon</b>:<code>public/favicon.svg</code> 换 V2,跑 <code>scripts/generate-favicons.js</code> '
'重生成 16/32/180;顺带修掉现版本引用 Ma Shan Zheng / ZCOOL 网络字体名的违规(PRODUCT.md:32)。',
'<b>尺寸属性不变</b>:viewBox 仍是 480×120(4:1),'
'<code>header.tsx:106-107,116-117</code> 与 <code>footer.tsx:41-42</code> 无需改动。',
'<b>测试</b>:<code>header.test.tsx:170-171</code> 断言的两张 src 不变;'
'<code>e2e/p1-brand-visual-audit.spec.ts:367</code> 的「每个 <code>&lt;text&gt;</code> 须恰为 '
'NOVALON」继续为真(本方案唯一的 text 就是 NOVALON)。',
'<b>同源组件</b>:<code>BrandCalligraphyName</code> 用的就是这批字标 path,'
'<b>无需改动</b>;但它不含 NOVALON 行,若品牌页要同步居中口径需单独确认。',
'<b>视觉基线</b>:132 张含 header logo,替换即作废;基线重写是独立授权动作(AGENTS.md §5.1)。',
'<b>文档</b>:建议在 <code>DESIGN.md</code> 补一节「品牌标识契约」,'
'把 V1/V2 分工、净空、最小尺寸、四支色彩变体写死(目前 DESIGN.md 对 logo 零规定)。',
]:
w('<li>%s</li>' % li)
w('</ol></section>')
w('<footer>生成器 <code>n5-refine.py</code> · 书法 path 直读 <code>public/logo.svg</code>,'
'仅改 NOVALON 的锚点与 x · 本页自包含可单发</footer>')
w('</div>')
# 量测探针:验证居中是否真的对齐
w("""
<script>
(function(){
const svg=document.querySelector('svg[role="img"]');
const root=svg.getScreenCTM();
function box(e){const b=e.getBBox();
const q=[[b.x,b.y],[b.x+b.width,b.y],[b.x,b.y+b.height],[b.x+b.width,b.y+b.height]]
.map(([x,y])=>{const p=svg.createSVGPoint();p.x=x;p.y=y;
const r=p.matrixTransform(e.getScreenCTM().multiply(root.inverse()));return [r.x,r.y];});
const xs=q.map(a=>a[0]),ys=q.map(a=>a[1]);
return {x:Math.min(...xs),w:Math.max(...xs)-Math.min(...xs),
y:Math.min(...ys),h:Math.max(...ys)-Math.min(...ys)};}
const cal=[...svg.querySelectorAll('g g g path')].map(box);
const L=Math.min(...cal.map(b=>b.x)), R=Math.max(...cal.map(b=>b.x+b.w));
const T=Math.min(...cal.map(b=>b.y)), B=Math.max(...cal.map(b=>b.y+b.h));
const en=box(svg.querySelector('text'));
window.__align={calCx:+((L+R)/2).toFixed(2), enCx:+(en.x+en.w/2).toFixed(2),
delta:+(((L+R)/2)-(en.x+en.w/2)).toFixed(2),
calBox:[+L.toFixed(2),+T.toFixed(2),+(R-L).toFixed(2),+(B-T).toFixed(2)],
enBox:[+en.x.toFixed(2),+en.y.toFixed(2),+en.w.toFixed(2),+en.h.toFixed(2)]};
})();
</script>""")
w('</body></html>')
return "".join(P)
def export():
d = os.path.join(HERE, "assets-n5")
os.makedirs(d, exist_ok=True)
jobs = [
("logo", lockup(V1, INK)),
("logo-white", lockup(V1, WHITE)),
("logo-mono", lockup(V1.replace('fill="%s"' % RED, 'fill="%s"' % INK), INK)),
("mark-v1", '<?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>' % V1),
("mark-v2", '<?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>' % V2),
("favicon", '<?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>' % V2),
]
print("%-14s %9s" % ("file", "bytes"))
for name, body in jobs:
p = os.path.join(d, name + ".svg")
txt = body if body.startswith("<?xml") else '<?xml version="1.0" encoding="UTF-8"?>\n' + body
with open(p, "w", encoding="utf-8") as f:
f.write(txt if txt.endswith("\n") else txt + "\n")
print("%-14s %9s" % (name + ".svg", f"{os.path.getsize(p):,}"))
def main():
path = os.path.join(HERE, "n5-spec.html")
with open(path, "w", encoding="utf-8") as f:
f.write(build())
print("n5-spec.html %s B" % f"{os.path.getsize(path):,}")
export()
if __name__ == "__main__":
main()