@@ -364,7 +364,9 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
364364 #define MAX_GLYPHS_FROM_IMAGE 256 // Maximum number of glyphs supported on image scan
365365#endif
366366
367- #define COLOR_EQUAL (col1 , col2 ) ((col1.r == col2.r)&&(col1.g == col2.g)&&(col1.b == col2.b)&&(col1.a == col2.a))
367+ #define COLOR_EQUAL (col1 , col2 ) ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a))
368+
369+ Font font = GetFontDefault ();
368370
369371 int charSpacing = 0 ;
370372 int lineSpacing = 0 ;
@@ -374,8 +376,8 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
374376
375377 // We allocate a temporal arrays for chars data measures,
376378 // once we get the actual number of chars, we copy data to a sized arrays
377- int tempCharValues [MAX_GLYPHS_FROM_IMAGE ];
378- Rectangle tempCharRecs [MAX_GLYPHS_FROM_IMAGE ];
379+ int tempCharValues [MAX_GLYPHS_FROM_IMAGE ] = { 0 } ;
380+ Rectangle tempCharRecs [MAX_GLYPHS_FROM_IMAGE ] = { 0 } ;
379381
380382 Color * pixels = LoadImageColors (image );
381383
@@ -390,6 +392,8 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
390392 if (!COLOR_EQUAL (pixels [y * image .width + x ], key )) break ;
391393 }
392394
395+ if ((x == 0 ) || (y == 0 )) return font ;
396+
393397 charSpacing = x ;
394398 lineSpacing = y ;
395399
@@ -445,9 +449,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
445449 .mipmaps = 1
446450 };
447451
448- // Create font with all data parsed from image
449- Font font = { 0 };
450-
452+ // Set font with all data parsed from image
451453 font .texture = LoadTextureFromImage (fontClear ); // Convert processed image to OpenGL texture
452454 font .glyphCount = index ;
453455 font .glyphPadding = 0 ;
0 commit comments