#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ NOVALON 环 · 一相圆(第三十四刀 · 重写) 甲方三次澄清后锁定的形: 参照图里那个「字母沿圆环排布」的环形 **就是** 一相圆; 环上的英文换成 NOVALON,圆心原 "Design Institute Inc." 的位置 换成书法体「睿新致遠」真迹。 cut 32 画崩的两层原因,第二层是这一版才找到的: 一) 坐标原点搞错。novalon.py 的 GLYPH 局部 y=0 是字顶、y=H=100 是基线, 我按「原点在基线」去摆,字母从半径 R 插进 R-100、穿过圆心互撞。 ⇒ 这一版把基线钉在 Rb 上,字头朝外长到 Rb+ch。 二) 参数化错了。上一版「半径由字母正好填满弧长解出」,于是 ch/Rb = radians(360-开口)·H / (Σ字宽 + (n-1)·字距)。 NOVALON 七字母 Σ字宽=588、字距 22 —— 实测出来 ch/Rb = 0.68~0.87, 即字母高度是半径的七到九成:那不是环,是七芒星。 参照图之所以是环,是因为它的文本长得多(一整句话绕圆), 7 个字母绕 300° 弧,在「半径=外径-字高」下字距必须被拉开。 ⇒ 这一版反过来:**外径钉死填满画布,字距由弧长解出**, 并把「字高/字距」和「开口弧/字距」两个比值当设计参数公开量出来。 第三个真正的选择是开口方位:开口在下方(gap_at=180)时 字母从左下起、越过正上方、落到右下 —— 就是参照图那种拱顶排法, 每一字的倾斜都朝外、近顶处正直,NOVALON 能顺读。 开口在右(gap_at=90)时底部那两字必然倒立。这一刀把两种方位都排出来对照。 """ 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 nv = load("nv", os.path.join(HERE, "novalon.py")) CH = json.load(open(os.path.join(HERE, "_wm-chars.json"), encoding="utf-8"))["chars"] RED = "#C41E3A" INK = "#26221E" WHITE = "#FFFFFF" DEEP = "#141210" S = 440.0 CX = CY = S / 2.0 MARGIN = 10.0 OUT = S / 2.0 - MARGIN # 210 —— 环的外缘,固定填满画布 H = nv.H # 100 SW = None # Σ字宽,下面按 text 现算 BOX = [] for _c in CH: _v = [float(x) for x in re.findall(r"-?\d+\.?\d*", _c["d"])] _xs, _ys = _v[0::2], _v[1::2] BOX.append(((min(_xs) + max(_xs)) / 2.0, (min(_ys) + max(_ys)) / 2.0, max(_xs) - min(_xs), max(_ys) - min(_ys))) def char_svg(i, cx, cy, size, col=INK): bcx, bcy, bw, bh = BOX[i] k = size / max(bw, bh) return ('' '' % (cx, cy, k, -bcx, -bcy, CH[i]["d"], col)) def widths(text): ws = [] for c in text: d, w = nv.GLYPH[c](0.0, H) ws.append((c, d, w)) return ws def solve(ch, opening, text="NOVALON"): """核心几何:外缘固定,字距由弧长解出。返回 (Rb, gap, arc, open_arc)。""" if ch <= 0 or ch >= OUT: raise AssertionError("字高 %g 不在 (0, %g)" % (ch, OUT)) Rb = OUT - ch # 基线半径 if Rb <= 0: raise AssertionError("基线半径非正") arc = math.radians(360.0 - opening) * Rb # 文字可用弧长 ink = (ch / H) * sum(w for _, _, w in widths(text)) gap = (arc - ink) / (len(text) - 1) if gap <= 0: raise AssertionError("字高 %g 在开口 %g° 下放不下 —— 弧长 %g < 字宽合计 %g" % (ch, opening, arc, ink)) return Rb, gap, arc, math.radians(opening) * Rb def ring(ch=52.0, opening=100.0, gap_at=180.0, col=RED, text="NOVALON", dots=False): gl = widths(text) Rb, gap, arc, open_arc = solve(ch, opening, text) k = ch / H a0 = gap_at + opening / 2.0 out = [] s = 0.0 for i, (c, d, w) in enumerate(gl): sc = k * w ang = a0 + math.degrees((s + sc / 2.0) / Rb) tr = ("translate(%g,%g) rotate(%g) translate(0,%g) scale(%g) translate(%g,%g)" % (CX, CY, ang, -Rb, k, -w / 2.0, -H)) out.append('' % (tr, col, d)) if dots and i < len(gl) - 1: dang = a0 + math.degrees((s + sc + gap / 2.0) / Rb) rr = Rb + ch * 0.44 dx = CX + rr * math.sin(math.radians(dang)) dy = CY - rr * math.cos(math.radians(dang)) out.append('' % (dx, dy, ch * 0.075, col)) s += sc + gap return "".join(out), Rb, gap, open_arc, arc def center(Rb, col=INK, inset=0.90, cgap_frac=0.10): """圆心横排真迹四字,自动求能装进内切圆的最大字号。 约束:(总宽/2)^2 + (字高/2)^2 <= (Rb*inset)^2 —— 字行四角不许顶到环。""" r = Rb * inset def fits(c): total = 4 * c + 3 * c * cgap_frac return (total / 2.0) ** 2 + (c / 2.0) ** 2 <= r * r lo, hi = 4.0, r for _ in range(90): mid = (lo + hi) / 2.0 if fits(mid): lo = mid else: hi = mid csize = lo cg = csize * cgap_frac total = 4 * csize + 3 * cg x0 = CX - total / 2.0 + csize / 2.0 body = "".join(char_svg(i, x0 + i * (csize + cg), CY, csize, col) for i in range(4)) return body, csize, (total / 2.0, csize / 2.0) def corner_report(bx, by, opening, gap_at): """字行四角相对开口中心的方位。返回 (最深侵入角, 最近角半径/基线半径)。 侵入角 > 0 表示有字角伸进了开口扇形里 —— 那里没有环,字就失去了框。""" pts = [(sx, sy) for sx in (-bx, bx) for sy in (-by, by)] deep = -999.0 relmax = 0.0 for x, y in pts: ang = math.degrees(math.atan2(x, -y)) # 与 gap_at 同一约定:正上=0,顺时针 rel = (ang - gap_at + 180.0) % 360.0 - 180.0 deep = max(deep, opening / 2.0 - abs(rel)) relmax = max(relmax, math.hypot(x, y)) return deep, relmax def compose(ring_col=RED, char_col=INK, **kw): body, Rb, gap, open_arc, arc = ring(col=ring_col, **kw) cen, csize, (bx, by) = center(Rb, col=char_col) opening = kw.get("opening", 100.0) gap_at = kw.get("gap_at", 180.0) deep, relmax = corner_report(bx, by, opening, gap_at) return body + cen, dict(Rb=Rb, gap=gap, csize=csize, ch=kw.get("ch", 52.0), open_arc=open_arc, arc=arc, deep=deep, corner=relmax / Rb) def svg(inner, px, key=None): k = ' data-k="%s"' % key if key else "" return ('%s' % (S, S, px, px, px, px, k, inner)) VARIANTS = [ ("R1 拱顶 · 均衡", dict(ch=52.0, opening=100.0, gap_at=180.0), "字高 52、开口 100° 在正下方。字母自左下起、越过正上方、落到右下," "NOVALON 顺读;圆心真迹四字自动求到不顶环的最大字号。这是我对本 brief 的主张。"), ("R2 拱顶 · 字更重", dict(ch=60.0, opening=80.0, gap_at=180.0), "字母加到 60、开口收到 80°。气势更足、更接近参照图那种压满的感觉," "代价是「通」的那口气小了 20°。"), ("R3 拱顶 · 细字疏朗", dict(ch=44.0, opening=100.0, gap_at=180.0), "字母缩到 44。字高/半径只有 0.21,最像「环」,留白最多,也最静。"), ("R4 节 · 字间朱点", dict(ch=44.0, opening=100.0, gap_at=180.0, dots=True), "在 R3 的每个字距中点落一颗朱砂小圆点,把被几何拉开的空隙变成节奏。" "这是解决「7 个字母绕不满一圈」最正统的圆章语法。"), ("R5 大开口", dict(ch=52.0, opening=140.0, gap_at=180.0), "开口放到 140°。环几乎成马蹄,一相圆的「缺一」说得最重," "但圆心字要被迫缩小避开缺口。"), ("R6 开口在右(对照)", dict(ch=52.0, opening=100.0, gap_at=90.0), "同样的参数把开口转到正右方 —— 底部那两字必然倒立。" "放在这里是为了把「开口方位=可读性」这件事量出来,不是提案。"), ] 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: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} 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 = ['' '' 'NOVALON 环 · 一相圆
'] P.append('
Cut 34 · 2026-10-14 · 环上 NOVALON + 圆心书法真迹 · repo 零改动
') P.append('

