|
566 | 566 | /// h(5mm) |
567 | 567 | /// } |
568 | 568 | /// |
569 | | -/// - size (length): Font size for the glyph, defining its overall scale without affecting its stretch length. |
| 569 | +/// - ..args (any): Arguments given to the `text()` element containing the glyph. |
| 570 | +/// Useful for changing color or the font size (defining overall scale without affecting its stretch length). |
570 | 571 | /// |
571 | | -/// #for (i, size) in (1em, 2em, 5em).enumerate() { |
572 | | -/// let s = fletcher.shapes.brace.with(size: size) |
573 | | -/// let l = box( |
| 572 | +/// #diagram({ |
| 573 | +/// let l(key, value) = box( |
574 | 574 | /// stroke: (dash: "dashed", thickness: 0.5pt), |
575 | 575 | /// inset: 10pt, |
576 | | -/// raw("size: " + repr(size)), |
| 576 | +/// raw(key + ": " + value) |
577 | 577 | /// ) |
578 | | -/// diagram(node((i, 0), l, |
579 | | -/// inset: 0pt, |
580 | | -/// shape: s, |
581 | | -/// stroke: teal, |
582 | | -/// fill: teal.lighten(90%), |
583 | | -/// )) |
584 | | -/// h(5mm) |
585 | | -/// } |
| 578 | +/// let n(i, key, value) = node((i, 0), l(key, value), |
| 579 | +/// shape: fletcher.shapes.brace.with(..((key): eval(value)))) |
| 580 | +/// n(1, "size", "3em") |
| 581 | +/// n(2, "fill", "red") |
| 582 | +/// }) |
586 | 583 | /// |
587 | 584 | /// - label (content): Content to be placed at the top/bottom/left/right of the glyph, depending on #param[stretched-glyph][dir]. |
588 | 585 | /// |
|
610 | 607 | /// h(5mm) |
611 | 608 | /// } |
612 | 609 | /// |
613 | | -#let stretched-glyph(node, extrude, glyph: sym.brace.b, dir: bottom, sep: 0pt, length: 100%, size: 1em, label: none, label-sep: 0.25em) = { |
| 610 | +#let stretched-glyph(node, extrude, glyph: sym.brace.b, dir: bottom, sep: 0pt, length: 100%, label: none, label-sep: 0.25em, ..args) = { |
614 | 611 | assert(type(dir) == alignment, message: "Expected direction, got " + repr(type(dir))) |
615 | 612 |
|
616 | 613 | let (w, h) = node.size |
|
628 | 625 | length = span*float(length.ratio) + length.length |
629 | 626 |
|
630 | 627 | let obj = { |
631 | | - let stretched = text(size, $ stretch(glyph, size: #length) $) |
| 628 | + let stretched = text($ stretch(glyph, size: #length) $, ..args) |
632 | 629 | draw.content(pos, stretched, anchor: dir-to-anchor(dir.inv()), name: "content") |
633 | 630 |
|
634 | 631 | if label != none { |
|
0 commit comments