Browse Source

REVIEWED: LoadFontEx()

Changed parameters order for consistency with LoadFontData() and other functions when an array is passed by parameter and array size is the following parameter.
raysan5 6 years ago
parent
commit
96207a8a02

+ 1 - 1
examples/textures/textures_image_text.c

@@ -21,7 +21,7 @@ int main()
     InitWindow(screenWidth, screenHeight, "raylib [texture] example - image text drawing");
     
     // TTF Font loading with custom generation parameters
-    Font font = LoadFontEx("resources/KAISG.ttf", 64, 95, 0);
+    Font font = LoadFontEx("resources/KAISG.ttf", 64, 0, 0);
     
     Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
 

+ 1 - 1
games/transmission/screens/screen_ending.c

@@ -123,7 +123,7 @@ void InitEndingScreen(void)
 
     // Generate newspaper with title and subtitle
     Image imNewspaper = LoadImage("resources/textures/ending_newspaper.png");
-    fontNews = LoadFontEx("resources/fonts/Lora-Bold.ttf", 32, 250, 0);
+    fontNews = LoadFontEx("resources/fonts/Lora-Bold.ttf", 32, 0, 250);
     ImageDrawTextEx(&imNewspaper, (Vector2){ 50, 220 }, fontNews, headline, fontNews.baseSize, 0, DARKGRAY);
 
     texNewspaper = LoadTextureFromImage(imNewspaper);

+ 1 - 1
games/transmission/screens/screen_gameplay.c

@@ -126,7 +126,7 @@ void InitGameplayScreen(void)
     framesCounter = 0;
     finishScreen = 0;
 
-    fontMessage = LoadFontEx("resources/fonts/traveling_typewriter.ttf", 30, 250, 0);
+    fontMessage = LoadFontEx("resources/fonts/traveling_typewriter.ttf", 30, 0, 250);
 
     texBackground = LoadTexture("resources/textures/message_background.png");
     texVignette = LoadTexture("resources/textures/message_vignette.png");

+ 1 - 1
src/raylib.h

@@ -1095,7 +1095,7 @@ RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle
 // Font loading/unloading functions
 RLAPI Font GetFontDefault(void);                                                            // Get the default Font
 RLAPI Font LoadFont(const char *fileName);                                                  // Load font from file into GPU memory (VRAM)
-RLAPI Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars);  // Load font from file with extended parameters
+RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount);  // Load font from file with extended parameters
 RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar);                        // Load font from Image (XNA style)
 RLAPI CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type); // Load font data for further use
 RLAPI Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int padding, int packMethod);  // Generate image font atlas using chars info

+ 2 - 2
src/text.c

@@ -275,7 +275,7 @@ Font LoadFont(const char *fileName)
     Font font = { 0 };
 
 #if defined(SUPPORT_FILEFORMAT_TTF)
-    if (IsFileExtension(fileName, ".ttf") || IsFileExtension(fileName, ".otf")) font = LoadFontEx(fileName, DEFAULT_TTF_FONTSIZE, DEFAULT_TTF_NUMCHARS, NULL);
+    if (IsFileExtension(fileName, ".ttf") || IsFileExtension(fileName, ".otf")) font = LoadFontEx(fileName, DEFAULT_TTF_FONTSIZE, NULL, DEFAULT_TTF_NUMCHARS);
     else
 #endif
 #if defined(SUPPORT_FILEFORMAT_FNT)
@@ -301,7 +301,7 @@ Font LoadFont(const char *fileName)
 // Load Font from TTF font file with generation parameters
 // NOTE: You can pass an array with desired characters, those characters should be available in the font
 // if array is NULL, default char set is selected 32..126
-Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars)
+Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount)
 {
     Font font = { 0 };