X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=font.h;fp=font.h;h=77eae7ced3dc9879ec7fd0ea7752606dbd485a4c;hb=92ba950580dd4877935e90682cd4f66fead8fed2;hp=b1185f9e6800b1855dfb9474a2163deed635864b;hpb=fee9867cee40c393a7142178039e8bcda964e004;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/font.h b/font.h index b1185f9..77eae7c 100644 --- a/font.h +++ b/font.h @@ -176,7 +176,7 @@ VG_STATIC void font3d_draw( struct font3d_render *render ) if( !c0 ) break; ent_glyph *glyph0 = font3d_glyph( render->font, render->variant_id, c0 ), - *glyph1; + *glyph1 = NULL; /* multibyte characters */ if( c0 >= 1 && c0 < k_SRglyph_ascii_min ){ @@ -242,6 +242,8 @@ VG_STATIC float font3d_simple_draw( font3d *font, u32 variant_id, const char *text, camera *cam, m4x3f transform ) { + if( !text ) return 0.0f; + struct font3d_render render; font3d_begin( font, variant_id, cam, transform, &render ); render.u8pch = (u8*)text; @@ -252,6 +254,7 @@ float font3d_simple_draw( font3d *font, u32 variant_id, const char *text, VG_STATIC float font3d_string_width( font3d *font, u32 variant_id, const char *text ) { + if( !text ) return 0.0f; float width = 0.0f; for( int i=0;; i++ ){ u32 c = text[i];