一相圆:环上 NOVALON,圆心睿新致遠

') P.append('

照你锁定的形做:参照图那个字母排的开口环就是一相圆;' '环上的英文是 NOVALON,圆心原来 Design Institute Inc. 的位置放书法体「睿新致遠」真迹。' '环是朱砂、字是墨 —— 环是印,字是款。

') P.append('
这一刀真正的工程量不在画,在把参数化反过来。' '上一版我让「半径由字母填满弧长解出」,量出 ch/Rb = ' '0.68 ~ 0.87 —— 字母高度是半径的七到九成,那画出来是七芒星,不是环。' '参照图是环,因为绕它的文本长得多。这一版外缘钉死填满画布,字距由弧长解出,' '并把两个必须取舍的比值公开量出来:字距/字高、开口弧/字距。
') built = [] for nm, kw, why in VARIANTS: body, g = compose(**kw) key = nm.split()[0] ratio = g["ch"] / g["Rb"] gapr = g["gap"] / g["ch"] opr = g["open_arc"] / g["gap"] built.append((nm, body, g, key, ratio, gapr, opr, why)) wht, _ = compose(ring_col=WHITE, char_col=WHITE, **kw) solid, _ = compose(ring_col=RED, char_col=RED, **kw) P.append('
%s' '基线半径 %g · 字距 %g(=字高的 %g 倍)· 开口弧 = %g 倍字距 · ' '字高/半径 %g · 圆心字高 %g · 字角伸入开口 %+g°
' % (nm, round(g["Rb"], 1), round(g["gap"], 1), round(gapr, 2), round(opr, 2), round(ratio, 3), round(g["csize"], 1), round(g["deep"], 1))) P.append('
%s
260px
' % svg(body, 260, "%s@260" % key)) P.append('
%s
120px
' % svg(body, 120, "%s@120" % key)) P.append('
%s' '
单色朱砂·满印
' % svg(solid, 150)) P.append('
%s' '
暖墨底反白
' % svg(wht, 150)) P.append('
') for px in (64, 40, 24, 16): P.append('
%s' '
%d
' % (svg(body, px, "%s@%d" % (key, px)), px)) P.append('
应用阶梯
') P.append('

