Use SwashCache in doc example

This commit is contained in:
Jeremy Soller 2022-10-27 11:02:56 -06:00
parent 8f8cf80bf6
commit 2b1e884ca7
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE

View file

@ -12,7 +12,7 @@
//! point, you can use the `SwashCache` to rasterize glyphs into either images or pixels.
//!
//! ```
//! use cosmic_text::{Attrs, FontSystem, SwashCache, TextBuffer, TextMetrics};
//! use cosmic_text::{Attrs, Color, FontSystem, SwashCache, TextBuffer, TextMetrics};
//!
//! // A FontSystem provides access to detected system fonts, create one per application
//! let font_system = FontSystem::new();
@ -44,6 +44,14 @@
//! println!("{:#?}", glyph);
//! }
//! }
//!
//! // Create a default text color
//! let text_color = Color::rgb(0xFF, 0xFF, 0xFF);
//!
//! // Draw the buffer (for perfomance, instead use SwashCache directly)
//! text_buffer.draw(&mut swash_cache, text_color, |x, y, w, h, color| {
//! // Fill in your code here for drawing rectangles
//! });
//! ```
pub use self::attrs::*;