Macro cleanup
This commit is contained in:
parent
2c3585cfb0
commit
8703edc125
4 changed files with 10 additions and 35 deletions
|
@ -5,6 +5,7 @@ import '../../support/transform' as Transform
|
||||||
import [mix linreg clamp fallback] from '../../support/utils'
|
import [mix linreg clamp fallback] from '../../support/utils'
|
||||||
import [Cv AnyDerivingCv Radical] from '../../support/gr'
|
import [Cv AnyDerivingCv Radical] from '../../support/gr'
|
||||||
import [designParameters] from '../../meta/aesthetics'
|
import [designParameters] from '../../meta/aesthetics'
|
||||||
|
import '../../support/point' as Point
|
||||||
|
|
||||||
glyph-module
|
glyph-module
|
||||||
|
|
||||||
|
@ -438,13 +439,13 @@ glyph-block CommonShapes : begin
|
||||||
flat (x + extend - [if (extend > 0) 0.01 (-0.01)]) (y - depth)
|
flat (x + extend - [if (extend > 0) 0.01 (-0.01)]) (y - depth)
|
||||||
curl (x + extend) (y - depth)
|
curl (x + extend) (y - depth)
|
||||||
|
|
||||||
define [LegShape] : params [[ztop nothing (xt <> top)] [zbot nothing (xs <> bottom)] xb [fine Stroke]] : glyph-proc
|
define [LegShape] : params [ztop zbot xb [fine Stroke]] : glyph-proc
|
||||||
include : dispiro
|
include : dispiro
|
||||||
widths.lhs fine
|
widths.lhs fine
|
||||||
flat xt top [heading Downward]
|
flat ztop.x ztop.y [heading Downward]
|
||||||
curl xb (bottom + LongJut)
|
curl xb (zbot.y + LongJut)
|
||||||
alsoThruThem {{0.5 0.94}}
|
alsoThruThem {{0.5 0.94}}
|
||||||
g4.left.end xs (bottom + fine) [heading Leftward]
|
g4.left.end zbot.x (zbot.y + fine) [heading Leftward]
|
||||||
|
|
||||||
define [LeftHook x y xextend] : glyph-proc
|
define [LeftHook x y xextend] : glyph-proc
|
||||||
local fine : adviceBlackness 4.25
|
local fine : adviceBlackness 4.25
|
||||||
|
|
|
@ -2,6 +2,7 @@ $$include '../../meta/macros.ptl'
|
||||||
|
|
||||||
import [mix barmixL linreg clamp fallback] from '../../support/utils'
|
import [mix barmixL linreg clamp fallback] from '../../support/utils'
|
||||||
import [designParameters] from '../../meta/aesthetics'
|
import [designParameters] from '../../meta/aesthetics'
|
||||||
|
import '../../support/point' as Point
|
||||||
|
|
||||||
glyph-module
|
glyph-module
|
||||||
|
|
||||||
|
@ -309,8 +310,8 @@ glyph-block Letter-Cyrillic-El : begin
|
||||||
include : VBarRight cutright 0 top
|
include : VBarRight cutright 0 top
|
||||||
include : HBar cutleft cutright (top - HalfStroke)
|
include : HBar cutleft cutright (top - HalfStroke)
|
||||||
include : LegShape
|
include : LegShape
|
||||||
ztop -- (cutleft <> top)
|
ztop -- [Point.cornerFromXY cutleft top]
|
||||||
zbot -- ([mix SB 0 [if SLAB 1 0.75]] <> 0)
|
zbot -- [Point.cornerFromXY [mix SB 0 [if SLAB 1 0.75]] 0]
|
||||||
xb -- cutleft2
|
xb -- cutleft2
|
||||||
if SLAB : begin
|
if SLAB : begin
|
||||||
include : RightwardTopSerif cutright top SideJut
|
include : RightwardTopSerif cutright top SideJut
|
||||||
|
@ -651,8 +652,8 @@ glyph-block Letter-Cyrillic-Lje : begin
|
||||||
local jut : Jut * 0.72
|
local jut : Jut * 0.72
|
||||||
set-width df.width
|
set-width df.width
|
||||||
include : LegShape
|
include : LegShape
|
||||||
ztop -- (xlefttop <> top)
|
ztop -- [Point.cornerFromXY xlefttop top]
|
||||||
zbot -- ([mix l 0 [if SLAB 1 0.75]] <> 0)
|
zbot -- [Point.cornerFromXY [mix l 0 [if SLAB 1 0.75]] 0]
|
||||||
xb -- [mix l r 0.025]
|
xb -- [mix l r 0.025]
|
||||||
fine -- MVertStroke
|
fine -- MVertStroke
|
||||||
include : CyrYeriShape top (middle - MVertStroke / 2 * HVContrast) (r - O) MVertStroke jut
|
include : CyrYeriShape top (middle - MVertStroke / 2 * HVContrast) (r - O) MVertStroke jut
|
||||||
|
|
|
@ -31,31 +31,6 @@ define-macro params : syntax-rules
|
||||||
ps.push : formOf body
|
ps.push : formOf body
|
||||||
return : dirty ps
|
return : dirty ps
|
||||||
|
|
||||||
### Point macro
|
|
||||||
define-operator "<>" 800 "never" : begin
|
|
||||||
local tClass [definingEnv.newt 'class']
|
|
||||||
local m : syntax-rules
|
|
||||||
`(@x <> @y) `[new @tClass @x @y]
|
|
||||||
|
|
||||||
set coinit.initFn : lambda [m] : begin
|
|
||||||
set m.toPattern : lambda [form env wrapper] : match form
|
|
||||||
`(@x <> @y) : begin
|
|
||||||
local p1 [toPattern x env wrapper]
|
|
||||||
local p2 [toPattern y env wrapper]
|
|
||||||
object
|
|
||||||
whether : lambda [t] `(@t && @[p1.whether `(@t.x)] && @[p2.whether `(@t.y)])
|
|
||||||
assign : lambda [t locallyQ] : ex `[begin
|
|
||||||
@{".preserve" [p1.assign `(@t.x) locallyQ]}
|
|
||||||
@{".preserve" [p2.assign `(@t.y) locallyQ]}
|
|
||||||
] env
|
|
||||||
|
|
||||||
set coinit.injectForm `[define [@tClass x y] : begin \\
|
|
||||||
set this.x x
|
|
||||||
set this.y y
|
|
||||||
return nothing
|
|
||||||
]
|
|
||||||
return m
|
|
||||||
|
|
||||||
### Necessary macros
|
### Necessary macros
|
||||||
# A glyph construction is a function which "modifies" a glyph.
|
# A glyph construction is a function which "modifies" a glyph.
|
||||||
define-macro glyph-proc : syntax-rules
|
define-macro glyph-proc : syntax-rules
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { z } = require("typo-geom");
|
|
||||||
|
|
||||||
module.exports = class Point {
|
module.exports = class Point {
|
||||||
constructor(x, y, on, cubic) {
|
constructor(x, y, on, cubic) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue