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 个文本/矢量件。
363 lines
19 KiB
Python
363 lines
19 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
泰 · 定稿细化(第二十七刀)
|
||
|
||
甲方裁定:走泰。当前问题:「稍微有点繁杂」。
|
||
|
||
先把"繁杂"变成可数的东西。现状版(第二十五刀)实测发出 **9 个独立块**:
|
||
3 根阳爻(各 1 块)+ 3 根阴爻(各断两截 = 6 块)
|
||
而且六行**等距**排布 —— 没有分组就没有主次,眼睛没有落脚点。
|
||
所以繁杂的来源不是弧弯、不是齿、不是颜色,是 **块数 × 无层级**。
|
||
|
||
细化的唯一变量:把行数与层级降下来。
|
||
泰的语义最小签名其实只要两件事:**阳在下、阴在上**(天气上升、地气下降,二气交)。
|
||
六爻是它的完整写法,两行是它的本质写法。
|
||
|
||
复杂度用两个客观量:
|
||
块数 —— 发出的独立形个数
|
||
规一化周长 P/√A —— 形状学的标准复杂度量(同面积下周长越长越碎)
|
||
"""
|
||
import importlib.util
|
||
import json
|
||
import math
|
||
import os
|
||
import re
|
||
|
||
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
|
||
|
||
|
||
n5 = load("n5", os.path.join(HERE, "n5-refine.py"))
|
||
RED = "#C41E3A"
|
||
WHITE = "#FFFFFF"
|
||
PAPER = "#F7F4EF"
|
||
VB = 256.0
|
||
C = VB / 2.0
|
||
|
||
|
||
def bowbar(x0, x1, y, t, sag):
|
||
xc = (x0 + x1) / 2.0
|
||
return ("M %g %g Q %g %g %g %g L %g %g Q %g %g %g %g Z"
|
||
% (x0, y, xc, y + 2 * sag, x1, y,
|
||
x1, y + t, xc, y + t + 2 * sag, x0, y + t))
|
||
|
||
|
||
def build_mark(spec):
|
||
"""spec: lines 自下而上 'y'/'n';t 厚;gi 组内缝;gm 组间缝;
|
||
brk 破格量;brk_at 破格在哪一根(**自下而上**计数);
|
||
split 阴爻断口;uneven 两列不等宽;bow 弧弯。
|
||
返回 (svg, 块数, 面积, 周长)。
|
||
|
||
⚠ 这里有个会翻转语义的坑:lines 是自下而上的卦画顺序,而 SVG 的 y 自上而下增大。
|
||
若直接按 lines[0] 起笔画在最上方,泰(阳下阴上)会被画成否(阴下阳上)——
|
||
一整条「天地交」的论点就反了。所以先 reversed 再画,brk_at 也要换算。"""
|
||
t = spec["t"]
|
||
gi = spec["gi"]
|
||
gm = spec.get("gm", gi)
|
||
groups = spec["groups"]
|
||
lines = spec["lines"] # 自下而上
|
||
topdown = lines[::-1] # 自上而下 = 真正要画的顺序
|
||
brk_at_top = len(lines) - 1 - spec.get("brk_at", -1)
|
||
total_h = len(lines) * t + sum(g - 1 for g in groups) * gi + (len(groups) - 1) * gm
|
||
W = spec.get("W", 196.0)
|
||
x0 = C - W / 2.0
|
||
split = spec.get("split", 22.0)
|
||
uneven = spec.get("uneven", 0.0)
|
||
brk = spec.get("brk", 0.0)
|
||
bow = spec.get("bow", 6.0)
|
||
|
||
# 画布 y 越大越靠下。上一版把起点写成 C + total_h/2 却当"顶"用,
|
||
# 于是从底边往上画,泰被画成否(坤下乾上 = 天地不交)—— 论点整个翻转。
|
||
# 起点必须是真正的顶边,并且逐行向下推进。
|
||
y = C - total_h / 2.0
|
||
out = []
|
||
area = 0.0
|
||
perim = 0.0
|
||
idx = 0 # topdown 索引
|
||
for gno, gsize in enumerate(groups):
|
||
for k in range(gsize):
|
||
kind = topdown[idx]
|
||
extra = brk if idx == brk_at_top else 0.0
|
||
if kind == "y":
|
||
out.append('<path d="%s"/>' % bowbar(x0, x0 + W + extra, y, t, bow))
|
||
area += (W + extra) * t
|
||
perim += 2 * ((W + extra) + t)
|
||
else:
|
||
lw = (W - split) / 2.0 - uneven / 2.0
|
||
rw = (W - split) / 2.0 + uneven / 2.0
|
||
out.append('<path d="%s"/>' % bowbar(x0, x0 + lw, y, t, bow))
|
||
out.append('<path d="%s"/>' % bowbar(x0 + lw + split, x0 + W + extra, y, t, bow))
|
||
area += (lw + rw + extra) * t
|
||
perim += 2 * (lw + t) + 2 * (rw + extra + t)
|
||
idx += 1
|
||
if k < gsize - 1:
|
||
y += t + gi
|
||
if gno < len(groups) - 1:
|
||
y += t + gm
|
||
# 裸 <path> 没有 fill 会被浏览器画成黑色 —— 上一版七档全黑、
|
||
# 反白格黑压黑,墨率实测 0.3~0.9% 全是废数。颜色必须显式给。
|
||
body = '<g fill="%s">%s</g>' % (spec.get("col", RED), "".join(out))
|
||
assert_tai(body) # 每次生成都验方向;画成否就当场炸,不留到看图
|
||
return body, len(out), area, perim
|
||
|
||
|
||
def assert_tai(body):
|
||
"""常驻门禁:从发出的几何反推卦画,不读输入常量。
|
||
泰的不变量(也是它与否唯一的区别):**顶行带断口(阴)、底行是整根(阳)、
|
||
且自上而下只允许一次 n→y 转换**。这条对六爻、四行、两行同样成立,
|
||
所以压缩档也受保护。
|
||
上一版把起点当"顶"用、实际是底边,整挂翻成否(天地不交),
|
||
而输入常量看起来完全正确 —— 只有反推发出的几何才抓得到。"""
|
||
segs = re.findall(r'M\s+([-\d.eE+]+)\s+([-\d.eE+]+)\s+Q[^L]*L\s+([-\d.eE+]+)\s+([-\d.eE+]+)', body)
|
||
rows = {}
|
||
for x0, y0, x1, y1 in segs:
|
||
rows.setdefault(round(float(y0), 1), []).append(float(x1) - float(x0))
|
||
topdown = ["n" if len(rows[y]) > 1 else "y" for y in sorted(rows)]
|
||
seq = "".join(topdown)
|
||
ok = (topdown[0] == "n" and topdown[-1] == "y"
|
||
and re.fullmatch(r"n+y+", seq) is not None)
|
||
if not ok:
|
||
raise AssertionError("不是泰:自上而下读作 %s(须为 n+y+,即顶断底整、只一次转换)" % seq)
|
||
return seq
|
||
|
||
|
||
def complexity(perim, area):
|
||
return perim / math.sqrt(area) if area > 0 else 0.0
|
||
|
||
|
||
# ---------------------------------------------------------------- 阶梯
|
||
Rungs = [
|
||
("R1 现状", "第二十五刀原样",
|
||
dict(lines="yyynnn", groups=[3, 3], t=21, gi=13, gm=13,
|
||
split=22, brk=22, brk_at=2, bow=6),
|
||
"9 块、六行等距无层级 —— 这就是「繁杂」的量化形态。"),
|
||
("R2 分组", "组内紧、组间松",
|
||
dict(lines="yyynnn", groups=[3, 3], t=21, gi=7, gm=26,
|
||
split=22, brk=22, brk_at=2, bow=6),
|
||
"行数不动,靠邻近关系把 6 行收成 2 团。信息全留,事件数降。"),
|
||
("R3 分组+去破格", "减一个动作",
|
||
dict(lines="yyynnn", groups=[3, 3], t=21, gi=7, gm=26,
|
||
split=22, brk=0, bow=6),
|
||
"对照:分组之后还需要破格吗?六行时不需要,因为齿与断口已经够多。"),
|
||
("R4 四行", "2 阳 + 2 阴",
|
||
dict(lines="yynn", groups=[2, 2], t=24, gi=9, gm=30,
|
||
split=24, brk=20, brk_at=1, bow=7),
|
||
"压到四行。仍是「下实上虚」的方向关系,但不再是严格卦画 —— 语义要打折。"),
|
||
("R5 三行", "2 阳 + 1 阴",
|
||
dict(lines="yyn", groups=[1, 2], t=26, gi=10, gm=32,
|
||
split=26, brk=22, brk_at=1, bow=7),
|
||
"三行。注意:三爻成经卦,2 阳 1 阴是「兑/巽/革」之一,已经不是泰。"),
|
||
("R6 两行·最小签名", "1 阳在下 + 1 阴在上",
|
||
dict(lines="yn", groups=[1, 1], t=30, gi=0, gm=40,
|
||
split=30, brk=26, brk_at=0, bow=8),
|
||
"泰的本质就是这一条:阳在下、阴在上,二气交。两行、3 块,最简。"),
|
||
("R7 两行·不等宽", "修掉「两列等宽」这条未达",
|
||
dict(lines="yn", groups=[1, 1], t=30, gi=0, gm=40,
|
||
split=30, brk=26, brk_at=0, bow=8, uneven=18),
|
||
"参照图第二条成因:两列不等宽。左窄右宽,重心才偏得出去。"),
|
||
]
|
||
|
||
|
||
def svg(inner, px, key=None):
|
||
k = ' data-k="%s"' % key if key else ""
|
||
return ('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 %g %g" '
|
||
'width="%d" height="%d" style="width:%dpx;height:%dpx;display:block"%s>%s</svg>'
|
||
% (VB, VB, px, px, px, px, k, inner))
|
||
|
||
|
||
def tile(inner, px, key=None, bg=PAPER):
|
||
return ('<span class="tl" style="background:%s">%s</span>'
|
||
% (bg, svg(inner, px, key)))
|
||
|
||
|
||
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:1140px;margin:0 auto;padding:48px 32px 100px}
|
||
.ey{font:12px/1.4 "PingFang SC",Inter,sans-serif;letter-spacing:.16em;text-transform:uppercase;color:#8A8377}
|
||
h1{font-size:52px;line-height:1.14;color:#26221E;margin:12px 0 14px;font-weight:600}
|
||
h1 em{font-style:normal;color:#C41E3A}
|
||
h2{font-size:25px;color:#26221E;margin:64px 0 6px;font-weight:600}
|
||
h2 .no{color:#C41E3A;margin-right:10px}
|
||
p{max-width:74ch;margin:9px 0}
|
||
.lede{font-size:19px;color:#26221E;max-width:70ch}
|
||
.tl{display:inline-flex;align-items:center;justify-content:center;border-radius:22.5%;overflow:hidden;
|
||
box-shadow:0 0 0 1px #DDD6CB}
|
||
.tl svg{display:block}
|
||
.card{background:#fff;border:1px solid #E2DDD3;padding:20px 22px;margin:0 0 14px}
|
||
.card .hd{display:flex;justify-content:space-between;align-items:baseline;gap:16px;margin-bottom:12px}
|
||
.card .nm{font-weight:650;color:#26221E;font-size:16px;font-family:"PingFang SC",Inter,sans-serif}
|
||
.card .cx{font:12px/1 "PingFang SC",Inter,sans-serif;color:#8A8377;font-variant-numeric:tabular-nums}
|
||
.row{display:flex;gap:20px;align-items:flex-end;flex-wrap:wrap}
|
||
.cell{text-align:center}
|
||
.cell .lab{font:11.5px/1.5 "PingFang SC",Inter,sans-serif;color:#8A8377;margin-top:7px}
|
||
.why{font-size:14px;color:#6b6357;margin:10px 0 0;max-width:82ch}
|
||
.warn{color:#C41E3A;font-weight:600}
|
||
table{border-collapse:collapse;width:100%;margin:14px 0;font:14px/1.6 "PingFang SC",Inter,sans-serif}
|
||
th,td{padding:10px 12px;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}
|
||
.lock{background:#fff;border:1px solid #E2DDD3;padding:26px 30px;margin:14px 0}
|
||
.q{border-left:2px solid #C41E3A;padding:2px 0 2px 16px;margin:14px 0;color:#26221E;max-width:78ch}
|
||
footer{margin-top:60px;padding-top:16px;border-top:1px solid #C3BDB1;
|
||
font:12.5px/1.7 "PingFang SC",Inter,sans-serif;color:#8A8377}
|
||
"""
|
||
|
||
JS = r"""<script>
|
||
const WHT=[255,255,255],REDc=[196,30,58],INKc=[38,34,30];
|
||
function D(a,b){return Math.hypot(a[0]-b[0],a[1]-b[1],a[2]-b[2]);}
|
||
function isRed(p,a){return a>=40&&D(p,WHT)>=110&&D(p,REDc)<D(p,INKc);}
|
||
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 ink(im){const d=im.data;let n=0;for(let i=0;i<d.length;i+=4){
|
||
if(isRed([d[i],d[i+1],d[i+2]],d[i+3]))n++;}return 100*n/(d.length/4);}
|
||
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(isRed([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,a=d[i+3],p=[d[i],d[i+1],d[i+2]];
|
||
s+=(isRed(p,a)?'#':'.');}g.push(s);}return g;}
|
||
(async()=>{
|
||
const out={};
|
||
for(const el of document.querySelectorAll('svg[data-k]')){
|
||
const i16=await ras(el,16), i512=await ras(el,512);
|
||
if(!i16) continue;
|
||
out[el.dataset.k]={ink16:ink(i16),ink512:ink(i512),
|
||
hMin:runs(i16,16,false), vMin:runs(i16,16,true), g:grid(i16,16)};
|
||
}
|
||
document.querySelectorAll('[data-cell]').forEach(td=>{
|
||
const cell=td.dataset.cell, at=cell.lastIndexOf('@');
|
||
const k=cell.slice(0,at), f=cell.slice(at+1);
|
||
const o=out[k]; if(!o) return;
|
||
if(f==='ink'){td.textContent=o.ink512.toFixed(1)+'%';}
|
||
else if(f==='hmin'){td.textContent=o.hMin+'px';td.className=o.hMin>=2?'pass':'fail';}
|
||
else if(f==='vmin'){td.textContent=o.vMin+'px';td.className=o.vMin>=2?'pass':'fail';}
|
||
else if(f==='drift'){const d=Math.abs(o.ink512-o.ink16);td.textContent=d.toFixed(1)+'pt';
|
||
td.className=d<6?'pass':'fail';}
|
||
});
|
||
document.querySelectorAll('[data-g]').forEach(pre=>{
|
||
const o=out[pre.dataset.g]; if(o) pre.textContent=o.g.join(String.fromCharCode(10));});
|
||
window.__t2=out;
|
||
})();
|
||
</script>
|
||
"""
|
||
|
||
|
||
def build():
|
||
H = ['<!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">']
|
||
H.append('<div class="ey">Cut 27 · 2026-10-14 · 定稿细化 · repo 零改动</div>')
|
||
H.append('<h1>泰 · <em>降事件数</em></h1>')
|
||
H.append('<p class="lede">「繁杂」我先把它变成可数的:现状版发出 <b>9 个独立块</b>,'
|
||
'而且六行<b>等距</b>排布 —— 没有分组就没有主次,眼睛没有落脚点。'
|
||
'所以繁杂的来源不是弧弯、不是齿、不是颜色,是<b>块数 × 无层级</b>。'
|
||
'这一页只动这两个变量,给七档阶梯,你挑一档定稿。</p>')
|
||
|
||
H.append('<h2><span class="no">1</span>阶梯</h2>')
|
||
stats = []
|
||
for name, sub, spec, why in Rungs:
|
||
body, nb, area, perim = build_mark(spec)
|
||
cx = complexity(perim, area)
|
||
stats.append((name, nb, cx, spec))
|
||
H.append('<div class="card"><div class="hd"><span class="nm">%s</span>'
|
||
'<span class="cx">%d 块 · 规一化周长 %.2f</span></div><div class="row">'
|
||
% (name, nb, cx))
|
||
for px in (170, 96, 48, 32, 16):
|
||
H.append('<div class="cell">%s<div class="lab">%dpx</div></div>'
|
||
% (tile(body, px, "%s@%d" % (name.split()[0], px)), px))
|
||
H.append('<div class="cell"><span class="tl" style="background:#141210">%s</span>'
|
||
'<div class="lab">暖墨底反白</div></div>'
|
||
% svg(body.replace(RED, WHITE), 96))
|
||
H.append('</div><p class="why">%s</p></div>' % why)
|
||
|
||
H.append('<h2><span class="no">2</span>语义代价要说清楚</h2>')
|
||
H.append('<p>降行数不是免费的。六爻是泰的<b>完整写法</b>,也才成立那句'
|
||
'「六爻 = 6 位二进制、与 0–63 同构」。压到四行或两行,'
|
||
'<b>卦画不再严格</b>,二进制那条叙事就得从「符号本身就是数」降级为'
|
||
'「符号是数的抽象」。</p>')
|
||
H.append('<div class="q"><b>两行版仍然准确地是泰</b>,因为它保住了泰唯一的定义性关系:'
|
||
'阳在下、阴在上(天气上升、地气下降,二气交)。'
|
||
'否卦正是反过来。所以两行不是"简化到失真",是<b>简化到只剩判据</b>。'
|
||
'<i>《彖》:「天地交而万物通也,上下交而其志同也。」</i></div>')
|
||
H.append('<p>我的建议:<b>定稿取 R2(分组六爻)做主标,R7(两行不等宽)做简码</b>。'
|
||
'理由是 R2 保住完整卦画与二进制叙事、又用邻近关系把 6 行收成 2 团;'
|
||
'而 R7 天然是 R2 的「只剩判据」版,两档同源、降档发生在系统内部。'
|
||
'R4/R5 是两头不靠的中间态,我不建议。</p>')
|
||
|
||
H.append('<h2><span class="no">3</span>实测</h2>')
|
||
H.append('<table><thead><tr><th>档</th><th class="n">块数</th><th class="n">规一化周长</th>'
|
||
'<th class="n">横向最细@16</th><th class="n">竖向最细@16</th>'
|
||
'<th class="n">墨率@512</th><th class="n">漂移</th></tr></thead><tbody>')
|
||
for (name, nb, cx, spec) in stats:
|
||
k = name.split()[0]
|
||
H.append('<tr><td><b>%s</b></td><td class="n">%d</td><td class="n">%.2f</td>'
|
||
'<td class="n" data-cell="%s@16@hmin">…</td>'
|
||
'<td class="n" data-cell="%s@16@vmin">…</td>'
|
||
'<td class="n" data-cell="%s@16@ink">…</td>'
|
||
'<td class="n" data-cell="%s@16@drift">…</td></tr>'
|
||
% (name, nb, cx, k, k, k, k))
|
||
H.append('</tbody></table>')
|
||
H.append('<p>规一化周长 = 总周长 ÷ √总面积,是形状学里衡量「同面积下有多碎」的标准量。'
|
||
'块数与它一起,就是"繁杂"的两个客观投影。横竖两个方向的最细特征都量——'
|
||
'上一刀的教训是只扫横向会把弯边毛刺误判成死形。</p>')
|
||
|
||
H.append('<h2><span class="no">4</span>16×16 栅格</h2><div class="row">')
|
||
for (name, nb, cx, spec) in stats:
|
||
k = name.split()[0]
|
||
H.append('<div class="cell"><pre style="font:9.5px/1.15 ui-monospace,Menlo,monospace;'
|
||
'margin:0;text-align:left" data-g="%s@16">…</pre>'
|
||
'<div class="lab">%s</div></div>' % (k, k))
|
||
H.append('</div>')
|
||
|
||
H.append('<h2><span class="no">5</span>落款位(两档并看)</h2>')
|
||
r2 = build_mark(Rungs[1][2])[0]
|
||
r7 = build_mark(Rungs[6][2])[0]
|
||
for nm, body in (("R2 分组六爻 · 主标", r2), ("R7 两行 · 简码", r7)):
|
||
h = 45.4 * 0.40
|
||
k = h / VB
|
||
H.append('<div class="lock"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 120" '
|
||
'width="480" height="120" style="width:480px;height:120px">%s'
|
||
'<g transform="translate(%g,%g) scale(%g) translate(%g,%g)">%s</g></svg>'
|
||
'<div style="font:12px/1.6 Inter,sans-serif;color:#8A8377;margin-top:8px">%s'
|
||
' · 块高 = 字标块高 0.40 倍,落「遠」右下</div></div>'
|
||
% (n5.wordmark_fixed(), 306.3 + 4, 66.3 - h + 2, k, -C, -C, body, nm))
|
||
|
||
H.append('<footer>生成器 <code>tai2.py</code> · 卦画依据《周易》泰卦(乾下坤上)· '
|
||
'块数与规一化周长为解析计算,横竖最细/墨率/漂移为本页浏览器 16×16 与 512×512 栅格实测 · '
|
||
'repo 零改动</footer>')
|
||
H.append(JS)
|
||
H.append('</div></body></html>')
|
||
return "".join(H)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
html = build()
|
||
out = os.path.join(HERE, "tai2.html")
|
||
with open(out, "w", encoding="utf-8") as f:
|
||
f.write(html)
|
||
os.makedirs(os.path.join(HERE, "assets-tai2"), exist_ok=True)
|
||
for name, sub, spec, why in Rungs:
|
||
body, nb, area, perim = build_mark(spec)
|
||
k = name.split()[0]
|
||
with open(os.path.join(HERE, "assets-tai2", k + ".svg"), "w", encoding="utf-8") as fh:
|
||
fh.write('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 %g %g">%s</svg>'
|
||
% (VB, VB, body))
|
||
print("%-10s %d 块 P/sqrtA=%.2f" % (k, nb, complexity(perim, area)))
|
||
print("tai2.html %s B" % format(len(html.encode("utf-8")), ","))
|