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 个文本/矢量件。
336 lines
18 KiB
Python
336 lines
18 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
花边印(第二十六刀)· 参照 眞木絢未 / Ayami Maki
|
||
|
||
核到的人:眞木絢未(Ayami Maki),桑沢デザイン研究所 2018 视觉设计毕业,
|
||
东京广告公司与 IT 企业五年设计师/艺术指导,现为自由设计师。
|
||
早年在桑沢参与「シブヤフォント」项目的图案设计(logo 雑賀吉人/direction 磯村歩)。
|
||
作品集 ayamimaki.myportfolio.com:YUPPA、ASUKA SOEJIMA ILLUSTRATED LOGO、
|
||
HITOTOBA DESIGN INC.、TEISANSO、HIDDEN INVENTORY MANGA、MAJICO、ONE JAPAN 等。
|
||
|
||
从她作品里读出的、可迁移的三条(其余不迁,见文件末「不迁的」):
|
||
|
||
迁 1 花边形外廓(ASUKA SOEJIMA 那枚压印)
|
||
我此前所有「圆」的尝试都是光滑凸卵形,被本项目自己的剪影律判死
|
||
(光滑凸卵形放进主标识读作贴上去的 UI 符号)。
|
||
⇒ 花瓣边不是光滑凸卵形:它有齿、不规则、是「刻/压」出来的轮廓。
|
||
这是二十六刀里唯一没试过的合法圆形变体。
|
||
|
||
迁 2 一枚剪影扛两个读法(HITOTOBA=房屋剪影里白切人字梁;
|
||
HIDDEN INVENTORY=卷轴↔胶片筒;YUPPA=平假名画成湯葉带状)
|
||
⇒ 我方印是「红底白字」单读法。加一条白路穿过印面,
|
||
它同时是刻痕与「致远」的路 —— 双读,不是加装饰。
|
||
|
||
迁 3 一个主色 + 全场只给一点第二色(TEISANSO:深绿+金线+唯一一点朱家纹)
|
||
⇒ 比现在的单红系统更有层次,且天然满足「红 ≤8% 且只走整块/极小点」。
|
||
|
||
更正一条我自己记错的规则:
|
||
原记「hairline 几何框 = 廉价」。MAJICO 与 TEISANSO 都是细线且不廉价。
|
||
⇒ 真判据不是线粗,是那条线有没有传统纹样的具体性(水引结、家纹、花边),
|
||
还是泛用的现代几何框。
|
||
|
||
不迁的:她的插画性(matcha café / 个人印章 / 漫画 的语境)与手写温度直接搬给
|
||
一家向制造业与金融业卖架构咨询的公司会掉专业感 —— 参照研究给过同一条结论
|
||
(具象山水插画在咨询语境=装饰)。所以只取「轮廓生成方式」与「双读」这两层结构。
|
||
"""
|
||
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"))
|
||
sl = load("sl", os.path.join(HERE, "seal.py"))
|
||
|
||
RED = "#C41E3A"
|
||
WHITE = "#FFFFFF"
|
||
PAPER = "#F7F4EF"
|
||
VB = 256.0
|
||
C = VB / 2.0
|
||
RUI = sl.RUI
|
||
GX0, GX1, GY0, GY1 = sl.GX0, sl.GX1, sl.GY0, sl.GY1
|
||
GW, GH, GOX, GOY = sl.GW, sl.GH, sl.GOX, sl.GOY
|
||
|
||
|
||
def scallop(R0, rb, lobes, n=720):
|
||
"""花边形轮廓:r(θ) = R0 + rb·cos(lobes·θ)。
|
||
rb/R0 与 lobes 一起决定它是「菊纹」还是「威化饼」。"""
|
||
pts = []
|
||
for i in range(n):
|
||
th = 2 * math.pi * i / n
|
||
r = R0 + rb * math.cos(lobes * th)
|
||
pts.append((C + r * math.cos(th), C + r * math.sin(th)))
|
||
return pts
|
||
|
||
|
||
def poly(pts, col=RED):
|
||
return '<polygon points="%s" fill="%s"/>' % (
|
||
" ".join("%g,%g" % p for p in pts), col)
|
||
|
||
|
||
def glyph(scale_to, col=WHITE, rot=0.0):
|
||
k = scale_to / max(GW, GH)
|
||
tr = 'translate(%g,%g) scale(%g) rotate(%g) translate(%g,%g)' % (C, C, k, rot, -GOX, -GOY)
|
||
return '<g transform="%s"><path d="%s" fill="%s"/></g>' % (tr, RUI, col)
|
||
|
||
|
||
def hanamichi(lobes=16, rb_frac=0.055, fill=0.90, chip=False, road=False, col=RED):
|
||
"""花边白文睿印。
|
||
chip = 保留一处磕崩(本项目 L4 的受控偏差)
|
||
road = 迁 2:一条白路横穿印面右缘,印面与「致远」双读"""
|
||
R0 = VB * 0.395
|
||
rb = R0 * rb_frac * 2.0
|
||
pts = scallop(R0, rb, lobes)
|
||
body = poly(pts, col)
|
||
if chip:
|
||
# 用底色块在右上咬一口 —— 花边的齿被切断,才看得出是「压崩」不是「画圆」
|
||
a = R0 * 0.30
|
||
body += ('<polygon points="%g,%g %g,%g %g,%g" fill="%s"/>'
|
||
% (C + R0 - a, C - R0, C + R0 + 6, C - R0, C + R0 + 6, C - R0 + a, PAPER))
|
||
body += glyph(VB * 0.80 * fill * (1 - 2 * rb_frac))
|
||
if road:
|
||
t = VB * 0.052
|
||
body += ('<rect x="%g" y="%g" width="%g" height="%g" fill="%s"/>'
|
||
% (C - VB * 0.02, C + VB * 0.10, VB * 0.42, t, WHITE))
|
||
body += ('<polygon points="%g,%g %g,%g %g,%g" fill="%s"/>'
|
||
% (C + VB * 0.40, C + VB * 0.075, C + VB * 0.40, C + VB * 0.10 + t + 0.001,
|
||
C + VB * 0.47, C + VB * 0.10 + t / 2.0, WHITE))
|
||
return body
|
||
|
||
|
||
def square_control(fill=0.90):
|
||
return sl.seal(bars_ratio=0.105, fill=fill, chip=0.070)
|
||
|
||
|
||
def svg(inner, px):
|
||
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</svg>'
|
||
% (VB, VB, px, px, px, px, inner))
|
||
|
||
|
||
def tile(inner, px, key=None, bg=PAPER):
|
||
k = ' data-k="%s"' % key if key else ""
|
||
return ('<span class="tl" style="background:%s">'
|
||
'<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>'
|
||
'</span>' % (bg, VB, VB, px, px, px, px, k, inner))
|
||
|
||
|
||
FORMS = [
|
||
("F1", "16 齿·rb 5.5%", dict(lobes=16, rb_frac=0.055),
|
||
"基准。齿数与 ASUKA SOEJIMA 那枚压印接近。"),
|
||
("F2", "12 齿·rb 8%", dict(lobes=12, rb_frac=0.080),
|
||
"齿少而深 —— 更像菊纹,也更像刻的;风险是读作饼干模子。"),
|
||
("F3", "24 齿·rb 4%", dict(lobes=24, rb_frac=0.040),
|
||
"齿多而浅 —— 往「水引/和纸纹」靠,16px 下齿会被抹平。"),
|
||
("F4", "16 齿+磕崩", dict(lobes=16, rb_frac=0.055, chip=True),
|
||
"加本项目那条受控偏差:花边被切断一处,才读得出是压崩不是画圆。"),
|
||
("F5", "16 齿+白路", dict(lobes=16, rb_frac=0.055, road=True),
|
||
"迁 2 的双读:一条白路穿出印面 —— 既是刻痕,也是「致远」。"),
|
||
("F6", "方印(现状)", dict(_sq=True),
|
||
"对照:上一刀的方形白文睿印。"),
|
||
]
|
||
|
||
|
||
def render(f):
|
||
kw = dict(f[2])
|
||
if kw.pop("_sq", False):
|
||
return square_control()
|
||
return hanamichi(**kw)
|
||
|
||
|
||
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}
|
||
.q{border-left:2px solid #C41E3A;padding:2px 0 2px 16px;margin:14px 0;color:#26221E;max-width:78ch}
|
||
.q i{display:block;font-style:normal;font:12px/1.6 "PingFang SC",Inter,sans-serif;color:#8A8377;margin-top:5px}
|
||
.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}
|
||
.row{display:flex;gap:22px;align-items:flex-end;flex-wrap:wrap;margin:18px 0}
|
||
.cell{text-align:center}
|
||
.cell .lab{font:12px/1.55 "PingFang SC",Inter,sans-serif;color:#8A8377;margin-top:8px;max-width:170px}
|
||
.card{background:#fff;border:1px solid #E2DDD3;padding:20px 22px;margin:0 0 16px}
|
||
.card .hd{font-weight:600;color:#26221E;margin-bottom:12px;font-size:15px;
|
||
font-family:"PingFang SC",Inter,sans-serif}
|
||
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}
|
||
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],PPR=[247,244,239];
|
||
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=>{
|
||
// 键是三段(F1@16@hmin),必须按最后一个 @ 切;
|
||
// 上一版按 '@' 切成两段取 [k,f],f 拿到的是尺寸不是字段名,整表查不到值。
|
||
const cell=td.dataset.cell; const 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>=1?'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.__mk=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 26 · 2026-10-14 · 参照 眞木絢未 / Ayami Maki · repo 零改动</div>')
|
||
H.append('<h1>花边印:<em>把她真正可迁移的那一层拿走</em></h1>')
|
||
H.append('<p class="lede">眞木絢未,桑沢デザイン研究所 2018 视觉设计毕业,'
|
||
'东京广告公司与 IT 企业五年后独立,现自由设计师。'
|
||
'她的世界是插画性的、手作温度的——那部分<b>不能搬</b>:'
|
||
'把 matcha café 与个人印章的语境直接给一家向制造业和金融业卖架构咨询的公司,会掉专业感。'
|
||
'能搬的是两层结构:<b>轮廓的生成方式</b>与<b>一枚剪影扛两个读法</b>。</p>')
|
||
|
||
H.append('<h2><span class="no">1</span>读出来的三条,与一条自我更正</h2>')
|
||
for t, src in [
|
||
("<b>花边形外廓。</b>她给插画师 ASUKA SOEJIMA 做的那枚是扇贝边圆压印,中间手绘小人、文字绕边。"
|
||
"我此前所有「圆」的尝试都是光滑凸卵形,被本项目自己的剪影律判死。"
|
||
"而花瓣边<b>不是光滑凸卵形</b>——有齿、不规则、是刻/压出来的轮廓。"
|
||
"这是二十六刀里唯一没试过的合法圆形变体。", "ASUKA SOEJIMA ILLUSTRATED LOGO"),
|
||
("<b>一枚剪影扛两个读法。</b>HITOTOBA 是房屋剪影里用白色负形切出人字梁;"
|
||
"HIDDEN INVENTORY 是卷轴↔胶片筒;YUPPA 是平假名直接画成湯葉的带状——字即物。"
|
||
"我方印是「红底白字」单读法,加一条白路穿出印面,它同时是刻痕与「致远」的路。",
|
||
"HITOTOBA DESIGN INC. / HIDDEN INVENTORY MANGA / YUPPA"),
|
||
("<b>一个主色 + 全场只给一点第二色。</b>TEISANSO 是深绿底+金线描,"
|
||
"整幅只有家纹那一小块是朱红。比我现在的单红系统更有层次,"
|
||
"且天然满足「红 ≤8%、只走整块或极小点」。", "TEISANSO"),
|
||
("<b>更正我自己记错的一条规则。</b>原记「hairline 几何框 = 廉价」。"
|
||
"MAJICO 是水引结环套几何多面圆、TEISANSO 大量细金线,两者都不廉价。"
|
||
"⇒ 真判据不是线粗,是那条线<b>有没有传统纹样的具体性</b>(水引结、家纹、花边),"
|
||
"还是泛用的现代几何框。", "MAJICO / TEISANSO"),
|
||
]:
|
||
H.append('<div class="q">%s<i>出处:%s</i></div>' % (t, src))
|
||
|
||
H.append('<h2><span class="no">2</span>六种轮廓,同一支笔</h2>')
|
||
H.append('<p>印文一律用字标组里的毛笔真迹「睿」(9 子路径 / 197 点),'
|
||
'只换外廓。这样比的是轮廓,不是手上功夫。</p>')
|
||
for f in FORMS:
|
||
key, lab, kw, why = f
|
||
body = render(f)
|
||
H.append('<div class="card"><div class="hd">%s · %s</div><div class="row">' % (key, lab))
|
||
for px in (180, 96, 48, 32, 16):
|
||
H.append('<div class="cell">%s<div class="lab">%dpx</div></div>'
|
||
% (tile(body, px, "%s@%d" % (key, px)), px))
|
||
H.append('<div class="cell"><span class="tl" style="background:#C41E3A">'
|
||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 %g %g" width="96" height="96" '
|
||
'style="width:96px;height:96px;display:block">%s</svg></span>'
|
||
'<div class="lab">朱砂底反白</div></div>'
|
||
% (VB, VB, render(f).replace(RED, "\x00").replace(WHITE, RED).replace("\x00", WHITE)))
|
||
H.append('</div><p style="font-size:14px;color:#6b6357;margin:8px 0 0">%s</p></div>' % why)
|
||
|
||
H.append('<h2><span class="no">3</span>落款位(款识关系不变)</h2>')
|
||
H.append('<p>外廓换成花边,位置规则不动:印在「遠」右下,块高取字标块高 0.34 倍,'
|
||
'旁边不再出现第二处红。</p>')
|
||
best = hanamichi(lobes=16, rb_frac=0.055, chip=True)
|
||
k = (sl.CAL_H * 0.34) / 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>'
|
||
% (n5.wordmark_fixed(), sl.CAL_X1 + 4, sl.CAL_Y1 - sl.CAL_H * 0.34 + 2, k, -C, -C, best))
|
||
|
||
H.append('<h2><span class="no">4</span>实测</h2>')
|
||
H.append('<p>最细特征这次<b>横竖都量</b>:上一刀的教训是弯边会切出 1px 毛刺,'
|
||
'只扫横向会把好形误判成死形。花边的齿是横向特征,印文笔画是竖向特征,两个都得看。</p>')
|
||
H.append('<table><thead><tr><th>档</th><th class="n">横向最细@16</th>'
|
||
'<th class="n">竖向最细@16</th><th class="n">墨率@512</th>'
|
||
'<th class="n">漂移</th></tr></thead><tbody>')
|
||
for f in FORMS:
|
||
key = f[0]
|
||
H.append('<tr><td><b>%s %s</b></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>'
|
||
% (key, f[1], key, key, key, key))
|
||
H.append('</tbody></table>')
|
||
H.append('<h3>16×16 栅格</h3><div class="row">')
|
||
for f in FORMS:
|
||
key = f[0]
|
||
H.append('<div class="cell"><pre style="font:10px/1.2 ui-monospace,Menlo,monospace;'
|
||
'margin:0;text-align:left" data-g="%s@16">…</pre>'
|
||
'<div class="lab">%s</div></div>' % (key, key))
|
||
H.append('</div>')
|
||
|
||
H.append('<footer>生成器 <code>maki.py</code> · 印文=<code>_wm-chars.json</code> 第 1 字真迹路径 · '
|
||
'参照 眞木絢未 / Ayami Maki 作品集 ayamimaki.myportfolio.com · '
|
||
'数值为本页浏览器栅格实测 · repo 零改动</footer>')
|
||
H.append(JS)
|
||
H.append('</div></body></html>')
|
||
return "".join(H)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
html = build()
|
||
out = os.path.join(HERE, "maki.html")
|
||
with open(out, "w", encoding="utf-8") as f:
|
||
f.write(html)
|
||
os.makedirs(os.path.join(HERE, "assets-maki"), exist_ok=True)
|
||
for f in FORMS:
|
||
with open(os.path.join(HERE, "assets-maki", f[0] + ".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, render(f)))
|
||
print("maki.html %s B / %d 轮廓 / assets-maki/"
|
||
% (format(len(html.encode("utf-8")), ","), len(FORMS)))
|