pub fn create_text(
text: &str,
x: f32,
y: f32,
font: &Font,
font_size: f32,
ctx: &mut DrawTarget,
source: &Source<'_>,
)
Expand description
Write text to screen
§Arguments
text: Text to write to screen
x: X cordinate of text
y: Y cordinate of text
font: Font to use for rendering text,
font_size: font size in pt
ctx: Draw target to draw text to
§Example
use font_kit::{properties::Properties, family_name::FamilyName, source::SystemSource};
use raqote_utils::create_text;
use raqote::*;
let mut dt = DrawTarget::new(512, 512);
let font = SystemSource::new()
.select_best_match(&[FamilyName::SansSerif], &Properties::new())
.unwrap()
.load()
.unwrap();
create_text(
"Hello, World\nline2",
50.,
50.,
&font,
35.,
&mut dt,
&Source::Solid(SolidSource {
r: 0x00,
g: 0x00,
b: 0x00,
a: 0xFF,
}),
);