Bauke/cv
Bauke
/
cv
1
Fork 0

Add the icon_with_text utility.

This commit is contained in:
Bauke 2024-01-09 13:29:04 +01:00
parent a8b5daeff0
commit c38b71f6d6
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#let icon_with_text(icon: "", icon_alt_text: "", icon_size: 1.25em, body) = {
// 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.
image(icon, width: icon_size, alt: icon_alt_text),
// And finally vertically align the text.
align(horizon, body),
),
)
}