MCPcopy Create free account
hub / github.com/coldtype/st2 / hobeauxBorder

Function hobeauxBorder

scripts/hobeauxborders.py:15–41  ·  view source on GitHub ↗
(r, text, font, fs=2)

Source from the content-addressed store, hash-verified

13]
14
15def hobeauxBorder(r, text, font, fs=2):
16 b, c, m = [StSt(x, font, fs).pen() for x in text[:3]]
17 bw, cw = [e.ambit().w for e in (b, c)]
18
19 nh, nv = int(r.w/bw/2), int(r.h/bw/2)
20 bx = Rect(bw*nh*2+cw*2, bw*nv*2).align(r)
21
22 return (b.layer(
23 lambda p: p
24 .layer(nh)
25 .append(c)
26 .distribute()
27 .append(m)
28 .mirrorx()
29 .translate(*bx.pn)
30 .mirrory(bx.pc),
31 lambda p: p
32 .layer(nv)
33 .distribute()
34 .append(m.copy())
35 .rotate(90, point=(0, 0))
36 .translate(cw, 0)
37 .mirrory()
38 .translate(*bx.pw)
39 .mirrorx(bx.pc))
40 .pen()
41 .unframe())
42
43
44def modify(st2:dict, kwargs:dict):

Callers 1

modifyFunction · 0.85

Calls 1

alignMethod · 0.80

Tested by

no test coverage detected