Document the cargo features for Vello `{CPU, Common}` (#1007)
Co-authored-by: Tom Churchman <thomas@kepow.org>diff --git a/sparse_strips/vello_common/Cargo.toml b/sparse_strips/vello_common/Cargo.toml
index 3ffb49b..7915797 100644
--- a/sparse_strips/vello_common/Cargo.toml
+++ b/sparse_strips/vello_common/Cargo.toml
@@ -32,7 +32,7 @@
simd = []
# Get floating point functions from the standard library (likely using your target’s libc).
std = ["peniko/std"]
-# Use floating point implementations from libm.v
+# Use floating point implementations from libm.
libm = ["peniko/libm"]
# Allow loading and saving Pixmap to PNG.
png = ["std", "dep:png"]
diff --git a/sparse_strips/vello_common/README.md b/sparse_strips/vello_common/README.md
index a500606..4537edc 100644
--- a/sparse_strips/vello_common/README.md
+++ b/sparse_strips/vello_common/README.md
@@ -22,6 +22,8 @@
<!-- Intra-doc links used in lib.rs should be evaluated here.
See https://linebender.org/blog/doc-include/ for related discussion. -->
+[crate::pixmap::Pixmap]: https://docs.rs/vello_common/latest/vello_common/pixmap/struct.Pixmap.html
+
<!-- cargo-rdme start -->
This crate includes common geometry representations, tiling logic, and other fundamental components used by both [Vello CPU][vello_cpu] and Vello Hybrid.
@@ -37,6 +39,19 @@
## Features
+- `std` (enabled by default): Get floating point functions from the standard library
+ (likely using your target's libc).
+- `libm`: Use floating point implementations from [libm].
+- `png` (enabled by default): Allow loading [`Pixmap`][crate::pixmap::Pixmap]s from PNG images.
+ Also required for rendering glyphs with an embedded PNG.
+ Implies `std`.
+- `simd`: Allows requesting SIMD execution modes.
+ Note that SIMD is not yet implemented.
+
+At least one of `std` and `libm` is required; `std` overrides `libm`.
+
+## Contents
+
- Shared data structures for paths, tiles, and strips
- Geometry processing utilities
- Common logic for rendering stages
@@ -44,6 +59,7 @@
This crate acts as a foundation for `vello_cpu` and `vello_hybrid`, providing essential components to minimize duplication.
[vello_cpu]: https://crates.io/crates/vello_cpu
+[libm]: https://crates.io/crates/libm
<!-- cargo-rdme end -->
diff --git a/sparse_strips/vello_common/src/lib.rs b/sparse_strips/vello_common/src/lib.rs
index 284d261..566f073 100644
--- a/sparse_strips/vello_common/src/lib.rs
+++ b/sparse_strips/vello_common/src/lib.rs
@@ -14,6 +14,19 @@
//!
//! ## Features
//!
+//! - `std` (enabled by default): Get floating point functions from the standard library
+//! (likely using your target's libc).
+//! - `libm`: Use floating point implementations from [libm].
+//! - `png` (enabled by default): Allow loading [`Pixmap`][crate::pixmap::Pixmap]s from PNG images.
+//! Also required for rendering glyphs with an embedded PNG.
+//! Implies `std`.
+//! - `simd`: Allows requesting SIMD execution modes.
+//! Note that SIMD is not yet implemented.
+//!
+//! At least one of `std` and `libm` is required; `std` overrides `libm`.
+//!
+//! ## Contents
+//!
//! - Shared data structures for paths, tiles, and strips
//! - Geometry processing utilities
//! - Common logic for rendering stages
@@ -21,6 +34,8 @@
//! This crate acts as a foundation for `vello_cpu` and `vello_hybrid`, providing essential components to minimize duplication.
//!
//! [vello_cpu]: https://crates.io/crates/vello_cpu
+// If we ever use libm ourselves, it would be better to intra-doc-link to it here instead.
+//! [libm]: https://crates.io/crates/libm
// LINEBENDER LINT SET - lib.rs - v3
// See https://linebender.org/wiki/canonical-lints/
diff --git a/sparse_strips/vello_cpu/README.md b/sparse_strips/vello_cpu/README.md
index 0a6275d..e00ddc7 100644
--- a/sparse_strips/vello_cpu/README.md
+++ b/sparse_strips/vello_cpu/README.md
@@ -28,6 +28,7 @@
[RenderContext::stroke_path]: https://docs.rs/vello_cpu/latest/vello_cpu/struct.RenderContext.html#method.stroke_path
[RenderContext::glyph_run]: https://docs.rs/vello_cpu/latest/vello_cpu/struct.RenderContext.html#method.glyph_run
[`RenderContext::render_to_pixmap`]: https://docs.rs/vello_cpu/latest/vello_cpu/struct.RenderContext.html#method.render_to_pixmap
+[`Pixmap`]: https://docs.rs/vello_cpu/latest/vello_cpu/struct.Pixmap.html
<!-- cargo-rdme start -->
@@ -83,6 +84,11 @@
assert_eq!(&result, expected_render);
```
+## Features
+
+- `png`(enabled by default): Allow loading [`Pixmap`]s from PNG images.
+ Also required for rendering glyphs with an embedded PNG.
+
## Caveats
Vello CPU is an alpha for several reasons, including the following.
diff --git a/sparse_strips/vello_cpu/src/lib.rs b/sparse_strips/vello_cpu/src/lib.rs
index 9cc8551..6539331 100644
--- a/sparse_strips/vello_cpu/src/lib.rs
+++ b/sparse_strips/vello_cpu/src/lib.rs
@@ -53,6 +53,11 @@
//! assert_eq!(&result, expected_render);
//! ```
//!
+//! ## Features
+//!
+//! - `png`(enabled by default): Allow loading [`Pixmap`]s from PNG images.
+//! Also required for rendering glyphs with an embedded PNG.
+//!
//! ## Caveats
//!
//! Vello CPU is an alpha for several reasons, including the following.