pub struct FontAtlasMut<'ui, A: ?Sized> { /* private fields */ }

Implementations§

source§

impl<'ui, A> FontAtlasMut<'ui, A>

A reference to the font altas that is to be built.

You get a value of this type when implementing UiBuilder::build_custom_atlas. If you want that function to be called again, call Context::invalidate_font_atlas.

source

pub fn add_font(&mut self, font: FontInfo) -> FontId

Adds the given font to the atlas.

It returns the id to use this font. FontId implements Pushable so you can use it with Ui::with_push.

source

pub fn add_font_collection( &mut self, fonts: impl IntoIterator<Item = FontInfo> ) -> FontId

Adds several fonts with as a single ImGui font.

This is useful mainly if different TTF files have different charset coverage but you want to use them all as a unit.

source

pub fn add_custom_rect_font_glyph( &mut self, font: FontId, id: char, size: impl Into<Vector2<u32>>, advance_x: f32, offset: Vector2, draw: impl FnOnce(&mut A, &mut SubImage<&'_ mut ImageBuffer<Rgba<u8>, &'_ mut [u8]>>) + 'static ) -> CustomRectIndex

Adds an image as a substitution for a character in a font.

source

pub fn add_custom_rect_regular( &mut self, size: impl Into<Vector2<u32>>, draw: impl FnOnce(&mut A, &mut SubImage<&'_ mut ImageBuffer<Rgba<u8>, &'_ mut [u8]>>) + 'static ) -> CustomRectIndex

Adds an arbitrary image to the font atlas.

The returned CustomRectIndex can be used later to draw the image.

Methods from Deref<Target = FontAtlasPtr<'ui>>§

Trait Implementations§

source§

impl<'ui, A> Deref for FontAtlasMut<'ui, A>

§

type Target = FontAtlasPtr<'ui>

The resulting type after dereferencing.
source§

fn deref(&self) -> &FontAtlasPtr<'ui>

Dereferences the value.

Auto Trait Implementations§

§

impl<'ui, A: ?Sized> Freeze for FontAtlasMut<'ui, A>

§

impl<'ui, A> !RefUnwindSafe for FontAtlasMut<'ui, A>

§

impl<'ui, A> !Send for FontAtlasMut<'ui, A>

§

impl<'ui, A> !Sync for FontAtlasMut<'ui, A>

§

impl<'ui, A: ?Sized> Unpin for FontAtlasMut<'ui, A>

§

impl<'ui, A> !UnwindSafe for FontAtlasMut<'ui, A>

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.