pub struct Fonts(_);
Expand description

The collection of fonts used by epaint.

Required in order to paint text. Create one and reuse. Cheap to clone.

Each Fonts comes with a font atlas textures that needs to be used when painting.

If you are using egui, use egui::Context::set_fonts and egui::Context::fonts.

You need to call Self::begin_frame and Self::font_image_delta once every frame.

Implementations

Create a new Fonts for text layout. This call is expensive, so only create one Fonts and then reuse it.

  • pixels_per_point: how many physical pixels per logical “point”.
  • max_texture_side: largest supported texture size (one side).

Call at the start of each frame with the latest known pixels_per_point and max_texture_side.

Call after painting the previous frame, but before using Fonts for the new frame.

This function will react to changes in pixels_per_point and max_texture_side, as well as notice when the font atlas is getting full, and handle that.

Call at the end of each frame (before painting) to get the change to the font texture since last call.

The font atlas. Pass this to crate::Tessellator.

Current size of the font image. Pass this to crate::Tessellator.

Width of this character in points.

Height of one row of text in points

List of all known font families.

Layout some text.

This is the most advanced layout function. See also Self::layout, Self::layout_no_wrap and Self::layout_delayed_color.

The implementation uses memoization so repeated calls are cheap.

How full is the font atlas?

This increases as new fonts and/or glyphs are used, but can also decrease in a call to Self::begin_frame.

Will wrap text at the given width and line break at \n.

The implementation uses memoization so repeated calls are cheap.

Will line break at \n.

The implementation uses memoization so repeated calls are cheap.

Like Self::layout, made for when you want to pick a color for the text later.

The implementation uses memoization so repeated calls are cheap.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.