Skip to main content

StyledTypography

Trait StyledTypography 

Source
pub trait StyledTypography: Styled + Sized {
    // Provided methods
    fn font_buffer(self, cx: &App) -> Self { ... }
    fn font_ui(self, cx: &App) -> Self { ... }
    fn text_ui_size(self, size: TextSize, cx: &App) -> Self { ... }
    fn text_ui_lg(self, cx: &App) -> Self { ... }
    fn text_ui(self, cx: &App) -> Self { ... }
    fn text_ui_sm(self, cx: &App) -> Self { ... }
    fn text_ui_xs(self, cx: &App) -> Self { ... }
    fn text_buffer(self, cx: &App) -> Self { ... }
}
Expand description

Extends gpui::Styled with typography-related styling methods.

Provided Methods§

Source

fn font_buffer(self, cx: &App) -> Self

Sets the font family to the buffer font.

Source

fn font_ui(self, cx: &App) -> Self

Sets the font family to the UI font.

Source

fn text_ui_size(self, size: TextSize, cx: &App) -> Self

Sets the text size using a TextSize.

Source

fn text_ui_lg(self, cx: &App) -> Self

The large size for UI text.

1rem or 16px at the default scale of 1rem = 16px.

Note: The absolute size of this text will change based on a user’s ui_scale setting.

Use text_ui for regular-sized text.

Source

fn text_ui(self, cx: &App) -> Self

The default size for UI text.

0.825rem or 14px at the default scale of 1rem = 16px.

Note: The absolute size of this text will change based on a user’s ui_scale setting.

Use text_ui_sm for smaller text.

Source

fn text_ui_sm(self, cx: &App) -> Self

The small size for UI text.

0.75rem or 12px at the default scale of 1rem = 16px.

Note: The absolute size of this text will change based on a user’s ui_scale setting.

Use text_ui for regular-sized text.

Source

fn text_ui_xs(self, cx: &App) -> Self

The extra small size for UI text.

0.625rem or 10px at the default scale of 1rem = 16px.

Note: The absolute size of this text will change based on a user’s ui_scale setting.

Use text_ui for regular-sized text.

Source

fn text_buffer(self, cx: &App) -> Self

The font size for buffer text.

Retrieves the default font size, or the user’s custom font size if set.

This should only be used for text that is displayed in a buffer, or other places that text needs to match the user’s buffer font size.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§