pub struct TextRenderingSettings<'a, 'b, F: ThreadSafeFont> {
pub size: f32,
pub h_align: HAlign,
pub v_align: VAlign,
pub foreground: Color,
pub background: Color,
pub canvas: &'a mut Canvas<Window>,
pub texture_creator: &'b TextureCreator<WindowContext>,
pub text_cache: &'a mut TextCache<'b, F>,
}Expand description
This holds most of the arguments to render_text_regular() and render_text_subpixel()
These arguments (fields) are each likely to not change from call to call
Fields§
§size: f32NOTE: for render_text_subpixel(), this is converted to u32 (this is don to significantly cut down on the number of character textures to rasterize and cache)
h_align: HAlign§v_align: VAlign§foreground: Color§background: ColorThis only exists for render_text_subpixel(), with render_text_regular() you can set this to whatever you want and it won’t affect anything
canvas: &'a mut Canvas<Window>§texture_creator: &'b TextureCreator<WindowContext>§text_cache: &'a mut TextCache<'b, F>Implementations§
Source§impl<'a, 'b, F: ThreadSafeFont> TextRenderingSettings<'a, 'b, F>
impl<'a, 'b, F: ThreadSafeFont> TextRenderingSettings<'a, 'b, F>
Sourcepub fn new_regular(
size: f32,
h_align: impl Into<HAlign>,
v_align: impl Into<VAlign>,
foreground: impl Into<Color>,
canvas: &'a mut Canvas<Window>,
texture_creator: &'b TextureCreator<WindowContext>,
text_cache: &'a mut TextCache<'b, F>,
) -> Self
pub fn new_regular( size: f32, h_align: impl Into<HAlign>, v_align: impl Into<VAlign>, foreground: impl Into<Color>, canvas: &'a mut Canvas<Window>, texture_creator: &'b TextureCreator<WindowContext>, text_cache: &'a mut TextCache<'b, F>, ) -> Self
Creates a new TextRenderingSettings that is meant to be used with render_text_regular(), but can also be used for subpixel rendering
Sourcepub fn new_subpixel(
size: u32,
h_align: impl Into<HAlign>,
v_align: impl Into<VAlign>,
foreground: impl Into<Color>,
background: impl Into<Color>,
canvas: &'a mut Canvas<Window>,
texture_creator: &'b TextureCreator<WindowContext>,
text_cache: &'a mut TextCache<'b, F>,
) -> Self
pub fn new_subpixel( size: u32, h_align: impl Into<HAlign>, v_align: impl Into<VAlign>, foreground: impl Into<Color>, background: impl Into<Color>, canvas: &'a mut Canvas<Window>, texture_creator: &'b TextureCreator<WindowContext>, text_cache: &'a mut TextCache<'b, F>, ) -> Self
Creates a new TextRenderingSettings that is meant to be used with render_text_subpixel(), but can also be used for regular rendering
Auto Trait Implementations§
impl<'a, 'b, F> !Send for TextRenderingSettings<'a, 'b, F>
impl<'a, 'b, F> !Sync for TextRenderingSettings<'a, 'b, F>
impl<'a, 'b, F> !UnwindSafe for TextRenderingSettings<'a, 'b, F>
impl<'a, 'b, F> Freeze for TextRenderingSettings<'a, 'b, F>
impl<'a, 'b, F> RefUnwindSafe for TextRenderingSettings<'a, 'b, F>where
F: RefUnwindSafe,
impl<'a, 'b, F> Unpin for TextRenderingSettings<'a, 'b, F>
impl<'a, 'b, F> UnsafeUnpin for TextRenderingSettings<'a, 'b, F>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more