From 043bb339fe32c758fe03bbe556e7f9cbf2f0bc69 Mon Sep 17 00:00:00 2001 From: Elad elmakias Date: Sun, 17 Aug 2025 14:00:21 +0300 Subject: [PATCH] font arguement, radius arguement now in `block.typ` the radius is optional and the font can be set in the canvas --- src/circuit.typ | 6 +++--- src/elements/block.typ | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/circuit.typ b/src/circuit.typ index 7a701c7..9a0d082 100644 --- a/src/circuit.typ +++ b/src/circuit.typ @@ -8,7 +8,7 @@ /// - body (none, array, element): A code block in which draw functions have been called /// - length (length, ratio): Optional base unit /// -> none -#let circuit(body, length: 2em) = { - set text(font: "Source Sans 3") +#let circuit(body, length: 2em, font: "Source Sans 3") = { + set text(font: font) canvas(length: length, body) -} \ No newline at end of file +} diff --git a/src/elements/block.typ b/src/elements/block.typ index 84623fe..47d55a1 100644 --- a/src/elements/block.typ +++ b/src/elements/block.typ @@ -1,9 +1,9 @@ #import "@preview/cetz:0.3.2": draw #import "element.typ" -#let draw-shape(id, tl, tr, br, bl, fill, stroke) = { +#let draw-shape(id, tl, tr, br, bl, fill, stroke, radius) = { let f = draw.rect( - radius: 0.5em, + radius: radius, inset: 0.5em, fill: fill, stroke: stroke, @@ -27,13 +27,14 @@ ports: (), ports-margins: (), fill: none, + radius: 0.5em, stroke: black + 1pt, id: "", debug: ( ports: false ) ) = element.elmt( - draw-shape: draw-shape, + draw-shape: draw-shape.with(radius: radius), x: x, y: y, w: w, @@ -46,4 +47,4 @@ stroke: stroke, id: id, debug: debug -) \ No newline at end of file +)