prep for release v0.0.2 #1

Merged
HEL merged 13 commits from dev into main 2024-06-15 12:20:48 +00:00
2 changed files with 30 additions and 4 deletions
Showing only changes of commit f061bd964e - Show all commits

View File

@ -433,7 +433,7 @@
return (shapes, desc-y)
}
#let render(config, structures) = {
#let render(config, structures, width: 100%) = {
set text(
font: config.default-font-family,
size: config.default-font-size
@ -458,7 +458,7 @@
set page(..params)
canvas(length: 1pt, background: config.background, {
let cnvs = canvas(length: 1pt, background: config.background, {
let (shapes, _) = draw-structure(
config, main, structures,
ox: ox,
@ -475,6 +475,32 @@
fill: none
)
})
layout(size => {
let m = measure(cnvs)
let w = m.width
let h = m.height
let base-w = if type(width) == ratio {
size.width * width
} else {
width
}
let r = if w == 0 {
0
} else {
base-w / w
}
let new-w = w * r
let new-h = h * r
r *= 100%
box(
width: new-w,
height: new-h,
scale(x: r, y: r, cnvs, reflow: true)
)
})
}
#let make(config) = {

View File

@ -56,10 +56,10 @@
return structures
}
#let render(structures, config: auto) = {
#let render(structures, width: 100%, config: auto) = {
if config == auto {
config = conf.config()
}
let renderer_ = renderer.make(config)
(renderer_.render)(structures)
(renderer_.render)(structures, width: width)
}