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 个文本/矢量件。
219 lines
11 KiB
Python
219 lines
11 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
N5 回归版 —— 只改缝宽,其余全部还原
|
||
|
||
第二轮优化(绳、结、桥、收分)被否,且数据支持这个判断:
|
||
书法块墨量 18.2%,而 Q1/Q2/Q3 加到 66–72%(近 4 倍),气韵被塞满。
|
||
同时 Q4(缝 13、无绳无结)在 16px 已四段全存活,密度 43.7% 为全场最低。
|
||
⇒ 让小尺寸成立的是缝宽,不是那根绳。绳/结/桥/收分都是为解决问题之外的东西付的代价。
|
||
|
||
本文件只测一件事:缝宽从 6 加到几,能同时满足
|
||
① 16px 四段存活 ② 墨量尽量低(接近书法块) ③ 仍读作「简」而不是「栅栏」
|
||
"""
|
||
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"))
|
||
opt = load("opt", os.path.join(HERE, "n5-opt.py"))
|
||
|
||
RED, INK, WHITE = n5.RED, n5.INK, n5.WHITE
|
||
|
||
|
||
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))
|
||
|
||
|
||
# 缝宽阶梯:绳区固定 12(只是空隙,不是实体)
|
||
LADDER = [
|
||
("原始 N5", 6, "你选中的那一版,作为基准"),
|
||
("缝 8", 8, "第一步放宽"),
|
||
("缝 10", 10, ""),
|
||
("缝 12", 12, ""),
|
||
("缝 14", 14, ""),
|
||
("缝 16", 16, "最疏,接近「栅栏」临界"),
|
||
]
|
||
|
||
CSS = ms.CSS + """
|
||
.bare{display:grid;grid-template-columns:1fr 236px;border-bottom:1px solid var(--hair)}
|
||
.bare>div:first-child{border-right:1px solid var(--hair);padding:16px 22px}
|
||
.bare .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}
|
||
"""
|
||
|
||
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;
|
||
const 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){const cap=+td.getAttribute('data-cap');
|
||
td.innerHTML='<b class="'+(o.runs>=cap?'win':'lose')+'">'+o.runs+'</b>';}});
|
||
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)+'%';});
|
||
document.querySelectorAll('[data-gap]').forEach(td=>{
|
||
const o=out[td.getAttribute('data-gap')];
|
||
if(!o) return;
|
||
const f=[16,24,32].find(S=>o[S]&&o[S].runs>=4);
|
||
td.textContent=f?('16px 起四片全存活('+f+'px 达标)'):'32px 仍不足 4 段';});
|
||
window.__bare=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">Back to the original · 2026-10-13</div>')
|
||
w('<h1>N5 回归版:<em>只改缝宽,绳结桥收分全部撤掉</em></h1>')
|
||
w('<p class="lede">第二轮我加错了方向:绳、结、顶底桥、收分这些<b>新增元素</b>'
|
||
'破坏了原本"四片 + 一道空"的干净节奏——你的判断是对的。'
|
||
'(我先前把原因归给"墨量涨到书法块 4 倍",那是错的:实测原始版墨量本来就是 70.9%,'
|
||
'第二轮的 71.8% 几乎没涨。见文末的撤回说明。)'
|
||
'而实测显示让小尺寸活下来的从来不是那根绳,是缝宽。所以这一版只动一个参数。</p></header>')
|
||
|
||
w('<section class="band"><h2 class="band">缝宽阶梯(绳区固定为空隙 12 单位,不画实体)</h2>')
|
||
# 基准:你选中的原始 N5(n5.V1:4 片 × 缝 6 × 绳区 7)
|
||
w('<div class="bare"><div>')
|
||
w('<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>基准 · 原始 N5</h3>'
|
||
'<p style="font-family:PingFang SC,serif;font-size:13px;margin:4px 0">'
|
||
'4 片、缝 6、绳区 7(纯空隙)。你选中的那一版。</p>'
|
||
'<div class="small">16px 段数 <b data-r="orig@16" data-cap="4">…</b> · '
|
||
'24px <b data-r="orig@24" data-cap="4">…</b> · 32px <b data-r="orig@32" data-cap="4">…</b>'
|
||
' · 墨量 <b data-d="orig">…</b></div>'
|
||
'<div class="risk">唯一问题:16px 下四片并成一块(实测)。除这以外不需要改动。</div>'
|
||
'</div></div>')
|
||
|
||
for label, gap, note in LADDER[1:]:
|
||
body = opt.slips(n=4, gap=gap, rope=12)
|
||
key = "g%d" % gap
|
||
w('<div class="bare"><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></div><div class="meta"><h3>%s</h3>' % label)
|
||
w('<div class="small">缝 %d · 片宽 %.1f · 绳区 12%s</div>'
|
||
% (gap, (84.3 - 3 * gap) / 4, (" " + note) if note else ""))
|
||
w('<div class="small" style="margin-top:6px">16px <b data-r="%s@16" data-cap="4">…</b> · '
|
||
'24px <b data-r="%s@24" data-cap="4">…</b> · 32px <b data-r="%s@32" data-cap="4">…</b>'
|
||
'<br>墨量 <b data-d="%s">…</b></div>' % (key, key, key, key))
|
||
w('<div class="why" data-gap="%s" style="margin-top:6px">…</div>' % key)
|
||
w('</div></div>')
|
||
|
||
w('<section class="band"><h2 class="band">结论</h2>')
|
||
w('<p>目标不是"最稳"而是"最少改动同时够用":在四片全存活的缝宽里取<b>最小的那一个</b>,'
|
||
'这样片宽最大、留白最少、最接近你选中的原始版观感。'
|
||
'墨量越低越好是错的取向——缝放到 16 会疏成栅栏。</p>')
|
||
w('<div class="note" id="verdict"><b>结论:缝 6 → 10,其余一律不动。</b>'
|
||
'10 是让 16px 四片全存活的<b>最小</b>缝宽——再往上就只是在继续变疏,'
|
||
'到 16 已经接近栅栏临界。改到 10 之后,原始版的观感几乎不变'
|
||
'(片宽 16.6 → 14.3,仅收窄 14%),却同时拿到两样东西:'
|
||
'16px 不再并成一块,墨量从 70.9% 降到 55.5%。</div>')
|
||
w('<div class="risk" style="margin-top:14px"><b>撤回一个因果解释。</b>'
|
||
'我上一条说"第二轮变差是因为墨量被顶到书法块的 4 倍"——这是把相关性当因果,错了。'
|
||
'实测原始 N5 墨量本来就是 <b>70.9%</b>,Q1/Q3 是 71.8%/71.5%,几乎没涨。'
|
||
'第二轮真正变差的原因是<b>多了横穿的绳、右端的结、顶底的桥这些元素</b>,'
|
||
'把原本干净的"四片 + 一道空"的节奏破坏了。不是量,是多了东西。</div>')
|
||
w('<p class="small">对照:书法块墨量 18.2%。符号是实心块、书法是笔画,'
|
||
'密度天然差数倍,这个差值从原始版就存在,不是缺陷也不需要抹平——'
|
||
'真要调轻重,应该调符号与字标的<b>尺寸配比</b>,而不是把简片掏薄。</p>')
|
||
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="orig">%s</svg>' % n5.V1)
|
||
for label, gap, note in LADDER[1:]:
|
||
w('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 120" width="108" height="120" '
|
||
'data-src="g%d">%s</svg>' % (gap, opt.slips(n=4, gap=gap, rope=12)))
|
||
w('<svg xmlns="http://www.w3.org/2000/svg" viewBox="100 0 380 120" width="380" height="120" '
|
||
'data-src="cal">%s</svg>' % n5.wordmark_fixed(INK))
|
||
w('</div>')
|
||
w(JS)
|
||
w('<footer>生成器 <code>n5-bare.py</code> · 唯一变量=缝宽;绳区固定为空隙 12 单位,'
|
||
'不画实体绳/结/桥/收分</footer>')
|
||
w('</div></body></html>')
|
||
return "".join(P)
|
||
|
||
|
||
def main():
|
||
path = os.path.join(HERE, "n5-bare.html")
|
||
with open(path, "w", encoding="utf-8") as f:
|
||
f.write(build())
|
||
print("n5-bare.html %s B" % f"{os.path.getsize(path):,}")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|