Struct radiant_rs::Font
[−]
[src]
pub struct Font { /* fields omitted */ }
A font used for writing on a Layer
.
Use Font::builder()
to create a new font from a registered system font or
a local file. The Font::from_file()
is a shortcut to achieve the latter.
In addition to the usual properties of a font, radiant also assigns a fixed size
to each font object. Instead of modifying this value, you can clone a new font
with a different size using Font::with_size()
.
Methods
impl Font
[src]
fn builder(context: &RenderContext) -> FontBuilder
[src]
Returns a font builder for font construction.
Examples
let my_font = Font::builder(&rendercontext).family("Arial").size(16.0).build().unwrap();
fn from_file(context: &RenderContext, file: &str) -> Result<Font>
[src]
Creates a font instance from a file.
fn query_all() -> Vec<String>
[src]
Returns the names of all available system fonts.
fn query() -> FontQueryBuilder
[src]
Returns a query builder to retrieve the names of all available system fonts with the given properties (e.g. monospace).
Examples
let monospace_fonts = Font::query().monospace().italic().fetch();
fn with_size(&self, size: f32) -> Font
[src]
Returns a new font instance with given size.
fn write<T>(
&self,
layer: &Layer,
text: &str,
position: T,
color: Color
) -> &Font where
Vec2<f32>: From<T>,
[src]
&self,
layer: &Layer,
text: &str,
position: T,
color: Color
) -> &Font where
Vec2<f32>: From<T>,
Write to given layer.
fn write_wrapped<T>(
&self,
layer: &Layer,
text: &str,
position: T,
color: Color,
max_width: f32
) -> &Font where
Vec2<f32>: From<T>,
[src]
&self,
layer: &Layer,
text: &str,
position: T,
color: Color,
max_width: f32
) -> &Font where
Vec2<f32>: From<T>,
Write to given layer. Breaks lines after max_width pixels.
fn write_transformed<T, U>(
&self,
layer: &Layer,
text: &str,
position: T,
color: Color,
max_width: f32,
rotation: f32,
scale: U
) -> &Font where
Vec2<f32>: From<T> + From<U>,
[src]
&self,
layer: &Layer,
text: &str,
position: T,
color: Color,
max_width: f32,
rotation: f32,
scale: U
) -> &Font where
Vec2<f32>: From<T> + From<U>,
Write to given layer. Breaks lines after max_width pixels and applies given rotation and scaling.
fn arc(self) -> Arc<Self>
[src]
Returns the font wrapped in an std::Arc.