pub struct DiagnosticTextRenderer { /* private fields */ }Expand description
A class used to render diagnostic strings (only!), with caching of ASCII glyph runs. Digits are laid out in equal-width cells so rapidly changing values do not make the text jump around.
Implementations§
Source§impl DiagnosticTextRenderer
impl DiagnosticTextRenderer
pub fn get_max_height(&self) -> f64
Sourcepub fn digit_cell_width(&self) -> f64
pub fn digit_cell_width(&self) -> f64
The width of the cell every digit is centered in.
pub fn new(glyph_run_source: Rc<dyn IDiagnosticGlyphRunSource>) -> Self
Sourcepub fn from_glyph_typeface(
glyph_typeface: Rc<GlyphTypeface>,
font_rendering_em_size: f64,
) -> Self
pub fn from_glyph_typeface( glyph_typeface: Rc<GlyphTypeface>, font_rendering_em_size: f64, ) -> Self
Creates a renderer whose glyph runs are built from glyph_typeface
at font_rendering_em_size (the C# constructor).
Sourcepub fn create_default() -> Self
pub fn create_default() -> Self
Creates the renderer the compositor’s debug overlays use: the glyph typeface of the default typeface at an em size of 12.
Sourcepub fn shape(&self, text: &str) -> ShapedText
pub fn shape(&self, text: &str) -> ShapedText
Shapes text into a single glyph run that can be drawn with
draw_shaped_text without any per-frame
measuring or shaping. Every UTF-16 code unit outside the printable
ASCII range is shaped as a space. Glyphs advance by their natural
width, so digits are not placed in cells; use
draw_digits for values that change.
Sourcepub fn shape_label(&self, text: &'static str) -> Rc<ShapedText>
pub fn shape_label(&self, text: &'static str) -> Rc<ShapedText>
The label text shaped by shape, shaped the first
time and shared after that. Not in the reference: the port shapes the
fixed labels of the FPS counter on the UI thread with this, where the
glyph runs can be created (ServerCompositor::diagnostic_text_renderer).
Sourcepub fn draw_shaped_text(
&self,
context: &mut dyn IDrawingContextImpl,
text: &ShapedText,
foreground: &dyn IImmutableBrush,
)
pub fn draw_shaped_text( &self, context: &mut dyn IDrawingContextImpl, text: &ShapedText, foreground: &dyn IImmutableBrush, )
Draws text shaped by shape at the origin of the
current transform of context.
Sourcepub fn draw_digits(
&self,
context: &mut dyn IDrawingContextImpl,
value: i32,
digit_count: i32,
foreground: &dyn IImmutableBrush,
)
pub fn draw_digits( &self, context: &mut dyn IDrawingContextImpl, value: i32, digit_count: i32, foreground: &dyn IImmutableBrush, )
Draws a non-negative value zero padded to digit_count digits, each
in its own digit_cell_width wide cell,
without formatting a string. Values that do not fit are clamped to the
largest representable value.
Sourcepub fn measure_ascii_text(&self, text: &str) -> Size
pub fn measure_ascii_text(&self, text: &str) -> Size
Measures text. Every UTF-16 code unit outside the printable ASCII
range is measured as a space.
Sourcepub fn draw_ascii_text(
&self,
context: &mut dyn IDrawingContextImpl,
text: &str,
foreground: &dyn IImmutableBrush,
)
pub fn draw_ascii_text( &self, context: &mut dyn IDrawingContextImpl, text: &str, foreground: &dyn IImmutableBrush, )
Draws text at the origin of the current transform of context.
Every UTF-16 code unit outside the printable ASCII range is drawn as
a space.
Auto Trait Implementations§
impl !Freeze for DiagnosticTextRenderer
impl !RefUnwindSafe for DiagnosticTextRenderer
impl !Send for DiagnosticTextRenderer
impl !Sync for DiagnosticTextRenderer
impl !UnwindSafe for DiagnosticTextRenderer
impl Unpin for DiagnosticTextRenderer
impl UnsafeUnpin for DiagnosticTextRenderer
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more