pub fn draw_text_ex(text: &str, x: f32, y: f32, params: TextParams) {
    let font = get_context().fonts_storage.get_font_mut(params.font);
    let InternalGlContext {
        quad_context: ctx, ..
    } = unsafe { get_internal_gl() };

    let mut total_width = 0.;
    for character in text.chars() {
        if font.characters.contains_key(&(character, params.font_size)) == false {
            font.cache_glyph(character, params.font_size);
        }
        let mut atlas = font.atlas.borrow_mut();
        let font_data = &font.characters[&(character, params.font_size)];
        let glyph = atlas.get(font_data.sprite).unwrap().rect;
        let left_coord = font_data.offset_x as f32 * params.font_scale + total_width;
        let top_coord = 0.0
            - glyph.h as f32 * params.font_scale
            - font_data.offset_y as f32 * params.font_scale;

        total_width += font_data.advance * params.font_scale;

        let dest = Rect::new(
            left_coord + x,
            top_coord + y,
            glyph.w as f32 * params.font_scale,
            glyph.h as f32 * params.font_scale,
        );

        let source = Rect::new(
            glyph.x as f32,
            glyph.y as f32,
            glyph.w as f32,
            glyph.h as f32,
        );

        crate::texture::draw_texture_ex(
            atlas.texture(ctx),
            dest.x,
            dest.y,
            params.color,
            crate::texture::DrawTextureParams {
                dest_size: Some(vec2(dest.w, dest.h)),
                source: Some(source),
                ..Default::default()
            },
        );
    }
}
/// Draw text with custom params such as font, font size and font scale.
Draw text with custom params such as font, font size and font scale.
Draw text with custom params such as font font size and font scale .
pub fn draw_text_ex(text: &str, x: f32, y: f32, params: TextParams) {
    let font = get_context().fonts_storage.get_font_mut(params.font);
    let InternalGlContext {
        quad_context: ctx, ..
    } = unsafe { get_internal_gl() };
    let mut total_width = 0.;
    for character in text.chars() {
        if font.characters.contains_key(&(character, params.font_size)) == false {
            font.cache_glyph(character, params.font_size);
        }
        let mut atlas = font.atlas.borrow_mut();
        let font_data = &font.characters[&(character, params.font_size)];
        let glyph = atlas.get(font_data.sprite).unwrap().rect;
        let left_coord = font_data.offset_x as f32 * params.font_scale + total_width;
        let top_coord = 0.0
            - glyph.h as f32 * params.font_scale
            - font_data.offset_y as f32 * params.font_scale;
        total_width += font_data.advance * params.font_scale;
        let dest = Rect::new(
            left_coord + x,
            top_coord + y,
            glyph.w as f32 * params.font_scale,
            glyph.h as f32 * params.font_scale,
        );
        let source = Rect::new(
            glyph.x as f32,
            glyph.y as f32,
            glyph.w as f32,
            glyph.h as f32,
        );
        crate::texture::draw_texture_ex(
            atlas.texture(ctx),
            dest.x,
            dest.y,
            params.color,
            crate::texture::DrawTextureParams {
                dest_size: Some(vec2(dest.w, dest.h)),
                source: Some(source),
                ..Default::default()
            },
        );
    }
}
pub fn draw_text_ex ( text : & str , x : f32 , y : f32 , params : TextParams ) { let font = get_context ( ) . fonts_storage . get_font_mut ( params . font ) ; let InternalGlContext { quad_context : ctx , .. } = unsafe { get_internal_gl ( ) } ; let mut total_width = 0. ; for character in text . chars ( ) { if font . characters . contains_key ( & ( character , params . font_size ) ) == false { font . cache_glyph ( character , params . font_size ) ; } let mut atlas = font . atlas . borrow_mut ( ) ; let font_data = & font . characters [ & ( character , params . font_size ) ] ; let glyph = atlas . get ( font_data . sprite ) . unwrap ( ) . rect ; let left_coord = font_data . offset_x as f32 * params . font_scale + total_width ; let top_coord = 0.0 - glyph . h as f32 * params . font_scale - font_data . offset_y as f32 * params . font_scale ; total_width += font_data . advance * params . font_scale ; let dest = Rect :: new ( left_coord + x , top_coord + y , glyph . w as f32 * params . font_scale , glyph . h as f32 * params . font_scale , ) ; let source = Rect :: new ( glyph . x as f32 , glyph . y as f32 , glyph . w as f32 , glyph . h as f32 , ) ; crate :: texture :: draw_texture_ex ( atlas . texture ( ctx ) , dest . x , dest . y , params . color , crate :: texture :: DrawTextureParams { dest_size : Some ( vec2 ( dest . w , dest . h ) ) , source : Some ( source ) , .. Default :: default ( ) } , ) ; } }
Draw text with custom params such as font, font size and font scale.
Draw text with custom params such as font font size and font scale .
text
&str
x
f32
y
f32
params
TextParams
text
&str
x
f32
y
f32
params
TextParams