Use SwashCache in doc example
This commit is contained in:
parent
8f8cf80bf6
commit
2b1e884ca7
1 changed files with 9 additions and 1 deletions
10
src/lib.rs
10
src/lib.rs
|
|
@ -12,7 +12,7 @@
|
||||||
//! point, you can use the `SwashCache` to rasterize glyphs into either images or pixels.
|
//! 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
|
//! // A FontSystem provides access to detected system fonts, create one per application
|
||||||
//! let font_system = FontSystem::new();
|
//! let font_system = FontSystem::new();
|
||||||
|
|
@ -44,6 +44,14 @@
|
||||||
//! println!("{:#?}", glyph);
|
//! 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::*;
|
pub use self::attrs::*;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue