SourceClass LayoutJob
from egui import LayoutJobclass LayoutJob:Describes the task of laying out text.
This supports mixing different fonts, color and formats (underline etc).
Pass this to egui.FontsView.layout_job.
Example:
As you can see, constructing a LayoutJob is currently a lot of work.
It would be nice to have a helper macro for it!
Properties§
@property
def break_on_newline(self, /) -> bool§
@break_on_newline.setter
def break_on_newline(self, /, break_on_newline: bool) -> None§
@property
def first_row_min_height(self, /) -> float§
@first_row_min_height.setter
def first_row_min_height(self, /, first_row_min_height: float) -> None§
@property
def halign(self, /) -> Align§
@halign.setter
def halign(self, /, halign: Align) -> None§
@property
def justify(self, /) -> bool§
@justify.setter
def justify(self, /, justify: bool) -> None§
@property
def keep_trailing_whitespace(self, /) -> bool§
@keep_trailing_whitespace.setter
def keep_trailing_whitespace(self, /, keep: bool) -> None§
@property
def round_output_to_gui(self, /) -> bool§
@round_output_to_gui.setter
def round_output_to_gui(self, /, round_output_to_gui: bool) -> None§
@property
def sections(self, /) -> list[LayoutSection]§
@sections.setter
def sections(self, /, sections: Sequence[LayoutSection]) -> None§
@property
def text(self, /) -> str§
@text.setter
def text(self, /, text: str) -> None§
@property
def wrap(self, /) -> TextWrapping§
@wrap.setter
def wrap(self, /, wrap: TextWrapping) -> None§
Methods§
Sourcedef append(self, /, text: str, leading_space: float, format: TextFormat) -> None§
Helper for adding a new section when building a LayoutJob.
If the appended text has the same TextFormat as the last section and no
leading_space, it is merged into that section instead of adding a new one.
This keeps the section count down and lets text shaping (e.g. kerning) work
across the appended text, since shaping is done per LayoutSection.
Sourcedef debug_sanity_check(self, /) -> None§
Check the egui.LayoutJob.sections invariant: the sections are ordered and together
cover the whole of egui.LayoutJob.text with no gaps and no overlaps.
Only does anything in debug builds.
@staticmethod
def default() -> LayoutJob§
Sourcedef effective_wrap_width(self, /) -> float§
The wrap with, with a small margin in some cases.
Sourcedef font_height(self, /, ctx: Context) -> float§
The height of the tallest font used in the job.
Returns a value rounded to emath.GUI_ROUNDING.
Sourcedef format_at_byte(self, /, byte_index: int) -> TextFormat§
The TextFormat of the section containing the character starting at the given byte index.
If the index is past the end, the format of the last section is returned.
Panics if the job has no sections.
Assumes LayoutJob.sections are ordered by increasing byte_range (as produced by egui.LayoutJob.append).
Sourcedef is_empty(self, /) -> bool§
Source@staticmethod
def simple(text: str, font_id: FontId, color: Color32, wrap_width: float) -> LayoutJob§
Break on \n and at the given wrap width.
Source@staticmethod
def simple_format(text: str, format: TextFormat) -> LayoutJob§
Break on \n
Source@staticmethod
def simple_singleline(text: str, font_id: FontId, color: Color32) -> LayoutJob§
Does not break on \n, but shows the .notdef glyph ("tofu") instead.