%s

' % why) P.append('

1度量

') P.append('' '' '' '' '' '') for nm, body, g, key, ratio, gapr, opr, why in built: P.append('' '' '' '' '' '' '' '' % (nm, gapr, "pass" if opr >= 2.5 else "fail", opr, "pass" if g["deep"] <= 0 else "fail", g["deep"], "pass" if g["corner"] <= 0.92 else "fail", g["corner"], key, key, key, key)) P.append('
候选字距/字高开口弧/字距字角伸入开口字角半径/基线最细特征@40最细特征@16墨率@512漂移
%s%.2f%.2f%+.1f°%.2f…………
') P.append('

读法:字距/字高越大,字母越像散在圆周上的点而不是一个词;' '开口弧/字距小于 2.5 时,开口读起来只是「一个特别宽的空格」,' '一相圆就白画了;字角伸入开口为正表示圆心四字的角伸进了没有环的那段扇形,' '字失去了框。圆章在 16px 仍然不成立(七字母加四书法字缩到 16 像素,' '每笔不足一像素)—— 这是几何事实,照样量出来是为了把「不成立」量化,' '简标那一档要另出(只留环,或只留「睿」)。

') P.append('

216×16 栅格

') for nm, body, g, key, ratio, gapr, opr, why in built[:3]: P.append('
…
%s @16
' % (key, key)) P.append('
') P.append('
生成器 novalon_ring.py · 环上字母沿用 ' 'novalon.py 构造几何(未改一个点)· 圆心四字取自 ' 'public/logo.svg 字标组真迹路径(未改一个点,只缩放居中)· ' '外缘 = 画布半径 −10 固定,基线半径 = 外缘 − 字高,字距由可用弧长解出,' '放不下直接断言 · 圆心字行按「四角不顶环 + 不伸进开口扇形」双重约束二分求最大 · ' '度量为本页浏览器栅格实测 · repo 零改动
') P.append(r"""""") P.append('
') return "".join(P) if __name__ == "__main__": html = build() out = os.path.join(HERE, "novalon-ring.html") with open(out, "w", encoding="utf-8") as f: f.write(html) os.makedirs(os.path.join(HERE, "assets-novalon-ring"), exist_ok=True) for nm, kw, why in VARIANTS: body, g = compose(**kw) key = nm.split()[0] with open(os.path.join(HERE, "assets-novalon-ring", key + ".svg"), "w", encoding="utf-8") as fh: fh.write('%s' % (S, S, body)) print("%-3s Rb=%6.1f 字距=%5.1f(%.2fh) 开口/字距=%5.2f 字高/Rb=%.3f 圆心=%5.1f " "角侵入=%+5.1f° 角半径=%.2f" % (key, g["Rb"], g["gap"], g["gap"] / g["ch"], g["open_arc"] / g["gap"], g["ch"] / g["Rb"], g["csize"], g["deep"], g["corner"])) print("novalon-ring.html %s B" % format(len(html.encode("utf-8")), ","))