SourceClass Fonts
from egui import Fontsclass Fonts: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 egui.Fonts.begin_pass and egui.Fonts.font_image_delta once every frame.
Methods§
def available_characters(self, /, family: FontFamily) -> list[str]§
def families(self, /) -> list[FontFamily]§
Sourcedef font_atlas_fill_ratio(self, /) -> float§
How full is the font atlas?
This increases as new fonts and/or glyphs are used,
but can also decrease in a call to egui.Fonts.begin_pass.
Sourcedef font_image_size(self, /) -> tuple[int, int]§
Current size of the font image.
Pass this to egui.Tessellator.
def glyph_width(self, /, font_id: FontId, c: str) -> float§
Sourcedef has_glyph(self, /, font_id: FontId, c: str) -> bool§
Do the installed fonts have this glyph?
This does not consult the GlyphRasterizers, so it can return False
for a character that would still render via a rasterizer (e.g. the browser on web).
Sourcedef has_glyphs(self, /, font_id: FontId, text: str) -> bool§
Do the installed fonts have all the glyphs in this text?
See egui.Fonts.has_glyph for the caveat about the GlyphRasterizers.