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 个文本/矢量件。
342 lines
20 KiB
Python
342 lines
20 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
一相圆 · 第三十六刀:把参照图量出来的数字照做,并把「七个字母填不满一圈」这个
|
||
硬约束摊开成两个可选解。
|
||
|
||
参照图实测(_refprobe.py,1520×742 原图,阈值 luma<128):
|
||
bbox x[533,989] y[153,573] → 环外径 ≈ 420px,R_out ≈ 210
|
||
环带厚度 左侧 71px(x533→604)/ 顶部 35px(y153→195)
|
||
ch/Rb 首 ≈ 0.50 → 尾 ≈ 0.22 (taper 比 rho ≈ 0.44)
|
||
笔画/字高 9~22px 对 38~65px 字高 → 0.20 ~ 0.30,取 0.24
|
||
墨密度 24323 / (457×421) = 12.6%
|
||
对照 cut 35 实测:ch/Rb 首 0.84 尾 0.55、笔宽 0.14。
|
||
→ 我把它画薄了,也把它画胖了:带太厚(挤掉圆心),字却太细(填不满带)。
|
||
※ 口径更正:本页早先想用「墨/包围盒 12.6% vs 5.8%」当主判据,这个比法不成立
|
||
—— 参照图的包围盒被那行溢出环外的 Design Institute Inc. 拉宽了 36px,
|
||
分母虚高;候选的包围盒近似正方。改用**带填充率**(只在环带内量墨率,
|
||
射线采样,同一算法;负/正对照实测 0.0% / 100.0%)。参照图那一侧只给
|
||
可复现的局部实测(带厚 71/35px、笔 9~22px、字母接触),不给全局数——
|
||
它的射线扫会把溢出那行字当成环带,去噪需要比这张位图更干净的前提。
|
||
|
||
硬约束(这一刀要摊给甲方的):
|
||
设 λ=ch/Rb,走完 360−开口 弧需要 Σ(w/H)·λ + n·gapf·λ = radians(span)。
|
||
NOVALON 七个字母 Σ(w/H)=5.88 ⇒ λ_avg = 250°/5.88 ≈ 0.42 起,
|
||
含 taper 后首字必然冲到 0.6 以上 —— 7 个字母**不可能**既填满一圈又保持
|
||
参照图那种细带。参照图能,是因为它绕了 12 个字母加一个空格。
|
||
两个解:
|
||
单环 NOVALON ×1,接受带厚(cut 35 那条路),把笔宽提到 0.24 补密度;
|
||
复环 NOVALON ×2 绕圈,λ 落回 0.36,带子立刻变细、圆心反而变大。
|
||
"""
|
||
import importlib.util
|
||
import json
|
||
import math
|
||
import os
|
||
|
||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||
sp = importlib.util.spec_from_file_location("r2", os.path.join(HERE, "ring2.py"))
|
||
r2 = importlib.util.module_from_spec(sp)
|
||
sp.loader.exec_module(r2)
|
||
|
||
RED, INK, WHITE = r2.RED, r2.INK, r2.WHITE
|
||
CX, CY, S, OUT = r2.CX, r2.CY, r2.S, r2.OUT
|
||
|
||
|
||
|
||
def prof(L):
|
||
"""每度一条 [是否在环带内, rb, ro],360 项 —— 带填充率的解析边界。"""
|
||
a0, span = L["a0"], L["span"]
|
||
out = []
|
||
for d in range(360):
|
||
rel = (d - a0) % 360.0
|
||
if rel <= span:
|
||
frac = rel / span
|
||
rb = L["Rb0"] + (L["Rb1"] - L["Rb0"]) * frac
|
||
ch = L["ch0"] + (L["ch1"] - L["ch0"]) * frac
|
||
out.append([1, round(rb, 2), round(rb + ch, 2)])
|
||
else:
|
||
out.append([0, 0.0, 0.0])
|
||
return out
|
||
|
||
VARIANTS = [
|
||
("T1 单环·补重", "NOVALON", dict(opening=110.0, gap_at=90.0, rho=0.55,
|
||
kappa=0.88, stroke=0.24), 0.0,
|
||
"cut 35 的形,只把笔宽从 14% 提到 24%(参照图实测档)。带子还是厚,"
|
||
"但终于有了参照图那种压手的黑。"),
|
||
("T2 复环·等比", "NOVALONNOVALON", dict(opening=110.0, gap_at=90.0, rho=0.44,
|
||
kappa=0.88, stroke=0.24), 0.0,
|
||
"NOVALON 绕两圈。λ 落回 0.36 —— 带厚/半径正好回到参照图实测的 0.50→0.22。"
|
||
"环变细了,圆心反而装得下更大的书法。"),
|
||
("T2b 复环·款出", "NOVALONNOVALON", dict(opening=110.0, gap_at=90.0, rho=0.44,
|
||
kappa=0.88, stroke=0.24), 0.28,
|
||
"T2 + 把「睿新致遠」右移,从缺口出环 —— 参照图那个真正的机关。"),
|
||
("T3 复环·轻笔", "NOVALONNOVALON", dict(opening=110.0, gap_at=90.0, rho=0.44,
|
||
kappa=0.88, stroke=0.17), 0.28,
|
||
"同样的复环但只提到 17%。放在这里是为了量出「笔宽这一档到底值多少密度」。"),
|
||
("T4 复环·强提笔", "NOVALONNOVALON", dict(opening=110.0, gap_at=90.0, rho=0.28,
|
||
kappa=0.80, stroke=0.24), 0.28,
|
||
"末字只留首字的 28%、半径再收 20% —— 尾部卷进圆心,最像一笔写完提起。"),
|
||
("T5 单环·极限补重", "NOVALON", dict(opening=110.0, gap_at=90.0, rho=0.55,
|
||
kappa=0.88, stroke=0.34), 0.0,
|
||
"单环要把环带填实,笔宽得推到 34% —— 这时 O 的心只剩一条细缝。"
|
||
"这一格是「单环这条路走到头」的样子,用来把上限摊开。"),
|
||
]
|
||
|
||
CSS = """
|
||
*{box-sizing:border-box}
|
||
body{margin:0;background:#F7F4EF;color:#4F4A42;
|
||
font:17px/1.9 "Songti SC","Noto Serif SC",Georgia,serif;-webkit-font-smoothing:antialiased}
|
||
.wrap{max-width:1180px;margin:0 auto;padding:46px 32px 100px}
|
||
code{font:14px/1.5 ui-monospace,Menlo,monospace;background:#EFEAE1;padding:1px 5px}
|
||
.ey{font:12px/1.4 "PingFang SC",Inter,sans-serif;letter-spacing:.18em;
|
||
text-transform:uppercase;color:#8A8377}
|
||
h1{font-size:50px;line-height:1.16;color:#26221E;margin:12px 0 16px;font-weight:600}
|
||
h1 em{font-style:normal;color:#C41E3A}
|
||
h2{font-size:25px;color:#26221E;margin:58px 0 8px;font-weight:600}
|
||
h2 .no{color:#C41E3A;margin-right:10px}
|
||
p{max-width:82ch;margin:10px 0}
|
||
.lede{font-size:19px;color:#26221E;max-width:76ch}
|
||
.j{border-left:2px solid #C41E3A;padding:3px 0 3px 18px;margin:14px 0;color:#26221E;max-width:88ch}
|
||
.card{background:#fff;border:1px solid #EFEAE1;padding:22px 24px;margin:0 0 16px}
|
||
.hd{display:flex;justify-content:space-between;align-items:baseline;gap:16px;
|
||
flex-wrap:wrap;margin-bottom:16px}
|
||
.nm{font-weight:650;color:#26221E;font-size:16px;font-family:"PingFang SC",Inter,sans-serif}
|
||
.cx{font:12px/1.5 "PingFang SC",Inter,sans-serif;color:#8A8377;font-variant-numeric:tabular-nums}
|
||
.row{display:flex;gap:24px;align-items:flex-start;flex-wrap:wrap}
|
||
.cell{text-align:center}
|
||
.lab{font:11.5px/1.5 "PingFang SC",Inter,sans-serif;color:#8A8377;margin-top:7px}
|
||
.tl{display:inline-flex;align-items:center;justify-content:center;
|
||
border-radius:22.5%;overflow:hidden;box-shadow:0 0 0 1px #EFEAE1}
|
||
.strip{display:flex;gap:14px;align-items:flex-end;justify-content:center}
|
||
.why{font-size:14.5px;color:#4F4A42;margin:16px 0 0;max-width:92ch}
|
||
table{border-collapse:collapse;width:100%;margin:14px 0;
|
||
font:13px/1.6 "PingFang SC",Inter,sans-serif}
|
||
th,td{padding:10px 11px;border-bottom:1px solid #C3BDB1;text-align:left}
|
||
th{font-size:11px;letter-spacing:.11em;text-transform:uppercase;color:#8A8377;font-weight:500}
|
||
td.n{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
|
||
.pass{color:#0f7b3b;font-weight:600}
|
||
.fail{color:#C41E3A;font-weight:600}
|
||
.ref{background:#EFEAE1;font-weight:600}
|
||
pre{font:9.5px/1.15 ui-monospace,Menlo,monospace;margin:0;text-align:left}
|
||
footer{margin-top:56px;padding-top:16px;border-top:1px solid #C3BDB1;
|
||
font:12.5px/1.7 "PingFang SC",Inter,sans-serif;color:#8A8377}
|
||
"""
|
||
|
||
|
||
def build():
|
||
P = ['<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8">'
|
||
'<meta name="viewport" content="width=device-width,initial-scale=1">'
|
||
'<title>一相圆 · 单环 / 复环</title><style>' + CSS + '</style></head><body><div class="wrap">']
|
||
|
||
P.append('<div class="ey">Cut 36 · 2026-10-14 · 参照图实测值驱动 · 一个需要甲方拍的岔路</div>')
|
||
P.append('<h1>环画细了:<em>七个字母填不满一圈</em></h1>')
|
||
P.append('<p class="lede">把参照图逐像素量完,我 cut 35 的两个数都是错的:带子画得太厚'
|
||
'(ch/Rb 首 0.84,它实测 0.50),字却画得太细(笔宽 14%,它 20~30%)。'
|
||
'但补正之后撞上一个绕不过的几何事实 —— 参照图绕了 12 个字母,我们只有 7 个。</p>')
|
||
P.append('<div class="j"><b>这个约束是硬的。</b>设 λ=字高/基线半径,走完 360−开口 这段弧要满足 '
|
||
'Σ(w/H)·λ + n·gapf·λ = radians(span)。NOVALON 的 Σ(w/H)=5.88,'
|
||
'开口 110° ⇒ λ_avg ≈ 0.42;再加 taper,首字必上 0.6。'
|
||
'想要参照图那种 0.50→0.22 的细带,只有把绕圈的字母数翻倍 —— '
|
||
'<b>也就是 NOVALON 在环上出现两次</b>。这是身份决定,不是排版决定,所以摆在这里请你拍。</div>')
|
||
|
||
built = []
|
||
bstroke = {}
|
||
BAND = {}
|
||
for nm, text, kw, dxfrac, why in VARIANTS:
|
||
dx = dxfrac * r2.layout(text=text, **kw)[1]["Rb0"]
|
||
body, g = r2.compose(text=text, dx=dx, **kw)
|
||
key = nm.split()[0]
|
||
L = g["L"]
|
||
n = len(text)
|
||
bstroke[key] = kw.get("stroke", 0.14)
|
||
BAND[key] = prof(L)
|
||
built.append((nm, body, g, key, text, n, why))
|
||
wht, _ = r2.compose(ring_col=WHITE, char_col=WHITE, text=text, dx=dx, **kw)
|
||
solid, _ = r2.compose(ring_col=RED, char_col=RED, text=text, dx=dx, **kw)
|
||
|
||
P.append('<div class="card"><div class="hd"><span class="nm">%s</span>'
|
||
'<span class="cx">%d 字母 · 首字高 %g → 尾 %g · 基线 %g→%g · '
|
||
'ch/Rb %g→%g · 圆心字高 %g · 离环 %g</span></div><div class="row">'
|
||
% (nm, n, round(L["ch0"], 1), round(L["ch1"], 1), round(L["Rb0"], 1),
|
||
round(L["Rb1"], 1), round(L["ch0"] / L["Rb0"], 2),
|
||
round(L["ch1"] / L["Rb1"], 2), round(g["csize"], 1),
|
||
round(g["clear"], 1)))
|
||
P.append('<div class="cell">%s<div class="lab">280px</div></div>'
|
||
% r2.svg(body, 280, "%s@280" % key))
|
||
P.append('<div class="cell">%s<div class="lab">130px</div></div>'
|
||
% r2.svg(body, 130, "%s@130" % key))
|
||
P.append('<div class="cell"><span class="tl" style="background:#C41E3A">%s</span>'
|
||
'<div class="lab">单色朱砂</div></div>' % r2.svg(solid, 150))
|
||
P.append('<div class="cell"><span class="tl" style="background:#141210">%s</span>'
|
||
'<div class="lab">暖墨底反白</div></div>' % r2.svg(wht, 150))
|
||
P.append('<div class="cell"><div class="strip">')
|
||
for px in (64, 40, 24, 16):
|
||
P.append('<div><span class="tl" style="background:#fff">%s</span>'
|
||
'<div class="lab">%d</div></div>'
|
||
% (r2.svg(body, px, "%s@%d" % (key, px)), px))
|
||
P.append('</div><div class="lab">应用阶梯</div></div>')
|
||
# 512px 样张离屏渲染:带填充率必须在高分辨率下量,摆出来只会干扰看图
|
||
P.append('<div style="position:absolute;left:-9999px;top:0">%s</div>'
|
||
% r2.svg(body, 512, "%s@512" % key))
|
||
P.append('</div><p class="why">%s</p></div>' % why)
|
||
|
||
P.append('<h2><span class="no">1</span>带填充率实测</h2>')
|
||
P.append('<table><thead><tr><th>候选</th><th class="n">字母数</th>'
|
||
'<th class="n">ch/Rb 首→尾</th><th class="n">笔宽</th>'
|
||
'<th class="n">带填充率</th>'
|
||
'<th class="n">最细特征@40</th><th class="n">最细特征@16</th></tr></thead><tbody>')
|
||
P.append('<tr class="ref"><td>参照图(只给可复现的局部实测)</td><td class="n">12+1</td>'
|
||
'<td class="n">0.50 → 0.22</td><td class="n">0.20~0.30</td>'
|
||
'<td class="n">不给全局数,见下注</td>'
|
||
'<td class="n">带厚 头71 / 尾35 px</td><td class="n">笔 9~22 px</td></tr>')
|
||
for nm, body, g, key, text, n, why in built:
|
||
L = g["L"]
|
||
P.append('<tr><td><b>%s</b></td><td class="n">%d</td>'
|
||
'<td class="n">%.2f → %.2f</td><td class="n">%.2f</td>'
|
||
'<td class="n" data-cell="%s@512@band">…</td>'
|
||
'<td class="n" data-cell="%s@40@min">…</td>'
|
||
'<td class="n" data-cell="%s@16@min">…</td></tr>'
|
||
% (nm, n, L["ch0"] / L["Rb0"], L["ch1"] / L["Rb1"], bstroke[key],
|
||
key, key, key))
|
||
P.append('</tbody></table>')
|
||
P.append('<p><b>带填充率</b> = 只在环带 <code>[rb(θ), ro(θ)]</code> 内量着墨率:'
|
||
'每度一条射线、0.5 设计单位步长、按扇环面积 <code>ro²−rb²</code> 加权。'
|
||
'仪器自证:同一套代码喂全白得 <b>0.0%</b>、喂满墨得 <b>100.0%</b>。\n'
|
||
'参照图那一侧我<b>不</b>给这个数 —— 试过用同一支射线扫它,'
|
||
'开口方向那 70° 会把溢出环外的 Design Institute Inc. 当成环带扫到'
|
||
'(实测该方向 ro 掉到 27px,自检直接暴露),去噪需要比这张位图更干净的前提。'
|
||
'所以只报能站住的局部量:带厚 头 71px / 尾 35px、笔画 9~22px、字母基本接触。</p>')
|
||
P.append('<p>这一栏真正回答的问题是:<b>环带像不像一笔写成</b>。'
|
||
'同一笔宽 0.24 下:单环 T1 = <b>38.5%</b>,复环 T2/T2b = <b>45.8%</b>,'
|
||
'复环轻笔 T3 = 35.5%,单环把笔宽推到 0.34 的 T5 = 48.6%。'
|
||
'所以<b>字母翻倍确实把带子填实了</b>(+7.3 个点),'
|
||
'而且填实的方式比单纯加粗好 —— 加粗是把每个字母变胖,'
|
||
'翻倍是把空隙补上。但即便如此,45.8% 仍意味着带子里一半以上是白的:'
|
||
'NOVALON 七个字母里 N、V、A、L 四个是骨架字,本身就不着墨,'
|
||
'而参照图那 12 个字母里 B、U、D、D、H、G、O、S 全是闭口或带粗竖的字。'
|
||
'这是字形层面的硬差异,参数调不平 —— 要更实只剩两条路:'
|
||
'把环上的字换成更闭口的构造(改字标),或者给环加一条细线收住。</p>')
|
||
|
||
P.append('<h2><span class="no">2</span>16×16 栅格</h2><div class="row">')
|
||
for nm, body, g, key, text, n, why in built[:3]:
|
||
P.append('<div class="cell"><pre data-g="%s@16">…</pre>'
|
||
'<div class="lab">%s @16</div></div>' % (key, key))
|
||
P.append('</div>')
|
||
|
||
P.append('<footer>生成器 <code>ring3.py</code>(复用 <code>ring2.py</code> 的螺旋解算与两道闸)· '
|
||
'参照图实测来自 <code>_refprobe.py</code>(1520×742 原图,luma<128 阈值,'
|
||
'行列 RLE 直读笔画宽)· 环上字母沿用 <code>novalon.py</code> 构造几何,'
|
||
'只改模块全局笔宽 T · 圆心四字取自 <code>public/logo.svg</code> 真迹路径,只缩放 · '
|
||
'repo 零改动</footer>')
|
||
|
||
P.append('<p id="ctrl" class="why">仪器对照:计算中…</p>')
|
||
|
||
P.append('<script>var BAND=' + json.dumps(BAND) + ';</script>')
|
||
P.append(r"""<script>
|
||
const WHT=[255,255,255];
|
||
function D(a,b){return Math.hypot(a[0]-b[0],a[1]-b[1],a[2]-b[2]);}
|
||
function isAny(p,a){return a>=40&&D(p,WHT)>=110;}
|
||
function ras(el,size){return new Promise(r=>{const s=new XMLSerializer().serializeToString(el);
|
||
const im=new Image(),cv=document.createElement('canvas');cv.width=size;cv.height=size;
|
||
const x=cv.getContext('2d');x.fillStyle='#fff';x.fillRect(0,0,size,size);
|
||
im.onload=()=>{x.drawImage(im,0,0,size,size);r(x.getImageData(0,0,size,size));};
|
||
im.onerror=()=>r(null);im.src='data:image/svg+xml;charset=utf-8,'+encodeURIComponent(s);});}
|
||
function rasSrc(src,size){return new Promise(r=>{const im=new Image();
|
||
const cv=document.createElement('canvas');cv.width=size;cv.height=size;
|
||
const x=cv.getContext('2d');x.fillStyle='#fff';x.fillRect(0,0,size,size);
|
||
im.onload=()=>{x.drawImage(im,0,0,size,size);r(x.getImageData(0,0,size,size));};
|
||
im.onerror=()=>r(null);im.src='data:image/svg+xml;charset=utf-8,'+encodeURIComponent(src);});}
|
||
function runs(im,px,vert){const d=im.data;let best=Infinity;
|
||
for(let a=0;a<px;a++){let c=0;
|
||
for(let b=0;b<px;b++){const i=((vert?b:a)*px+(vert?a:b))*4;
|
||
if(isAny([d[i],d[i+1],d[i+2]],d[i+3]))c++;else{if(c)best=Math.min(best,c);c=0;}}
|
||
if(c)best=Math.min(best,c);}
|
||
return best===Infinity?0:best;}
|
||
function grid(im,px){const d=im.data,g=[];for(let y=0;y<px;y++){let s='';
|
||
for(let x=0;x<px;x++){const i=(y*px+x)*4;
|
||
s+=(isAny([d[i],d[i+1],d[i+2]],d[i+3])?'#':'.');}g.push(s);}return g;}
|
||
/* 带填充率:只在解析环带 [rb(θ),ro(θ)] 内数墨点,按扇环面积 ro^2-rb^2 加权 */
|
||
function bandFill(gd,P){
|
||
const d=gd.data,N=512,cx=220,cy=220,k=N/440;
|
||
let sw=0,sf=0;
|
||
for(let a=0;a<360;a++){const e=P[a]; if(!e[0])continue;
|
||
const rb=e[1],ro=e[2]; if(!(ro>rb))continue;
|
||
const t=a*Math.PI/180, sx=Math.sin(t), sy=-Math.cos(t);
|
||
let dark=0,tot=0;
|
||
for(let r=rb;r<=ro;r+=0.5){
|
||
const px=(cx+sx*r)*k, py=(cy+sy*r)*k;
|
||
if(px<0||py<0||px>=N||py>=N)continue;
|
||
const i=(Math.floor(py)*N+Math.floor(px))*4;
|
||
tot++; if(isAny([d[i],d[i+1],d[i+2]],d[i+3]))dark++;
|
||
}
|
||
if(!tot)continue;
|
||
const w=ro*ro-rb*rb; sw+=w; sf+=w*(dark/tot);
|
||
}
|
||
return sw?100*sf/sw:0;
|
||
}
|
||
(async()=>{
|
||
const out={};
|
||
for(const el of document.querySelectorAll('svg[data-k]')){
|
||
const n=+el.dataset.k.split('@')[1];
|
||
const iS=await ras(el,n); if(!iS)continue;
|
||
const rec={hMin:runs(iS,n,false),vMin:runs(iS,n,true),g:grid(iS,n)};
|
||
if(n===512){const kk=el.dataset.k.split('@')[0];
|
||
rec.band=bandFill(iS,BAND[kk]);}
|
||
out[el.dataset.k]=rec;
|
||
}
|
||
/* 仪器自证。全白/满墨那一对只验墨色分类器,验不出圆心与缩放 ——
|
||
_bandfill.py 就是被这一点骗过的(把采样环整体偏了 36px,两个对照照样 0%/100%)。
|
||
真正的几何对照:按同一份 prof 画一枚**实心环带**去喂,圆心或缩放错了就掉。 */
|
||
{
|
||
const t=document.createElement('canvas');t.width=512;t.height=512;
|
||
const tc=t.getContext('2d');const P=BAND[Object.keys(BAND)[1]];
|
||
const blank=tc.getImageData(0,0,512,512);
|
||
const full=tc.createImageData(512,512);
|
||
for(let i=0;i<full.data.length;i+=4){full.data[i]=196;full.data[i+1]=30;
|
||
full.data[i+2]=58;full.data[i+3]=255;}
|
||
let outer=[],inner=[];
|
||
for(let a=0;a<360;a++){const e=P[a]; if(!e[0])continue;
|
||
const th=a*Math.PI/180;
|
||
outer.push((220+Math.sin(th)*e[2]).toFixed(2)+' '+(220-Math.cos(th)*e[2]).toFixed(2));
|
||
inner.push((220+Math.sin(th)*e[1]).toFixed(2)+' '+(220-Math.cos(th)*e[1]).toFixed(2));}
|
||
const dd='M '+outer.join(' L ')+' Z M '+inner.reverse().join(' L ')+' Z';
|
||
const src='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 440 440" '+
|
||
'width="512" height="512" style="width:512px;height:512px;display:block">'+
|
||
'<path d="'+dd+'" fill="#C41E3A" fill-rule="evenodd"/></svg>';
|
||
const gd=await rasSrc(src,512);
|
||
const c=document.getElementById('ctrl');
|
||
if(c)c.textContent='仪器对照:负样本全白 = '+bandFill(blank,P).toFixed(1)
|
||
+'% 应为 0.0 · 正样本满墨 = '+bandFill(full,P).toFixed(1)+'% 应为 100.0 · '
|
||
+'几何对照(按同一份 prof 画的实心环带,圆心/缩放一错就掉)= '
|
||
+(gd?bandFill(gd,P).toFixed(1):'n/a')+'% 应≈100.0';
|
||
}
|
||
document.querySelectorAll('[data-cell]').forEach(td=>{
|
||
const c=td.dataset.cell,at=c.lastIndexOf('@');
|
||
const k=c.slice(0,at),f=c.slice(at+1),o=out[k];if(!o)return;
|
||
if(f==='band')td.textContent=o.band.toFixed(1)+'%';
|
||
else if(f==='min'){const m=Math.min(o.hMin,o.vMin);td.textContent=m.toFixed(2)+'px';
|
||
td.className=m>=2?'pass':'fail';}
|
||
});
|
||
document.querySelectorAll('[data-g]').forEach(p=>{const o=out[p.dataset.g];
|
||
if(o)p.textContent=o.g.join(String.fromCharCode(10));});
|
||
window.__r3=out;
|
||
})();
|
||
</script>""")
|
||
P.append('</div></body></html>')
|
||
return "".join(P)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
html = build()
|
||
out = os.path.join(HERE, "ring3.html")
|
||
with open(out, "w", encoding="utf-8") as f:
|
||
f.write(html)
|
||
for nm, text, kw, dxfrac, why in VARIANTS:
|
||
dx = dxfrac * r2.layout(text=text, **kw)[1]["Rb0"]
|
||
body, g = r2.compose(text=text, dx=dx, **kw)
|
||
L = g["L"]
|
||
print("%-4s n=%2d ch0=%5.1f ch1=%5.1f Rb0=%5.1f ch/Rb=%.2f→%.2f 圆心=%5.1f 离环=%5.1f"
|
||
% (nm.split()[0], len(text), L["ch0"], L["ch1"], L["Rb0"],
|
||
L["ch0"] / L["Rb0"], L["ch1"] / L["Rb1"], g["csize"], g["clear"]))
|
||
print("ring3.html %s B" % format(len(html.encode("utf-8")), ","))
|