1use crate::interop::AsStr;
2use std::ops::Index;
3
4mod dart_types;
5mod font_arguments;
6mod font_collection;
7mod metrics;
8#[allow(clippy::module_inception)]
9pub mod paragraph;
10mod paragraph_builder;
11mod paragraph_cache;
12mod paragraph_style;
13mod text_shadow;
14mod text_style;
15mod typeface_font_provider;
16
17pub use dart_types::*;
18pub use font_arguments::*;
19pub use font_collection::*;
20pub use metrics::*;
21pub use paragraph::Paragraph;
22pub use paragraph_builder::*;
23pub use paragraph_cache::*;
24pub use paragraph_style::*;
25pub use text_shadow::*;
26pub use text_style::*;
27pub use typeface_font_provider::*;
28
29/// Efficient reference type to a C++ vector of font family SkStrings.
30///
31/// Use indexer or .iter() to access the Rust str references.
32#[derive(Debug)]
33pub struct FontFamilies<'a>(&'a [skia_bindings::SkString]);
34
35impl Index<usize> for FontFamilies<'_> {
36 type Output = str;
37 fn index(&self, index: usize) -> &Self::Output {
38 self.0[index].as_str()
39 }
40}
41
42impl FontFamilies<'_> {
43 pub fn iter(&self) -> impl Iterator<Item = &str> {
44 self.0.iter().map(|str: &SkString| str.as_str())
45 }
46}
47