Struct easy_imgui::FontAtlasMut
source · pub struct FontAtlasMut<'ui, A: ?Sized> { /* private fields */ }Implementations§
source§impl<'ui, A> FontAtlasMut<'ui, A>
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.
sourcepub fn add_font(&mut self, font: FontInfo) -> FontId
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.
sourcepub fn add_font_collection(
&mut self,
fonts: impl IntoIterator<Item = FontInfo>
) -> FontId
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.
sourcepub 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
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.
sourcepub 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
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>>§
pub fn texture_id(&self) -> TextureId
pub fn texture_size(&self) -> [i32; 2]
pub fn get_custom_rect(&self, index: CustomRectIndex) -> ImFontAtlasCustomRect
Trait Implementations§
source§impl<'ui, A> Deref for FontAtlasMut<'ui, A>
impl<'ui, A> Deref for FontAtlasMut<'ui, A>
§type Target = FontAtlasPtr<'ui>
type Target = FontAtlasPtr<'ui>
The resulting type after dereferencing.
source§fn deref(&self) -> &FontAtlasPtr<'ui>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more