CONST BigSize = PS.Huge, SmallSize = PS.Big, Spacing = 9; VAR ForPrinter := 0; /* These are the font sizes for the big and small letters, respectively. */ PROC c := BlueColor() IS IF ForPrinter > 0 -> c := Color.Cyan | c := Color.Blue FI END; VAR DiamondColor := Color.Red, LetterColor := BlueColor(), MountainColor := Color.Black, BorderColor := Color.Black, BgColor := Color.FromHSV(Color.YellowHue, 0.8, 1); CONST BumpGap = 3, Border = 7; PROC r := BBox(a, k, jW, uW, nW, oW, twoW, big, small) IS VAR sw, ne, b, gap IN b := Geometry.HorVer(a, k); gap := Geometry.Dist(a, b); sw := R2.Minus(a, (2 * gap + jW + uW, big)); sw := R2.Minus(sw, (Border, Border)); ne := R2.Plus(a, (2 * gap + nW + oW + twoW, 0)); ne := R2.Plus(ne, (Border, Border)); r := (sw, ne) END END; PROC DrawRect(r) IS Rect.DrawR(r); SAVE PS IN PS.SetColor(BgColor); PS.Fill() END; PS.SetColor(BorderColor); PS.SetWidth(1); PS.Stroke() END; PROC EqTr(a, b) IS IF VAR c = (0.5, 0.866) REL (a, b) IN TRUE OR (a, b) CONG (b, c) AND (b, c) CONG (c, a) -> PS.MoveTo(a); PS.LineTo(b); PS.LineTo(c); PS.Close() END FI END; PROC Diamond(d, e) IS IF VAR a ~ (0, 0.5774) REL (d, c), b ~ (0, -0.5774) REL (d, c), c = Geometry.HorVer(e, d) IN (a, b) CONG (b, c) AND (b, c) CONG (c, a) AND d = Geometry.Mid(a, b) -> SAVE PS IN EqTr(a, b); EqTr(b, a); PS.SetColor(DiamondColor); PS.Fill() END END FI END; PROC InterDiamond(a, b, c, d) IS IF VAR e = Geometry.Mid(a, b), f = Geometry.HorVer(d, e) IN Diamond(f, c) END FI END; PROC Bumps(a, l) IS IF VAR b = Geometry.HorVer(a, l), c ~ (0.1, 0.231) REL (a, b), d = (0.2, 0) REL (a, b), e ~ (0.3, 0.231) REL (a, b), f = (0.4, 0) REL (a, b), g ~ (0.5, 0.231) REL (a, b), h = (0.6, 0) REL (a, b), i ~ (0.7, 0.231) REL (a, b), j = (0.8, 0) REL (a, b), k ~ (0.9, 0.231) REL (a, b) IN c HOR e AND c HOR g AND c HOR i AND c HOR k AND (a, d) CONG (c, e) AND (a, d) CONG (e, g) AND (a, d) CONG (g, i) AND (a, d) CONG (i, k) AND (a, k) CONG (b, c) AND c HOR l -> PS.Save(); PS.MoveTo(a); PS.LineTo(c); PS.LineTo(d); PS.LineTo(e); PS.LineTo(f); PS.LineTo(g); PS.LineTo(h); PS.LineTo(i); PS.LineTo(j); PS.LineTo(k); PS.LineTo(b); PS.Stroke(); PS.Restore() END FI END; PROC PlaceBumps(a, b, uW, nW, oW, big, small) IS IF VAR c = Geometry.HorVer(a, b), gap = Geometry.Dist(a, c), sw, ne IN sw := R2.Minus(a, (1.5 * gap + uW, big)); ne := R2.Plus(a, (1.5 * gap + nW + oW, -(small + BumpGap))); PS.SetWidth(2); PS.SetColor(MountainColor); PS.SetEndStyle(PS.SquareEnds); Bumps(sw, ne) END FI END; PROC TypeBBNE(p, txt) IS VAR bb IN bb := PS.StringBBox(txt); PS.Type(R2.Minus(p, Rect.NE(bb)), txt) END END; PROC TypeBBNW(p, txt) IS VAR bb IN bb := PS.StringBBox(txt); PS.Type(R2.Minus(p, Rect.NW(bb)), txt) END END; PROC Logo(a, k, uW, nW, oW, big, small) IS IF VAR b ~ (-1.681, -0) REL (a, k), c ~ (-2.681, -0) REL (a, k), d ~ (-4.361, -0) REL (a, k), e ~ (-5.361, -0) REL (a, k), f ~ (1, 0) REL (a, k), g ~ (2.681, 0) REL (a, k), h ~ (3.681, 0) REL (a, k), j = R2.Minus(a, (0, small / 2)), i = R2.Plus(j, (0, small / 3)) IN h HOR g AND h HOR f AND h HOR a AND h HOR b AND h HOR c AND h HOR d AND h HOR e AND (h, g) CONG (f, a) AND (h, g) CONG (b, c) AND (h, g) CONG (d, e) AND f = Geometry.HorVer(a, k) AND uW = Geometry.Dist(g, f) AND nW = Geometry.Dist(a, b) AND oW = Geometry.Dist(c, d) -> PS.SetFont("Times-Bold", SmallSize); InterDiamond(h, g, i, j); InterDiamond(f, a, i, j); InterDiamond(b, c, i, j); InterDiamond(d, e, i, j); PS.SetColor(LetterColor); TypeBBNW(g, "U"); TypeBBNW(a, "N"); TypeBBNW(c, "O"); PS.SetFont("Times-Bold", BigSize); TypeBBNE(h, "J"); TypeBBNW(e, "2"); PlaceBumps(a, k, uW, nW, oW, big, small) END FI END; PROC w := BBoxWidth(txt) IS w := Rect.Width(PS.StringBBox(txt)) END; PROC w := BBoxSize(txt) IS w := Rect.Size(PS.StringBBox(txt)) END; PROC bbox := Draw(a) IS IF VAR b ~ (43.02, 100), jW, uW, nW, oW, twoW, uSz ~ (10.6, 15.93), twoSz ~ (12.12, 28.06), big, small, sw, ne IN CAR(b) + Spacing = CAR(a) -> PS.SetFont("Times-Bold", SmallSize); uSz := BBoxSize("U"); uW := CAR(uSz); small := CDR(uSz); nW := BBoxWidth("N"); oW := BBoxWidth("O"); PS.SetFont("Times-Bold", BigSize); jW := BBoxWidth("J"); twoSz := BBoxSize("2"); twoW := CAR(twoSz); big := CDR(twoSz); bbox := BBox(a, b, jW, uW, nW, oW, twoW, big, small); DrawRect(bbox); Logo(a, b, uW, nW, oW, big, small) END FI END; PROC DrawOnly(a) IS VAR bbox IN bbox := Draw(a) END END; UI PointTool(DrawOnly); PROC Cmd0() IS VAR a ~ (1.515, 38.68), Delta = (1, 1), bb IN bb := Draw(a); PS.SetBBox(R2.Minus(CAR(bb), Delta), R2.Plus(CDR(bb), Delta)) END END;