Files
oak-gpui/crates/gpui/src/text_system/font_fallbacks.rs
T
Piotr Osiewicz e6c1c51b37 chore: Fix several style lints (#17488)
It's not comprehensive enough to start linting on `style` group, but
hey, it's a start.

Release Notes:

- N/A
2024-09-06 11:58:39 +02:00

22 lines
642 B
Rust

use std::sync::Arc;
use schemars::JsonSchema;
use serde_derive::{Deserialize, Serialize};
/// The fallback fonts that can be configured for a given font.
/// Fallback fonts family names are stored here.
#[derive(Default, Clone, Eq, PartialEq, Hash, Debug, Deserialize, Serialize, JsonSchema)]
pub struct FontFallbacks(pub Arc<Vec<String>>);
impl FontFallbacks {
/// Get the fallback fonts family names
pub fn fallback_list(&self) -> &[String] {
self.0.as_slice()
}
/// Create a font fallback from a list of strings
pub fn from_fonts(fonts: Vec<String>) -> Self {
FontFallbacks(Arc::new(fonts))
}
}