Bauke/cv
Bauke
/
cv
1
Fork 0

Add an option to clip icons with a radius.

This commit is contained in:
Bauke 2024-01-09 13:49:28 +01:00
parent c38b71f6d6
commit 06481d77d6
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,10 @@
#let icon_with_text(icon: "", icon_alt_text: "", icon_size: 1.25em, body) = { #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. // Use a box for the container so it is rendered inline.
box( box(
// Then use a grid inside to size and space the icon out perfectly. // Then use a grid inside to size and space the icon out perfectly.
@ -7,7 +13,10 @@
// directly against the text. // directly against the text.
columns: (icon_size + 0.2em, auto), columns: (icon_size + 0.2em, auto),
// Render the image with the icon size as the wanted width. // Render the image with the icon size as the wanted width.
image(icon, width: icon_size, alt: icon_alt_text), box(
..image_box_properties,
image(icon, width: icon_size, alt: icon_alt_text),
),
// And finally vertically align the text. // And finally vertically align the text.
align(horizon, body), align(horizon, body),
), ),