Skip to main content

TextSystem

Struct TextSystem 

Source
pub struct TextSystem { /* private fields */ }
Expand description

Owns fonts and performs shaping-related lookups and rasterization.

One TextSystem is shared by all windows of an application.

Implementations§

Source§

impl TextSystem

Source

pub fn new() -> Self

Loads system fonts and picks the platform UI font as default family.

Source

pub fn ui_family(&self) -> &str

The family used when a style does not specify one.

Source

pub fn mono_family(&self) -> &str

The platform monospace family, used for the generic MONOSPACE family name.

Source

pub fn resolve_family<'a>(&'a self, family: Option<&'a str>) -> &'a str

Resolves generic family names ("monospace") to installed families.

Source

pub fn set_ui_family(&mut self, family: impl Into<String>)

Overrides the default UI family.

Source

pub fn has_family(&self, name: &str) -> bool

Source

pub fn load_font(&mut self, data: Vec<u8>)

Registers a font from memory (TTF/OTF/TTC).

Source

pub fn face_count(&self) -> usize

Source

pub fn rasterize(&mut self, key: GlyphKey) -> Option<RasterizedGlyph>

Rasterizes a glyph. Returns None for empty glyphs (e.g. spaces).

Trait Implementations§

Source§

impl Default for TextSystem

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.