From 96207a8a026a629fcc3026efab96cf18e1302618 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 25 Dec 2018 15:17:42 +0100 Subject: [PATCH] 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. --- examples/textures/textures_image_text.c | 2 +- games/transmission/screens/screen_ending.c | 2 +- games/transmission/screens/screen_gameplay.c | 2 +- src/raylib.h | 2 +- src/text.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/textures/textures_image_text.c b/examples/textures/textures_image_text.c index fb99e827..ce91fbf2 100644 --- a/examples/textures/textures_image_text.c +++ b/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) diff --git a/games/transmission/screens/screen_ending.c b/games/transmission/screens/screen_ending.c index 620fc30b..bb355b8b 100644 --- a/games/transmission/screens/screen_ending.c +++ b/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); diff --git a/games/transmission/screens/screen_gameplay.c b/games/transmission/screens/screen_gameplay.c index aeec98ca..814db824 100644 --- a/games/transmission/screens/screen_gameplay.c +++ b/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"); diff --git a/src/raylib.h b/src/raylib.h index 023d35c7..d4b5bd20 100644 --- a/src/raylib.h +++ b/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 diff --git a/src/text.c b/src/text.c index 80b75f10..770c8ddb 100644 --- a/src/text.c +++ b/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 };