From 7c4c97d3d64e7520a567753a4487ba4436aa9b63 Mon Sep 17 00:00:00 2001 From: Thomas Churchman Date: Thu, 25 Jul 2024 15:17:15 +0200 Subject: [PATCH] docs(font-enumeration): add module-level doc and doc test --- font-enumeration/src/lib.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/font-enumeration/src/lib.rs b/font-enumeration/src/lib.rs index 643a130..bbde009 100644 --- a/font-enumeration/src/lib.rs +++ b/font-enumeration/src/lib.rs @@ -1,3 +1,26 @@ +//! This is a cross-platform library for enumerating system fonts. +//! +//! # Supported platforms: +//! +//! - Unix-like (Fontconfig) +//! - Windows (DirectWrite; **untested**) +//! - MacOS (Core Text; **untested**) +//! +//! # Features and alternatives +//! +//! This library is for very simple uses, where you're only interested in listing installed fonts, +//! perhaps filtering by family name. The listed fonts include family and font name, file path, and +//! some limited font attributes (style, weight and stretch). It's unlikely this library will grow +//! much beyond this feature set, and its dependency tree will remain small. +//! +//! ```rust +//! let font_collection = font_enumeration::Collection::new().unwrap(); +//! +//! for font in font_collection.by_family("DejaVu Sans") { +//! println!("{font:#?}"); +//! } +//! ``` + use std::path::PathBuf; use thiserror::Error;