Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,13 @@ pub fn load_ttf_font_from_bytes(bytes: &[u8]) -> Result<Font, Error> {

/// Draw text with given font_size
/// Returns text size
pub fn draw_text(text: impl AsRef<str>, x: f32, y: f32, font_size: f32, color: Color) -> TextDimensions {
pub fn draw_text(
text: impl AsRef<str>,
x: f32,
y: f32,
font_size: f32,
color: Color,
) -> TextDimensions {
draw_text_ex(
text,
x,
Expand Down Expand Up @@ -467,6 +473,15 @@ pub fn get_text_center(
crate::Vec2::new(x_center, y_center)
}

pub fn measure_char(
chr: char,
font: Option<&Font>,
font_size: u16,
font_scale: f32,
) -> TextDimensions {
measure_text(chr.to_string().as_str(), font, font_size, font_scale)
}

pub fn measure_text(
text: impl AsRef<str>,
font: Option<&Font>,
Expand Down
Loading