Bauke/cv
Bauke
/
cv
1
Fork 0
cv/utilities/icon-with-text.typ

25 lines
780 B
Plaintext

#let icon_with_text(clip_icon: false, icon: "", icon_alt_text: "", icon_size: 1.25em, body) = {
let image_box_properties = if clip_icon {
(clip: true, radius: icon_size / 6)
} else {
(clip: false)
}
// Use a box for the container so it is rendered inline.
box(
// Then use a grid inside to size and space the icon out perfectly.
grid(
// Take the icon size and add some extra space so it's not rendered
// directly against the text.
columns: (icon_size + 0.2em, auto),
// Render the image with the icon size as the wanted width.
box(
..image_box_properties,
image(icon, width: icon_size, alt: icon_alt_text),
),
// And finally vertically align the text.
align(horizon, body),
),
)
}