svg_to_pdf() exports a card to a vector PDF via rsvg::rsvg_pdf(),
mirroring svg_to_png() (sanitizes the SVG and embeds WOFF2 fonts). For
Chrome-based rendering, svg_to_pdf_chrome() remains available (#17).save_card_for_knitr() now accepts format = "pdf" (in addition to "svg"
and "png"), using Chrome when available and svg_to_pdf() otherwise.svg_to_formats(formats = "pdf") now reuses svg_to_pdf() for the vector path
and warns explicitly when it falls back to a rasterized PDF via magick.magick and rsvg moved from Imports to Suggests: they are only needed
for raster/PDF export, which is already guarded by requireNamespace(). This
lightens the install footprint and matches the package's "heavy deps in
Suggests" convention (#19).svg_card() now sizes badges using value_fontsize instead of a hard-coded
10, preventing clipped/misaligned badge text when value_fontsize differs
from 10 (#18).is_light_color() now reports an unknown color name with a clear cli error
instead of letting col2rgb() raise a raw base error (#20).R CMD check. When a check is detected (via the _R_CHECK_PACKAGE_NAME_
environment variable), font_cache_dir() routes downloads to a
session-specific temporary directory. This resolves the donttest additional
issue where examples (install_fonts(), svg_to_png(), save_svg()) left
*.woff2 files under ~/.cache/R/cardargus/. Interactive and normal use is
unchanged (the persistent cache is still the default).create_badge() now accepts CSS gradient background colors; previously
is_light_color() was evaluated before gradient detection and aborted
in col2rgb() (#14).css_gradient_to_svg() with a single color now produces a solid gradient of
that color instead of falling back to white-to-black (#4).utils.R (compress_number(), escape_xml(),
text_width(), text_height(), wrap_text()) no longer error on NULL,
NA, or length > 1 input (#2).is_light_color() now validates its input and errors clearly on NA,
NULL, or invalid hex strings instead of returning NA/TRUE silently (#5).gfonts are now cached with their real file
extension, so @font-face declares the correct format() (#3).xml2 (a new soft dependency in
Suggests) with a regex fallback, making them robust to attribute order,
quoting, units (px/%), whitespace and viewBox-only sizing. Affects
parse_svg_root_dim(), detect_svg_fonts(), load_svg_for_embed(), the logo
rows and custom-icon sizing (#13).generate_id() is now deterministic (session-local counter) instead of using
runif(), improving reproducibility (#12).footer_logos_svg placeholder in svg_card() (#6).tests/testthat/ suite covering the pure utilities (#9).@param tags in svg_card() and a lifecycle
reference without the dependency (#7, #8). Documentation regenerated with
roxygen2 8.0.0.All functions now follow snake_case naming convention. The old function names have been removed.
| Removed function | Use instead |
|----------|----------|
| house_icon_svg() | icon_house() |
| building_icon_svg() | icon_building() |
| construction_icon_svg() | icon_construction() |
| map_pin_icon_svg() | icon_map_pin() |
| money_icon_svg() | icon_money() |
| badge_svg() | create_badge() |
| badge_row_svg() | create_badge_row() |
| setup_cardargus_fonts() | setup_fonts() |
| install_cardargus_fonts() | install_fonts() |
| cardargus_font_cache_dir() | font_cache_dir() |
| register_knitr_engine() | register_cardargus_knitr() |
Added headless Chrome support for superior font rendering via the chromote package.
svg_to_png_chrome() - Convert SVG to PNG using headless Chromesvg_to_pdf_chrome() - Convert SVG to vector PDF using headless Chromechrome_available() - Check if Chrome/Chromium is availableensure_chrome() - Check and optionally download Chrome for Testingfind_chrome_path() - Find Chrome executable on the systemWhen Chrome is not installed, use ensure_chrome(download = TRUE) to
automatically download "Chrome for Testing" (~150MB). This standalone
Chrome distribution is cached locally and works without system installation.
All user-facing messages now use the cli package for better formatting:
Made it clearer that you can use your own SVG files for logos and icons:
# Use any SVG file path for logos
svg_card(
title = "My Card",
logos = c("/path/to/logo1.svg", "/path/to/logo2.svg"),
...
)
# Or for icons in fields
svg_card(
title = "My Card",
fields = list(
list(list(label = "Name", value = "Test", with_icon = "/path/to/icon.svg"))
),
...
)
All knitr/Quarto functions now support an engine parameter:
include_card() - Added engine parameterinclude_card_png() - Added engine parametersave_card_for_knitr() - Added engine parametercard_to_grob() - Added engine parameterEngine options:
"auto" (default): Uses Chrome if available, otherwise rsvg"chrome": Forces Chrome rendering"rsvg": Forces rsvg/magick rendering@font-face declarations in embed_svg_fonts()svg_to_formats()font-weight: 100 900)inst/fonts/ directoryfonts_dir() - Use font_cache_dir() insteadcustom_logo_svg() - Use load_svg_for_embed() or pass file paths directlysvg_card() - Main function for creating SVG cards with badges, fields, and logosicon_house() - House/home iconicon_building() - Building iconicon_construction() - Construction iconicon_map_pin() - Location pin iconicon_money() - Money/currency iconload_svg_for_embed() - Load and process external SVG filescreate_logo_row() - Create horizontal logo rowsget_svg_path() - Get paths to bundled SVGslist_bundled_svgs() - List available bundled SVGssave_svg() - Save card as SVG filesvg_to_png() - Convert card to PNGsvg_to_png_with_margin() - Convert with marginbatch_svg_to_png() - Batch convert multiple cardsinclude_card() - Display card inline as SVGinclude_card_png() - Display card inline as PNGsave_card_for_knitr() - Save for knitr::include_graphics()register_cardargus_knitr() - Register custom knitr enginecard_to_grob() - Convert to grid graphical objectsetup_fonts() - Quick setup for showtextregister_google_font() - Register Google Fontsfont_available() - Check font availabilityinstall_fonts() - Install fonts locally