gpui/text_system/font_style.rs
1use core::fmt;
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4use std::{
5 fmt::{Debug, Display, Formatter},
6 hash::Hash,
7};
8
9/// Selects an italic or oblique face when the font family has one.
10///
11/// Use [`Font::italic`](crate::Font::italic) to set [`FontStyle::Italic`].
12#[derive(Clone, Copy, Eq, PartialEq, Debug, Hash, Default, Serialize, Deserialize, JsonSchema)]
13pub enum FontStyle {
14 /// The upright face of the family.
15 #[default]
16 Normal,
17 /// The italic face, which is usually a cursive design.
18 Italic,
19 /// A sloped version of the upright face.
20 Oblique,
21}
22
23impl Display for FontStyle {
24 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
25 Debug::fmt(self, f)
26 }
27}