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]
impl Font
pub fn builder(context: &RenderContext) -> FontBuilder
[src]
pub fn builder(context: &RenderContext) -> FontBuilder
Returns a font builder for font construction.
Examples
let my_font = Font::builder(&rendercontext).family("Arial").size(16.0).build().unwrap();
pub fn from_file(context: &RenderContext, file: &str) -> Result<Font>
[src]
pub fn from_file(context: &RenderContext, file: &str) -> Result<Font>
Creates a font instance from a file.
pub fn query_all() -> Vec<String>
[src]
pub fn query_all() -> Vec<String>
Returns the names of all available system fonts.
pub fn query() -> FontQueryBuilder
[src]
pub fn query() -> FontQueryBuilder
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();
pub fn clone_with_size(&self, size: f32) -> Font
[src]
pub fn clone_with_size(&self, size: f32) -> Font
Returns a new font instance with given size.
pub fn write<T>(
&self,
layer: &Layer,
text: &str,
position: T,
color: Color
) -> &Font where
(f32, f32): From<T>,
[src]
pub fn write<T>(
&self,
layer: &Layer,
text: &str,
position: T,
color: Color
) -> &Font where
(f32, f32): From<T>,
Write to given layer.
pub fn write_wrapped<T>(
&self,
layer: &Layer,
text: &str,
position: T,
color: Color,
max_width: f32
) -> &Font where
(f32, f32): From<T>,
[src]
pub fn write_wrapped<T>(
&self,
layer: &Layer,
text: &str,
position: T,
color: Color,
max_width: f32
) -> &Font where
(f32, f32): From<T>,
Write to given layer. Breaks lines after max_width pixels.
pub fn write_transformed<T, U>(
&self,
layer: &Layer,
text: &str,
position: T,
color: Color,
max_width: f32,
rotation: f32,
scale: U
) -> &Font where
(f32, f32): From<T> + From<U>,
[src]
pub fn write_transformed<T, U>(
&self,
layer: &Layer,
text: &str,
position: T,
color: Color,
max_width: f32,
rotation: f32,
scale: U
) -> &Font where
(f32, f32): From<T> + From<U>,
Write to given layer. Breaks lines after max_width pixels and applies given rotation and scaling.
pub fn arc(self) -> Arc<Self>
[src]
pub fn arc(self) -> Arc<Self>
Returns the font wrapped in an std::Arc.
Trait Implementations
impl Clone for Font
[src]
impl Clone for Font
fn clone(&self) -> Font
[src]
fn clone(&self) -> Font
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Font
[src]
impl Debug for Font