diff --git a/examples/shapes/raygui.h b/examples/shapes/raygui.h index 623115fce..3c6b7ba42 100644 --- a/examples/shapes/raygui.h +++ b/examples/shapes/raygui.h @@ -266,8 +266,8 @@ * - void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle() * - void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker() * -* - Font GetFontDefault(void); // -- GuiLoadStyleDefault() -* - Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle() +* - RLFont GetFontDefault(void); // -- GuiLoadStyleDefault() +* - RLFont LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle() * - Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle(), required to load texture from embedded font atlas image * - void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle(), required to set shapes rec to font white rec (optimization) * - char *LoadFileText(const char *fileName); // -- GuiLoadStyle(), required to load charset data @@ -401,7 +401,7 @@ float height; } Rectangle; - // TODO: Texture2D type is very coupled to raylib, required by Font type + // TODO: Texture2D type is very coupled to raylib, required by RLFont type // It should be redesigned to be provided by user typedef struct Texture2D { unsigned int id; // OpenGL texture id @@ -429,16 +429,16 @@ Image image; // Character image data } GlyphInfo; - // TODO: Font type is very coupled to raylib, mostly required by GuiLoadStyle() + // TODO: RLFont type is very coupled to raylib, mostly required by GuiLoadStyle() // It should be redesigned to be provided by user - typedef struct Font { + typedef struct RLFont { int baseSize; // Base size (default chars height) int glyphCount; // Number of glyph characters int glyphPadding; // Padding around the glyph characters Texture2D texture; // Texture atlas containing the glyphs Rectangle *recs; // Rectangles in texture for the glyphs GlyphInfo *glyphs; // Glyphs info data - } Font; + } RLFont; #endif @@ -672,9 +672,9 @@ RAYGUIAPI void GuiSetAlpha(float alpha); // Set gui contr RAYGUIAPI void GuiSetState(int state); // Set gui state (global state) RAYGUIAPI int GuiGetState(void); // Get gui state (global state) -// Font set/get functions -RAYGUIAPI void GuiSetFont(Font font); // Set gui custom font (global state) -RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state) +// RLFont set/get functions +RAYGUIAPI void GuiSetFont(RLFont font); // Set gui custom font (global state) +RAYGUIAPI RLFont GuiGetFont(void); // Get gui custom font (global state) // Style set/get functions RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property @@ -1354,7 +1354,7 @@ typedef enum { BORDER = 0, BASE, TEXT, OTHER } GuiPropertyElement; //---------------------------------------------------------------------------------- static GuiState guiState = STATE_NORMAL; // Gui global state, if !STATE_NORMAL, forces defined state -static Font guiFont = { 0 }; // Gui current font (WARNING: highly coupled to raylib) +static RLFont guiFont = { 0 }; // Gui current font (WARNING: highly coupled to raylib) static bool guiLocked = false; // Gui lock state (no inputs processed) static float guiAlpha = 1.0f; // Gui controls transparency @@ -1425,8 +1425,8 @@ static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color // Text required functions //------------------------------------------------------------------------------- -static Font GetFontDefault(void); // -- GuiLoadStyleDefault() -static Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle(), load font +static RLFont GetFontDefault(void); // -- GuiLoadStyleDefault() +static RLFont LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle(), load font static Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle(), required to load texture from embedded font atlas image static void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle(), required to set shapes rec to font white rec (optimization) @@ -1516,8 +1516,8 @@ void GuiSetState(int state) { guiState = (GuiState)state; } int GuiGetState(void) { return guiState; } // Set custom gui font -// NOTE: Font loading/unloading is external to raygui -void GuiSetFont(Font font) +// NOTE: RLFont loading/unloading is external to raygui +void GuiSetFont(RLFont font) { if (font.texture.id > 0) { @@ -1531,7 +1531,7 @@ void GuiSetFont(Font font) } // Get custom gui font -Font GuiGetFont(void) +RLFont GuiGetFont(void) { return guiFont; } @@ -4003,7 +4003,7 @@ void GuiLoadStyle(const char *fileName) char fontFileName[256] = { 0 }; sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName); - Font font = { 0 }; + RLFont font = { 0 }; int *codepoints = NULL; int codepointCount = 0; @@ -4366,7 +4366,7 @@ static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize) else GuiSetStyle((int)controlId, (int)propertyId, propertyValue); } - // Font loading is highly dependant on raylib API to load font data and image + // RLFont loading is highly dependant on raylib API to load font data and image #if !defined(RAYGUI_STANDALONE) // Load custom font if available @@ -4376,7 +4376,7 @@ static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize) if (fontDataSize > 0) { - Font font = { 0 }; + RLFont font = { 0 }; int fontType = 0; // 0-Normal, 1-SDF memcpy(&font.baseSize, fileDataPtr, sizeof(int)); @@ -4420,7 +4420,7 @@ static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize) } else { - // Font atlas image data is not compressed + // RLFont atlas image data is not compressed imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageUncompSize); memcpy(imFont.data, fileDataPtr, fontImageUncompSize); fileDataPtr += fontImageUncompSize; diff --git a/examples/text/resources/DotGothic16-Regular_OFL.txt b/examples/text/resources/DotGothic16-Regular_OFL.txt index 118ae3acc..4a269e279 100644 --- a/examples/text/resources/DotGothic16-Regular_OFL.txt +++ b/examples/text/resources/DotGothic16-Regular_OFL.txt @@ -1,6 +1,6 @@ Copyright 2020 The DotGothic16 Project Authors (https://github.com/fontworks-fonts/DotGothic16) -This Font Software is licensed under the SIL Open Font License, Version 1.1. +This RLFont Software is licensed under the SIL Open RLFont License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL @@ -10,7 +10,7 @@ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide +The goals of the Open RLFont License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership @@ -26,56 +26,56 @@ requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS -"Font Software" refers to the set of files released by the Copyright +"RLFont Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. -"Reserved Font Name" refers to any names specified as such after the +"Reserved RLFont Name" refers to any names specified as such after the copyright statement(s). -"Original Version" refers to the collection of Font Software components as +"Original Version" refers to the collection of RLFont Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a +Original Version, by changing formats or by porting the RLFont Software to a new environment. "Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. +writer or other person who contributed to the RLFont Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font +a copy of the RLFont Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the RLFont Software, subject to the following conditions: -1) Neither the Font Software nor any of its individual components, +1) Neither the RLFont Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. -2) Original or Modified Versions of the Font Software may be bundled, +2) Original or Modified Versions of the RLFont Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. -3) No Modified Version of the Font Software may use the Reserved Font +3) No Modified Version of the RLFont Software may use the Reserved RLFont Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +4) The name(s) of the Copyright Holder(s) or the Author(s) of the RLFont Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. -5) The Font Software, modified or unmodified, in part or in whole, +5) The RLFont Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created -using the Font Software. +using the RLFont Software. TERMINATION This license becomes null and void if any of the above conditions are diff --git a/examples/text/resources/LICENSE.md b/examples/text/resources/LICENSE.md index 506a4aaf0..2d8b4ac80 100644 --- a/examples/text/resources/LICENSE.md +++ b/examples/text/resources/LICENSE.md @@ -8,13 +8,13 @@ | fonts/mecha.png | Captain Falcon | [Freeware](https://www.dafont.com/es/mecha-cf.font) | Atlas created by [@raysan5](https://github.com/raysan5) | | fonts/pixelplay.png | Aleksander Shevchuk | [Freeware](https://www.dafont.com/es/pixelplay.font) | Atlas created by [@raysan5](https://github.com/raysan5) | | fonts/pixantiqua.ttf | Gerhard Großmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | Atlas created by [@raysan5](https://github.com/raysan5) | -| anonymous_pro_bold.ttf | [Mark Simonson](https://fonts.google.com/specimen/Anonymous+Pro) | [Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | - | +| anonymous_pro_bold.ttf | [Mark Simonson](https://fonts.google.com/specimen/Anonymous+Pro) | [Open RLFont License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | - | | custom_alagard.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) | | custom_jupiter_crash.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) | | custom_mecha.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) | | dejavu.fnt, dejavu.png | [DejaVu Fonts](https://dejavu-fonts.github.io/) | [Free](https://dejavu-fonts.github.io/License.html) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) | | KAISG.ttf | [Dieter Steffmann](http://www.steffmann.de/wordpress/) | [Freeware](https://www.1001fonts.com/users/steffmann/) | [Kaiserzeit Gotisch](https://www.dafont.com/es/kaiserzeit-gotisch.font) font | -| noto_cjk.fnt, noto_cjk.png | [Google Fonts](https://www.google.com/get/noto/help/cjk/) | [Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) | +| noto_cjk.fnt, noto_cjk.png | [Google Fonts](https://www.google.com/get/noto/help/cjk/) | [Open RLFont License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) | | pixantiqua.fnt, pixantiqua.png | Gerhard Großmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) | | pixantiqua.ttf | Gerhard Großmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | - | | symbola.fnt, symbola.png | George Douros | [Freeware](https://fontlibrary.org/en/font/symbola) | Atlas made with [BMFont](https://www.angelcode.com/products/bmfont/) by [@raysan5](https://github.com/raysan5) | diff --git a/examples/text/text_codepoints_loading.c b/examples/text/text_codepoints_loading.c index 04df96e52..351c250ea 100644 --- a/examples/text/text_codepoints_loading.c +++ b/examples/text/text_codepoints_loading.c @@ -47,7 +47,7 @@ int main(void) // Load font containing all the provided codepoint glyphs // A texture font atlas is automatically generated - Font font = LoadFontEx("resources/DotGothic16-Regular.ttf", 36, codepointsNoDups, codepointsNoDupsCount); + RLFont font = LoadFontEx("resources/DotGothic16-Regular.ttf", 36, codepointsNoDups, codepointsNoDupsCount); // Set bilinear scale filter for better font scaling SetTextureFilter(font.texture, TEXTURE_FILTER_BILINEAR); diff --git a/examples/text/text_draw_3d.c b/examples/text/text_draw_3d.c index b279f1b36..d87a0d728 100644 --- a/examples/text/text_draw_3d.c +++ b/examples/text/text_draw_3d.c @@ -60,17 +60,17 @@ typedef struct WaveTextConfig { // Module Functions Declaration //-------------------------------------------------------------------------------------- // Draw a codepoint in 3D space -static void DrawTextCodepoint3D(Font font, int codepoint, Vector3 position, float fontSize, bool backface, Color tint); +static void DrawTextCodepoint3D(RLFont font, int codepoint, Vector3 position, float fontSize, bool backface, Color tint); // Draw a 2D text in 3D space -static void DrawText3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, Color tint); +static void DrawText3D(RLFont font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, Color tint); // Measure a text in 3D. For some reason `MeasureTextEx()` just doesn't seem to work so i had to use this instead. -static Vector3 MeasureText3D(Font font, const char *text, float fontSize, float fontSpacing, float lineSpacing); +static Vector3 MeasureText3D(RLFont font, const char *text, float fontSize, float fontSpacing, float lineSpacing); // Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~`. // This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle -static void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig *config, float time, Color tint); +static void DrawTextWave3D(RLFont font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig *config, float time, Color tint); // Measure a text in 3D ignoring the `~~` chars. -static Vector3 MeasureTextWave3D(Font font, const char *text, float fontSize, float fontSpacing, float lineSpacing); +static Vector3 MeasureTextWave3D(RLFont font, const char *text, float fontSize, float fontSpacing, float lineSpacing); // Generates a nice color with a random hue static Color GenerateRandomColor(float s, float v); @@ -104,7 +104,7 @@ int main(void) Vector3 cubeSize = { 2.0f, 2.0f, 2.0f }; // Use the default font - Font font = GetFontDefault(); + RLFont font = GetFontDefault(); float fontSize = 8.0f; float fontSpacing = 0.5f; float lineSpacing = -1.0f; @@ -451,7 +451,7 @@ int main(void) // Module Functions Definitions //-------------------------------------------------------------------------------------- // Draw codepoint at specified position in 3D space -static void DrawTextCodepoint3D(Font font, int codepoint, Vector3 position, float fontSize, bool backface, Color tint) +static void DrawTextCodepoint3D(RLFont font, int codepoint, Vector3 position, float fontSize, bool backface, Color tint) { // Character index position in sprite font // NOTE: In case a codepoint is not available in the font, index returned points to '?' @@ -518,7 +518,7 @@ static void DrawTextCodepoint3D(Font font, int codepoint, Vector3 position, floa } // Draw a 2D text in 3D space -static void DrawText3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, Color tint) +static void DrawText3D(RLFont font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, Color tint) { int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop @@ -561,7 +561,7 @@ static void DrawText3D(Font font, const char *text, Vector3 position, float font } // Measure a text in 3D. For some reason `MeasureTextEx()` just doesn't seem to work so i had to use this instead. -static Vector3 MeasureText3D(Font font, const char* text, float fontSize, float fontSpacing, float lineSpacing) +static Vector3 MeasureText3D(RLFont font, const char* text, float fontSize, float fontSpacing, float lineSpacing) { int len = TextLength(text); int tempLen = 0; // Used to count longer text line num chars @@ -617,7 +617,7 @@ static Vector3 MeasureText3D(Font font, const char* text, float fontSize, float // Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~`. // This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle -static void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig* config, float time, Color tint) +static void DrawTextWave3D(RLFont font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig* config, float time, Color tint) { int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop @@ -679,7 +679,7 @@ static void DrawTextWave3D(Font font, const char *text, Vector3 position, float } // Measure a text in 3D ignoring the `~~` chars. -static Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, float fontSpacing, float lineSpacing) +static Vector3 MeasureTextWave3D(RLFont font, const char* text, float fontSize, float fontSpacing, float lineSpacing) { int len = TextLength(text); int tempLen = 0; // Used to count longer text line num chars diff --git a/examples/text/text_font_filters.c b/examples/text/text_font_filters.c index b12f26055..bc2909833 100644 --- a/examples/text/text_font_filters.c +++ b/examples/text/text_font_filters.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Font filters +* raylib [text] example - RLFont filters * * NOTE: After font loading, font texture atlas filter could be configured for a softer * display of the font when scaling it to different sizes, that way, it's not required @@ -29,12 +29,12 @@ int main(void) InitWindow(screenWidth, screenHeight, "raylib [text] example - font filters"); - const char msg[50] = "Loaded Font"; + const char msg[50] = "Loaded RLFont"; // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) - // TTF Font loading with custom generation parameters - Font font = LoadFontEx("resources/KAISG.ttf", 96, 0, 0); + // TTF RLFont loading with custom generation parameters + RLFont font = LoadFontEx("resources/KAISG.ttf", 96, 0, 0); // Generate mipmap levels to use trilinear filtering // NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR @@ -114,7 +114,7 @@ int main(void) //DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED); DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY); - DrawText(TextFormat("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY); + DrawText(TextFormat("RLFont size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY); DrawText(TextFormat("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY); DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY); @@ -128,7 +128,7 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- - UnloadFont(font); // Font unloading + UnloadFont(font); // RLFont unloading CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/text/text_font_loading.c b/examples/text/text_font_loading.c index 2c8786c42..364d1ad37 100644 --- a/examples/text/text_font_loading.c +++ b/examples/text/text_font_loading.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Font loading +* raylib [text] example - RLFont loading * * NOTE: raylib can load fonts from multiple input file formats: * @@ -40,12 +40,12 @@ int main(void) // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) - // BMFont (AngelCode) : Font data and image atlas have been generated using external program - Font fontBm = LoadFont("resources/pixantiqua.fnt"); + // BMFont (AngelCode) : RLFont data and image atlas have been generated using external program + RLFont fontBm = LoadFont("resources/pixantiqua.fnt"); - // TTF font : Font data and atlas are generated directly from TTF + // TTF font : RLFont data and atlas are generated directly from TTF // NOTE: We define a font base size of 32 pixels tall and up-to 250 characters - Font fontTtf = LoadFontEx("resources/pixantiqua.ttf", 32, 0, 250); + RLFont fontTtf = LoadFontEx("resources/pixantiqua.ttf", 32, 0, 250); SetTextLineSpacing(48); // Set line spacing for multiline text (when line breaks are included '\n') @@ -88,8 +88,8 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- - UnloadFont(fontBm); // AngelCode Font unloading - UnloadFont(fontTtf); // TTF Font unloading + UnloadFont(fontBm); // AngelCode RLFont unloading + UnloadFont(fontTtf); // TTF RLFont unloading CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/text/text_font_sdf.c b/examples/text/text_font_sdf.c index 95245741e..56e892bbb 100644 --- a/examples/text/text_font_sdf.c +++ b/examples/text/text_font_sdf.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Font SDF loading +* raylib [text] example - RLFont SDF loading * * Example originally created with raylib 1.3, last time updated with raylib 4.0 * @@ -42,7 +42,7 @@ int main(void) unsigned char *fileData = LoadFileData("resources/anonymous_pro_bold.ttf", &fileSize); // Default font generation from TTF font - Font fontDefault = { 0 }; + RLFont fontDefault = { 0 }; fontDefault.baseSize = 16; fontDefault.glyphCount = 95; @@ -55,7 +55,7 @@ int main(void) UnloadImage(atlas); // SDF font generation from TTF font - Font fontSDF = { 0 }; + RLFont fontSDF = { 0 }; fontSDF.baseSize = 16; fontSDF.glyphCount = 95; // Parameters > font size: 16, no glyphs array provided (0), glyphs count: 0 (defaults to 95) diff --git a/examples/text/text_font_spritefont.c b/examples/text/text_font_spritefont.c index 1b2695c71..b2be60abc 100644 --- a/examples/text/text_font_spritefont.c +++ b/examples/text/text_font_spritefont.c @@ -40,9 +40,9 @@ int main(void) const char msg3[50] = "...and a THIRD one! GREAT! :D"; // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) - Font font1 = LoadFont("resources/custom_mecha.png"); // Font loading - Font font2 = LoadFont("resources/custom_alagard.png"); // Font loading - Font font3 = LoadFont("resources/custom_jupiter_crash.png"); // Font loading + RLFont font1 = LoadFont("resources/custom_mecha.png"); // RLFont loading + RLFont font2 = LoadFont("resources/custom_alagard.png"); // RLFont loading + RLFont font3 = LoadFont("resources/custom_jupiter_crash.png"); // RLFont loading Vector2 fontPosition1 = { screenWidth/2.0f - MeasureTextEx(font1, msg1, (float)font1.baseSize, -3).x/2, screenHeight/2.0f - font1.baseSize/2.0f - 80.0f }; @@ -80,9 +80,9 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- - UnloadFont(font1); // Font unloading - UnloadFont(font2); // Font unloading - UnloadFont(font3); // Font unloading + UnloadFont(font1); // RLFont unloading + UnloadFont(font2); // RLFont unloading + UnloadFont(font3); // RLFont unloading CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/text/text_raylib_fonts.c b/examples/text/text_raylib_fonts.c index acd18d94c..78acbd966 100644 --- a/examples/text/text_raylib_fonts.c +++ b/examples/text/text_raylib_fonts.c @@ -31,7 +31,7 @@ int main(void) InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts"); // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) - Font fonts[MAX_FONTS] = { 0 }; + RLFont fonts[MAX_FONTS] = { 0 }; fonts[0] = LoadFont("resources/fonts/alagard.png"); fonts[1] = LoadFont("resources/fonts/pixelplay.png"); diff --git a/examples/text/text_rectangle_bounds.c b/examples/text/text_rectangle_bounds.c index 173d3f93d..883242075 100644 --- a/examples/text/text_rectangle_bounds.c +++ b/examples/text/text_rectangle_bounds.c @@ -15,8 +15,8 @@ #include "raylib.h" -static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits -static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection +static void DrawTextBoxed(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits +static void DrawTextBoxedSelectable(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection //------------------------------------------------------------------------------------ // Program main entry point @@ -48,7 +48,7 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris Vector2 lastMouse = { 0.0f, 0.0f }; // Stores last mouse coordinates Color borderColor = MAROON; // Container border color - Font font = GetFontDefault(); // Get default system font + RLFont font = GetFontDefault(); // Get default system font SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -132,13 +132,13 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris //-------------------------------------------------------------------------------------- // Draw text using font inside rectangle limits -static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint) +static void DrawTextBoxed(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint) { DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE); } // Draw text using font inside rectangle limits with support for text selection -static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint) +static void DrawTextBoxedSelectable(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint) { int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop diff --git a/examples/text/text_unicode.c b/examples/text/text_unicode.c index 2b5245be9..e49f673fb 100644 --- a/examples/text/text_unicode.c +++ b/examples/text/text_unicode.c @@ -135,8 +135,8 @@ struct { //-------------------------------------------------------------------------------------- static void RandomizeEmoji(void); // Fills the emoji array with random emojis -static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits -static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection +static void DrawTextBoxed(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits +static void DrawTextBoxedSelectable(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection //-------------------------------------------------------------------------------------- // Global variables @@ -166,9 +166,9 @@ int main(void) // Load the font resources // NOTE: fontAsian is for asian languages, // fontEmoji is the emojis and fontDefault is used for everything else - Font fontDefault = LoadFont("resources/dejavu.fnt"); - Font fontAsian = LoadFont("resources/noto_cjk.fnt"); - Font fontEmoji = LoadFont("resources/symbola.fnt"); + RLFont fontDefault = LoadFont("resources/dejavu.fnt"); + RLFont fontAsian = LoadFont("resources/noto_cjk.fnt"); + RLFont fontEmoji = LoadFont("resources/symbola.fnt"); Vector2 hoveredPos = { 0.0f, 0.0f }; Vector2 selectedPos = { 0.0f, 0.0f }; @@ -234,7 +234,7 @@ int main(void) { const int message = emoji[selected].message; const int horizontalPadding = 20, verticalPadding = 30; - Font *font = &fontDefault; + RLFont *font = &fontDefault; // Set correct font for asian languages if (TextIsEqual(messages[message].language, "Chinese") || @@ -331,13 +331,13 @@ static void RandomizeEmoji(void) //-------------------------------------------------------------------------------------- // Draw text using font inside rectangle limits -static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint) +static void DrawTextBoxed(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint) { DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE); } // Draw text using font inside rectangle limits with support for text selection -static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint) +static void DrawTextBoxedSelectable(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint) { int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop diff --git a/examples/textures/textures_image_drawing.c b/examples/textures/textures_image_drawing.c index f49bc9e77..24df5433d 100644 --- a/examples/textures/textures_image_drawing.c +++ b/examples/textures/textures_image_drawing.c @@ -48,7 +48,7 @@ int main(void) UnloadImage(cat); // Unload image from RAM // Load custom font for frawing on image - Font font = LoadFont("resources/custom_jupiter_crash.png"); + RLFont font = LoadFont("resources/custom_jupiter_crash.png"); // Draw over image using custom font ImageDrawTextEx(&parrots, font, "PARROTS & CAT", (Vector2){ 300, 230 }, (float)font.baseSize, -2, WHITE); diff --git a/examples/textures/textures_image_text.c b/examples/textures/textures_image_text.c index 856b64ed0..63bd72af3 100644 --- a/examples/textures/textures_image_text.c +++ b/examples/textures/textures_image_text.c @@ -27,8 +27,8 @@ int main(void) Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM) - // TTF Font loading with custom generation parameters - Font font = LoadFontEx("resources/KAISG.ttf", 64, 0, 0); + // TTF RLFont loading with custom generation parameters + RLFont font = LoadFontEx("resources/KAISG.ttf", 64, 0, 0); // Draw over image using custom font ImageDrawTextEx(&parrots, font, "[Parrots font drawing]", (Vector2){ 20.0f, 20.0f }, (float)font.baseSize, 0.0f, RED); diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json index b0f82d3c4..9cf0e5969 100644 --- a/parser/output/raylib_api.json +++ b/parser/output/raylib_api.json @@ -690,8 +690,8 @@ ] }, { - "name": "Font", - "description": "Font, font texture and GlyphInfo array data", + "name": "RLFont", + "description": "RLFont, font texture and GlyphInfo array data", "fields": [ { "type": "int", @@ -2818,7 +2818,7 @@ }, { "name": "FontType", - "description": "Font type, defines generation method", + "description": "RLFont type, defines generation method", "values": [ { "name": "FONT_DEFAULT", @@ -7126,7 +7126,7 @@ "returnType": "Image", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -7999,7 +7999,7 @@ "name": "dst" }, { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -8572,13 +8572,13 @@ }, { "name": "GetFontDefault", - "description": "Get the default Font", - "returnType": "Font" + "description": "Get the default RLFont", + "returnType": "RLFont" }, { "name": "LoadFont", "description": "Load font from file into GPU memory (VRAM)", - "returnType": "Font", + "returnType": "RLFont", "params": [ { "type": "const char *", @@ -8589,7 +8589,7 @@ { "name": "LoadFontEx", "description": "Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont", - "returnType": "Font", + "returnType": "RLFont", "params": [ { "type": "const char *", @@ -8612,7 +8612,7 @@ { "name": "LoadFontFromImage", "description": "Load font from Image (XNA style)", - "returnType": "Font", + "returnType": "RLFont", "params": [ { "type": "Image", @@ -8631,7 +8631,7 @@ { "name": "LoadFontFromMemory", "description": "Load font from memory buffer, fileType refers to extension: i.e. '.ttf'", - "returnType": "Font", + "returnType": "RLFont", "params": [ { "type": "const char *", @@ -8665,7 +8665,7 @@ "returnType": "bool", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" } ] @@ -8753,7 +8753,7 @@ "returnType": "void", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" } ] @@ -8764,7 +8764,7 @@ "returnType": "bool", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -8821,7 +8821,7 @@ "returnType": "void", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -8848,11 +8848,11 @@ }, { "name": "DrawTextPro", - "description": "Draw text using Font and pro parameters (rotation)", + "description": "Draw text using RLFont and pro parameters (rotation)", "returnType": "void", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -8891,7 +8891,7 @@ "returnType": "void", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -8918,7 +8918,7 @@ "returnType": "void", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -8975,11 +8975,11 @@ }, { "name": "MeasureTextEx", - "description": "Measure string size for Font", + "description": "Measure string size for RLFont", "returnType": "Vector2", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -9002,7 +9002,7 @@ "returnType": "int", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -9017,7 +9017,7 @@ "returnType": "GlyphInfo", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { @@ -9032,7 +9032,7 @@ "returnType": "Rectangle", "params": [ { - "type": "Font", + "type": "RLFont", "name": "font" }, { diff --git a/parser/output/raylib_api.lua b/parser/output/raylib_api.lua index c547fea22..e61dd6b4a 100644 --- a/parser/output/raylib_api.lua +++ b/parser/output/raylib_api.lua @@ -690,8 +690,8 @@ return { } }, { - name = "Font", - description = "Font, font texture and GlyphInfo array data", + name = "RLFont", + description = "RLFont, font texture and GlyphInfo array data", fields = { { type = "int", @@ -2818,7 +2818,7 @@ return { }, { name = "FontType", - description = "Font type, defines generation method", + description = "RLFont type, defines generation method", values = { { name = "FONT_DEFAULT", @@ -5490,7 +5490,7 @@ return { description = "Create an image from text (custom sprite font)", returnType = "Image", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "const char *", name = "text"}, {type = "float", name = "fontSize"}, {type = "float", name = "spacing"}, @@ -5955,7 +5955,7 @@ return { returnType = "void", params = { {type = "Image *", name = "dst"}, - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "const char *", name = "text"}, {type = "Vector2", name = "position"}, {type = "float", name = "fontSize"}, @@ -6280,13 +6280,13 @@ return { }, { name = "GetFontDefault", - description = "Get the default Font", - returnType = "Font" + description = "Get the default RLFont", + returnType = "RLFont" }, { name = "LoadFont", description = "Load font from file into GPU memory (VRAM)", - returnType = "Font", + returnType = "RLFont", params = { {type = "const char *", name = "fileName"} } @@ -6294,7 +6294,7 @@ return { { name = "LoadFontEx", description = "Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont", - returnType = "Font", + returnType = "RLFont", params = { {type = "const char *", name = "fileName"}, {type = "int", name = "fontSize"}, @@ -6305,7 +6305,7 @@ return { { name = "LoadFontFromImage", description = "Load font from Image (XNA style)", - returnType = "Font", + returnType = "RLFont", params = { {type = "Image", name = "image"}, {type = "Color", name = "key"}, @@ -6315,7 +6315,7 @@ return { { name = "LoadFontFromMemory", description = "Load font from memory buffer, fileType refers to extension: i.e. '.ttf'", - returnType = "Font", + returnType = "RLFont", params = { {type = "const char *", name = "fileType"}, {type = "const unsigned char *", name = "fileData"}, @@ -6330,7 +6330,7 @@ return { description = "Check if a font is ready", returnType = "bool", params = { - {type = "Font", name = "font"} + {type = "RLFont", name = "font"} } }, { @@ -6373,7 +6373,7 @@ return { description = "Unload font from GPU memory (VRAM)", returnType = "void", params = { - {type = "Font", name = "font"} + {type = "RLFont", name = "font"} } }, { @@ -6381,7 +6381,7 @@ return { description = "Export font as code file, returns true on success", returnType = "bool", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "const char *", name = "fileName"} } }, @@ -6411,7 +6411,7 @@ return { description = "Draw text using font and additional parameters", returnType = "void", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "const char *", name = "text"}, {type = "Vector2", name = "position"}, {type = "float", name = "fontSize"}, @@ -6421,10 +6421,10 @@ return { }, { name = "DrawTextPro", - description = "Draw text using Font and pro parameters (rotation)", + description = "Draw text using RLFont and pro parameters (rotation)", returnType = "void", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "const char *", name = "text"}, {type = "Vector2", name = "position"}, {type = "Vector2", name = "origin"}, @@ -6439,7 +6439,7 @@ return { description = "Draw one character (codepoint)", returnType = "void", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "int", name = "codepoint"}, {type = "Vector2", name = "position"}, {type = "float", name = "fontSize"}, @@ -6451,7 +6451,7 @@ return { description = "Draw multiple character (codepoint)", returnType = "void", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "const int *", name = "codepoints"}, {type = "int", name = "codepointCount"}, {type = "Vector2", name = "position"}, @@ -6479,10 +6479,10 @@ return { }, { name = "MeasureTextEx", - description = "Measure string size for Font", + description = "Measure string size for RLFont", returnType = "Vector2", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "const char *", name = "text"}, {type = "float", name = "fontSize"}, {type = "float", name = "spacing"} @@ -6493,7 +6493,7 @@ return { description = "Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found", returnType = "int", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "int", name = "codepoint"} } }, @@ -6502,7 +6502,7 @@ return { description = "Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found", returnType = "GlyphInfo", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "int", name = "codepoint"} } }, @@ -6511,7 +6511,7 @@ return { description = "Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found", returnType = "Rectangle", params = { - {type = "Font", name = "font"}, + {type = "RLFont", name = "font"}, {type = "int", name = "codepoint"} } }, diff --git a/parser/output/raylib_api.txt b/parser/output/raylib_api.txt index 4e1c03af1..f1e9f6aec 100644 --- a/parser/output/raylib_api.txt +++ b/parser/output/raylib_api.txt @@ -374,9 +374,9 @@ Struct 11: GlyphInfo (5 fields) Field[3]: int offsetY // Character offset Y when drawing Field[4]: int advanceX // Character advance position X Field[5]: Image image // Character image data -Struct 12: Font (6 fields) - Name: Font - Description: Font, font texture and GlyphInfo array data +Struct 12: RLFont (6 fields) + Name: RLFont + Description: RLFont, font texture and GlyphInfo array data Field[1]: int baseSize // Base size (default chars height) Field[2]: int glyphCount // Number of glyph characters Field[3]: int glyphPadding // Padding around the glyph characters @@ -890,7 +890,7 @@ Enum 15: CubemapLayout (6 values) Value[CUBEMAP_LAYOUT_PANORAMA]: 5 Enum 16: FontType (3 values) Name: FontType - Description: Font type, defines generation method + Description: RLFont type, defines generation method Value[FONT_DEFAULT]: 0 Value[FONT_BITMAP]: 1 Value[FONT_SDF]: 2 @@ -2751,7 +2751,7 @@ Function 291: ImageTextEx() (5 input parameters) Name: ImageTextEx Return type: Image Description: Create an image from text (custom sprite font) - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Param[2]: text (type: const char *) Param[3]: fontSize (type: float) Param[4]: spacing (type: float) @@ -3075,7 +3075,7 @@ Function 338: ImageDrawTextEx() (7 input parameters) Return type: void Description: Draw text (custom sprite font) within an image (destination) Param[1]: dst (type: Image *) - Param[2]: font (type: Font) + Param[2]: font (type: RLFont) Param[3]: text (type: const char *) Param[4]: position (type: Vector2) Param[5]: fontSize (type: float) @@ -3296,17 +3296,17 @@ Function 372: GetPixelDataSize() (3 input parameters) Param[3]: format (type: int) Function 373: GetFontDefault() (0 input parameters) Name: GetFontDefault - Return type: Font - Description: Get the default Font + Return type: RLFont + Description: Get the default RLFont No input parameters Function 374: LoadFont() (1 input parameters) Name: LoadFont - Return type: Font + Return type: RLFont Description: Load font from file into GPU memory (VRAM) Param[1]: fileName (type: const char *) Function 375: LoadFontEx() (4 input parameters) Name: LoadFontEx - Return type: Font + Return type: RLFont Description: Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont Param[1]: fileName (type: const char *) Param[2]: fontSize (type: int) @@ -3314,14 +3314,14 @@ Function 375: LoadFontEx() (4 input parameters) Param[4]: codepointCount (type: int) Function 376: LoadFontFromImage() (3 input parameters) Name: LoadFontFromImage - Return type: Font + Return type: RLFont Description: Load font from Image (XNA style) Param[1]: image (type: Image) Param[2]: key (type: Color) Param[3]: firstChar (type: int) Function 377: LoadFontFromMemory() (6 input parameters) Name: LoadFontFromMemory - Return type: Font + Return type: RLFont Description: Load font from memory buffer, fileType refers to extension: i.e. '.ttf' Param[1]: fileType (type: const char *) Param[2]: fileData (type: const unsigned char *) @@ -3333,7 +3333,7 @@ Function 378: IsFontReady() (1 input parameters) Name: IsFontReady Return type: bool Description: Check if a font is ready - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Function 379: LoadFontData() (6 input parameters) Name: LoadFontData Return type: GlyphInfo * @@ -3364,12 +3364,12 @@ Function 382: UnloadFont() (1 input parameters) Name: UnloadFont Return type: void Description: Unload font from GPU memory (VRAM) - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Function 383: ExportFontAsCode() (2 input parameters) Name: ExportFontAsCode Return type: bool Description: Export font as code file, returns true on success - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Param[2]: fileName (type: const char *) Function 384: DrawFPS() (2 input parameters) Name: DrawFPS @@ -3390,7 +3390,7 @@ Function 386: DrawTextEx() (6 input parameters) Name: DrawTextEx Return type: void Description: Draw text using font and additional parameters - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Param[2]: text (type: const char *) Param[3]: position (type: Vector2) Param[4]: fontSize (type: float) @@ -3399,8 +3399,8 @@ Function 386: DrawTextEx() (6 input parameters) Function 387: DrawTextPro() (8 input parameters) Name: DrawTextPro Return type: void - Description: Draw text using Font and pro parameters (rotation) - Param[1]: font (type: Font) + Description: Draw text using RLFont and pro parameters (rotation) + Param[1]: font (type: RLFont) Param[2]: text (type: const char *) Param[3]: position (type: Vector2) Param[4]: origin (type: Vector2) @@ -3412,7 +3412,7 @@ Function 388: DrawTextCodepoint() (5 input parameters) Name: DrawTextCodepoint Return type: void Description: Draw one character (codepoint) - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Param[2]: codepoint (type: int) Param[3]: position (type: Vector2) Param[4]: fontSize (type: float) @@ -3421,7 +3421,7 @@ Function 389: DrawTextCodepoints() (7 input parameters) Name: DrawTextCodepoints Return type: void Description: Draw multiple character (codepoint) - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Param[2]: codepoints (type: const int *) Param[3]: codepointCount (type: int) Param[4]: position (type: Vector2) @@ -3442,8 +3442,8 @@ Function 391: MeasureText() (2 input parameters) Function 392: MeasureTextEx() (4 input parameters) Name: MeasureTextEx Return type: Vector2 - Description: Measure string size for Font - Param[1]: font (type: Font) + Description: Measure string size for RLFont + Param[1]: font (type: RLFont) Param[2]: text (type: const char *) Param[3]: fontSize (type: float) Param[4]: spacing (type: float) @@ -3451,19 +3451,19 @@ Function 393: GetGlyphIndex() (2 input parameters) Name: GetGlyphIndex Return type: int Description: Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Param[2]: codepoint (type: int) Function 394: GetGlyphInfo() (2 input parameters) Name: GetGlyphInfo Return type: GlyphInfo Description: Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Param[2]: codepoint (type: int) Function 395: GetGlyphAtlasRec() (2 input parameters) Name: GetGlyphAtlasRec Return type: Rectangle Description: Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found - Param[1]: font (type: Font) + Param[1]: font (type: RLFont) Param[2]: codepoint (type: int) Function 396: LoadUTF8() (2 input parameters) Name: LoadUTF8 diff --git a/parser/output/raylib_api.xml b/parser/output/raylib_api.xml index e439dff74..d6dc4d07c 100644 --- a/parser/output/raylib_api.xml +++ b/parser/output/raylib_api.xml @@ -138,7 +138,7 @@ - + @@ -597,7 +597,7 @@ - + @@ -1783,7 +1783,7 @@ - + @@ -2013,7 +2013,7 @@ - + @@ -2165,23 +2165,23 @@ - + - + - + - + - + @@ -2190,7 +2190,7 @@ - + @@ -2213,10 +2213,10 @@ - + - + @@ -2231,15 +2231,15 @@ - + - - + + @@ -2249,14 +2249,14 @@ - + - + @@ -2271,22 +2271,22 @@ - - + + - + - + - + diff --git a/projects/Geany/raylib.c.tags b/projects/Geany/raylib.c.tags index 79a192a14..3ff0a9463 100644 --- a/projects/Geany/raylib.c.tags +++ b/projects/Geany/raylib.c.tags @@ -194,12 +194,12 @@ ImageMipmaps|void|(Image *image);| ImageDither|void|(Image *image, int rBpp, int gBpp, int bBpp, int aBpp);| ImageExtractPalette|Color *|(Image image, int maxPaletteSize, int *extractCount);| ImageText|Image|(const char *text, int fontSize, Color color);| -ImageTextEx|Image|(Font font, const char *text, float fontSize, float spacing, Color tint);| +ImageTextEx|Image|(RLFont font, const char *text, float fontSize, float spacing, Color tint);| ImageDraw|void|(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec);| ImageDrawRectangle|void|(Image *dst, Rectangle rec, Color color);| ImageDrawRectangleLines|void|(Image *dst, Rectangle rec, int thick, Color color);| ImageDrawText|void|(Image *dst, Vector2 position, const char *text, int fontSize, Color color);| -ImageDrawTextEx|void|(Image *dst, Vector2 position, Font font, const char *text, float fontSize, float spacing, Color color);| +ImageDrawTextEx|void|(Image *dst, Vector2 position, RLFont font, const char *text, float fontSize, float spacing, Color color);| ImageFlipVertical|void|(Image *image);| ImageFlipHorizontal|void|(Image *image);| ImageRotate|void|(Image *image, int degrees);| @@ -229,21 +229,21 @@ DrawTextureRec|void|(Texture2D texture, Rectangle sourceRec, Vector2 position, C DrawTextureQuad|void|(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint);| DrawTexturePro|void|(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint);| DrawTextureNPatch|void|(Texture2D texture, NPatchInfo nPatchInfo, Rectangle destRec, Vector2 origin, float rotation, Color tint);| -GetFontDefault|Font|(void);| -LoadFont|Font|(const char *fileName);| -LoadFontEx|Font|(const char *fileName, int fontSize, int *fontChars, int charsCount);| -LoadFontFromImage|Font|(Image image, Color key, int firstChar);| +GetFontDefault|RLFont|(void);| +LoadFont|RLFont|(const char *fileName);| +LoadFontEx|RLFont|(const char *fileName, int fontSize, int *fontChars, int charsCount);| +LoadFontFromImage|RLFont|(Image image, Color key, int firstChar);| LoadFontData|CharInfo *|(const char *fileName, int fontSize, int *fontChars, int charsCount, int type);| GenImageFontAtlas|Image|(CharInfo *chars, int charsCount, int fontSize, int padding, int packMethod);| -UnloadFont|void|(Font font);| +UnloadFont|void|(RLFont font);| DrawFPS|void|(int posX, int posY);| DrawText|void|(const char *text, int posX, int posY, int fontSize, Color color);| -DrawTextEx|void|(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint);| -DrawTextRec|void|(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint);| -DrawTextRecEx|void|(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectText, Color selectBack);| +DrawTextEx|void|(RLFont font, const char *text, Vector2 position, float fontSize, float spacing, Color tint);| +DrawTextRec|void|(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint);| +DrawTextRecEx|void|(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectText, Color selectBack);| MeasureText|int|(const char *text, int fontSize);| -MeasureTextEx|Vector2|(Font font, const char *text, float fontSize, float spacing);| -GetGlyphIndex|int|(Font font, int character);| +MeasureTextEx|Vector2|(RLFont font, const char *text, float fontSize, float spacing);| +GetGlyphIndex|int|(RLFont font, int character);| TextIsEqual|bool|(const char *text1, const char *text2);| TextLength|unsigned int|(const char *text);| TextFormat|const char *|(const char *text, ...);| @@ -406,7 +406,7 @@ Texture|struct|| RenderTexture|struct|| NPatchInfo|struct|| CharInfo|struct|| -Font|struct|| +RLFont|struct|| Camera|struct|| Camera2D|struct|| Mesh|struct|| diff --git a/projects/Notepad++/raylib_npp_parser/raylib_npp.xml b/projects/Notepad++/raylib_npp_parser/raylib_npp.xml index 6c0552974..1fc3fc70f 100644 --- a/projects/Notepad++/raylib_npp_parser/raylib_npp.xml +++ b/projects/Notepad++/raylib_npp_parser/raylib_npp.xml @@ -1670,7 +1670,7 @@ - + @@ -1990,7 +1990,7 @@ - + @@ -2215,20 +2215,20 @@ - + - + - + - + - + @@ -2236,14 +2236,14 @@ - + - + @@ -2254,7 +2254,7 @@ - + @@ -2285,12 +2285,12 @@ - + - + @@ -2313,7 +2313,7 @@ - + @@ -2322,8 +2322,8 @@ - - + + @@ -2335,7 +2335,7 @@ - + @@ -2344,7 +2344,7 @@ - + @@ -2367,8 +2367,8 @@ - - + + @@ -2376,19 +2376,19 @@ - + - + - + @@ -2822,7 +2822,7 @@ - + @@ -3452,5 +3452,3 @@ - - diff --git a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h index 8776d4349..bc35ade15 100644 --- a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h +++ b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h @@ -366,7 +366,7 @@ RLAPI Image GenImageText(int width, int height, const char *text); RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) RLAPI Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font) -RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font) +RLAPI Image ImageTextEx(RLFont font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font) RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format RLAPI void ImageToPOT(Image *image, Color fill); // Convert image to POT (power-of-two) RLAPI void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle @@ -416,7 +416,7 @@ RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source) RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination) -RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination) +RLAPI void ImageDrawTextEx(Image *dst, RLFont font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination) // Texture loading functions // NOTE: These functions require GPU access @@ -462,37 +462,37 @@ RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // S RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes for certain format //------------------------------------------------------------------------------------ -// Font Loading and Text Drawing Functions (Module: text) +// RLFont Loading and Text Drawing Functions (Module: text) //------------------------------------------------------------------------------------ -// 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 *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set -RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) -RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf' -RLAPI bool IsFontReady(Font font); // Check if a font is ready +// RLFont loading/unloading functions +RLAPI RLFont GetFontDefault(void); // Get the default RLFont +RLAPI RLFont LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM) +RLAPI RLFont LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set +RLAPI RLFont LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) +RLAPI RLFont LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf' +RLAPI bool IsFontReady(RLFont font); // Check if a font is ready RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info RLAPI void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM) -RLAPI void UnloadFont(Font font); // Unload font from GPU memory (VRAM) -RLAPI bool ExportFontAsCode(Font font, const char *fileName); // Export font as code file, returns true on success +RLAPI void UnloadFont(RLFont font); // Unload font from GPU memory (VRAM) +RLAPI bool ExportFontAsCode(RLFont font, const char *fileName); // Export font as code file, returns true on success // Text drawing functions RLAPI void DrawFPS(int posX, int posY); // Draw current FPS RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) -RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters -RLAPI void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); // Draw text using Font and pro parameters (rotation) -RLAPI void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint) -RLAPI void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); // Draw multiple character (codepoint) +RLAPI void DrawTextEx(RLFont font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters +RLAPI void DrawTextPro(RLFont font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); // Draw text using RLFont and pro parameters (rotation) +RLAPI void DrawTextCodepoint(RLFont font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint) +RLAPI void DrawTextCodepoints(RLFont font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); // Draw multiple character (codepoint) // Text font info functions RLAPI void SetTextLineSpacing(int spacing); // Set vertical line spacing when drawing with line-breaks RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font -RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font -RLAPI int GetGlyphIndex(Font font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found -RLAPI GlyphInfo GetGlyphInfo(Font font, int codepoint); // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found -RLAPI Rectangle GetGlyphAtlasRec(Font font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found +RLAPI Vector2 MeasureTextEx(RLFont font, const char *text, float fontSize, float spacing); // Measure string size for RLFont +RLAPI int GetGlyphIndex(RLFont font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found +RLAPI GlyphInfo GetGlyphInfo(RLFont font, int codepoint); // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found +RLAPI Rectangle GetGlyphAtlasRec(RLFont font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found // Text codepoints management functions (unicode characters) RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array diff --git a/src/Makefile b/src/Makefile index 2d426b163..c1803b950 100644 --- a/src/Makefile +++ b/src/Makefile @@ -400,7 +400,7 @@ endif ifeq ($(PLATFORM),PLATFORM_DRM) # without EGL_NO_X11 eglplatform.h tears Xlib.h in which tears X.h in - # which contains a conflicting type Font + # which contains a conflicting type RLFont CFLAGS += -DEGL_NO_X11 CFLAGS += -Werror=implicit-function-declaration endif diff --git a/src/external/stb_truetype.h b/src/external/stb_truetype.h index bbf2284b1..2b7ffae0c 100644 --- a/src/external/stb_truetype.h +++ b/src/external/stb_truetype.h @@ -168,11 +168,11 @@ // which is the origin of each character. The current point's vertical // position is the baseline. Even "baked fonts" use this model. // -// Vertical Font Metrics +// Vertical RLFont Metrics // The vertical qualities of the font, used to vertically position // and space the characters. See docs for stbtt_GetFontVMetrics. // -// Font Size in Pixels or Points +// RLFont Size in Pixels or Points // The preferred interface for specifying font sizes in stb_truetype // is to specify how tall the font's vertical extent should be in pixels. // If that sounds good enough, skip the next paragraph. diff --git a/src/platforms/rcore_desktop.c b/src/platforms/rcore_desktop.c index 7f76ec5b5..b3066e5bf 100644 --- a/src/platforms/rcore_desktop.c +++ b/src/platforms/rcore_desktop.c @@ -72,7 +72,7 @@ #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include // Required for: timespec, nanosleep(), select() - POSIX - //#define GLFW_EXPOSE_NATIVE_X11 // WARNING: Exposing Xlib.h > X.h results in dup symbols for Font type + //#define GLFW_EXPOSE_NATIVE_X11 // WARNING: Exposing Xlib.h > X.h results in dup symbols for RLFont type //#define GLFW_EXPOSE_NATIVE_WAYLAND //#define GLFW_EXPOSE_NATIVE_MIR #include "GLFW/glfw3native.h" // Required for: glfwGetX11Window() diff --git a/src/raylib.h b/src/raylib.h index 7cf4e6536..5cb0f00c8 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -21,7 +21,7 @@ * - Bindings to multiple programming languages available! * * NOTES: -* - One default Font is loaded on InitWindow()->LoadFontDefault() [core, text] +* - One default RLFont is loaded on InitWindow()->LoadFontDefault() [core, text] * - One default Texture2D is loaded on rlglInit(), 1x1 white pixel R8G8B8A8 [rlgl] (OpenGL 3.3 or ES2) * - One default Shader is loaded on rlglInit()->rlLoadShaderDefault() [rlgl] (OpenGL 3.3 or ES2) * - One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2) @@ -306,15 +306,15 @@ typedef struct GlyphInfo { Image image; // Character image data } GlyphInfo; -// Font, font texture and GlyphInfo array data -typedef struct Font { +// RLFont, font texture and GlyphInfo array data +typedef struct RLFont { int baseSize; // Base size (default chars height) int glyphCount; // Number of glyph characters int glyphPadding; // Padding around the glyph characters Texture2D texture; // Texture atlas containing the glyphs Rectangle *recs; // Rectangles in texture for the glyphs GlyphInfo *glyphs; // Glyphs info data -} Font; +} RLFont; // Camera, defines position/orientation in 3d space typedef struct Camera3D { @@ -876,7 +876,7 @@ typedef enum { CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirrectangular map) } CubemapLayout; -// Font type, defines generation method +// RLFont type, defines generation method typedef enum { FONT_DEFAULT = 0, // Default font generation, anti-aliased FONT_BITMAP, // Bitmap font generation, no anti-aliasing @@ -1328,7 +1328,7 @@ RLAPI Image GenImageText(int width, int height, const char *text); RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) RLAPI Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font) -RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font) +RLAPI Image ImageTextEx(RLFont font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font) RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format RLAPI void ImageToPOT(Image *image, Color fill); // Convert image to POT (power-of-two) RLAPI void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle @@ -1378,7 +1378,7 @@ RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source) RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination) -RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination) +RLAPI void ImageDrawTextEx(Image *dst, RLFont font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination) // Texture loading functions // NOTE: These functions require GPU access @@ -1424,37 +1424,37 @@ RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // S RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes for certain format //------------------------------------------------------------------------------------ -// Font Loading and Text Drawing Functions (Module: text) +// RLFont Loading and Text Drawing Functions (Module: text) //------------------------------------------------------------------------------------ -// 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 *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set -RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) -RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf' -RLAPI bool IsFontReady(Font font); // Check if a font is ready +// RLFont loading/unloading functions +RLAPI RLFont GetFontDefault(void); // Get the default RLFont +RLAPI RLFont LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM) +RLAPI RLFont LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set +RLAPI RLFont LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) +RLAPI RLFont LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf' +RLAPI bool IsFontReady(RLFont font); // Check if a font is ready RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info RLAPI void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM) -RLAPI void UnloadFont(Font font); // Unload font from GPU memory (VRAM) -RLAPI bool ExportFontAsCode(Font font, const char *fileName); // Export font as code file, returns true on success +RLAPI void UnloadFont(RLFont font); // Unload font from GPU memory (VRAM) +RLAPI bool ExportFontAsCode(RLFont font, const char *fileName); // Export font as code file, returns true on success // Text drawing functions RLAPI void DrawFPS(int posX, int posY); // Draw current FPS RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) -RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters -RLAPI void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); // Draw text using Font and pro parameters (rotation) -RLAPI void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint) -RLAPI void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); // Draw multiple character (codepoint) +RLAPI void DrawTextEx(RLFont font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters +RLAPI void DrawTextPro(RLFont font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); // Draw text using RLFont and pro parameters (rotation) +RLAPI void DrawTextCodepoint(RLFont font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint) +RLAPI void DrawTextCodepoints(RLFont font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); // Draw multiple character (codepoint) // Text font info functions RLAPI void SetTextLineSpacing(int spacing); // Set vertical line spacing when drawing with line-breaks RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font -RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font -RLAPI int GetGlyphIndex(Font font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found -RLAPI GlyphInfo GetGlyphInfo(Font font, int codepoint); // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found -RLAPI Rectangle GetGlyphAtlasRec(Font font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found +RLAPI Vector2 MeasureTextEx(RLFont font, const char *text, float fontSize, float spacing); // Measure string size for RLFont +RLAPI int GetGlyphIndex(RLFont font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found +RLAPI GlyphInfo GetGlyphInfo(RLFont font, int codepoint); // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found +RLAPI Rectangle GetGlyphAtlasRec(RLFont font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found // Text codepoints management functions (unicode characters) RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array diff --git a/src/rtext.c b/src/rtext.c index 2145ae18e..a945cb64a 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -127,7 +127,7 @@ #if defined(SUPPORT_DEFAULT_FONT) // Default font provided by raylib // NOTE: Default font is loaded on InitWindow() and disposed on CloseWindow() [module: core] -static Font defaultFont = { 0 }; +static RLFont defaultFont = { 0 }; #endif //---------------------------------------------------------------------------------- @@ -139,7 +139,7 @@ static Font defaultFont = { 0 }; // Module specific Functions Declaration //---------------------------------------------------------------------------------- #if defined(SUPPORT_FILEFORMAT_FNT) -static Font LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode font file) +static RLFont LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode font file) #endif #if defined(SUPPORT_FILEFORMAT_BDF) static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, int *codepoints, int codepointCount, int *outFontSize); @@ -167,7 +167,7 @@ extern void LoadFontDefault(void) defaultFont.glyphPadding = 0; // Characters padding // Default font is directly defined here (data generated from a sprite font image) - // This way, we reconstruct Font without creating large global variables + // This way, we reconstruct RLFont without creating large global variables // This data is automatically allocated to Stack and automatically deallocated at the end of this function unsigned int defaultFontData[512] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00200020, 0x0001b000, 0x00000000, 0x00000000, 0x8ef92520, 0x00020a00, 0x7dbe8000, 0x1f7df45f, @@ -315,18 +315,18 @@ extern void UnloadFontDefault(void) #endif // SUPPORT_DEFAULT_FONT // Get the default font, useful to be used with extended parameters -Font GetFontDefault() +RLFont GetFontDefault() { #if defined(SUPPORT_DEFAULT_FONT) return defaultFont; #else - Font font = { 0 }; + RLFont font = { 0 }; return font; #endif } -// Load Font from file into GPU memory (VRAM) -Font LoadFont(const char *fileName) +// Load RLFont from file into GPU memory (VRAM) +RLFont LoadFont(const char *fileName) { // Default values for ttf font generation #ifndef FONT_TTF_DEFAULT_SIZE @@ -342,7 +342,7 @@ Font LoadFont(const char *fileName) #define FONT_TTF_DEFAULT_CHARS_PADDING 4 // TTF font generation default chars padding #endif - Font font = { 0 }; + RLFont font = { 0 }; #if defined(SUPPORT_FILEFORMAT_TTF) if (IsFileExtension(fileName, ".ttf") || IsFileExtension(fileName, ".otf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS); @@ -376,12 +376,12 @@ Font LoadFont(const char *fileName) return font; } -// Load Font from TTF or BDF font file with generation parameters +// Load RLFont from TTF or BDF 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 *codepoints, int codepointCount) +RLFont LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount) { - Font font = { 0 }; + RLFont font = { 0 }; // Loading file to memory int dataSize = 0; @@ -400,7 +400,7 @@ Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepoi } // Load an Image font file (XNA style) -Font LoadFontFromImage(Image image, Color key, int firstChar) +RLFont LoadFontFromImage(Image image, Color key, int firstChar) { #ifndef MAX_GLYPHS_FROM_IMAGE #define MAX_GLYPHS_FROM_IMAGE 256 // Maximum number of glyphs supported on image scan @@ -408,7 +408,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar) #define COLOR_EQUAL(col1, col2) ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a)) - Font font = GetFontDefault(); + RLFont font = GetFontDefault(); int charSpacing = 0; int lineSpacing = 0; @@ -525,9 +525,9 @@ Font LoadFontFromImage(Image image, Color key, int firstChar) } // Load font from memory buffer, fileType refers to extension: i.e. ".ttf" -Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount) +RLFont LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount) { - Font font = { 0 }; + RLFont font = { 0 }; char fileExtLower[16] = { 0 }; strncpy(fileExtLower, TextToLower(fileType), 16 - 1); @@ -583,7 +583,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int } // Check if a font is ready -bool IsFontReady(Font font) +bool IsFontReady(RLFont font) { return ((font.texture.id > 0) && // Validate OpenGL id fot font texture atlas (font.baseSize > 0) && // Validate font size @@ -944,8 +944,8 @@ void UnloadFontData(GlyphInfo *glyphs, int glyphCount) } } -// Unload Font from GPU memory (VRAM) -void UnloadFont(Font font) +// Unload RLFont from GPU memory (VRAM) +void UnloadFont(RLFont font) { // NOTE: Make sure font is not default font (fallback) if (font.texture.id != GetFontDefault().texture.id) @@ -959,7 +959,7 @@ void UnloadFont(Font font) } // Export font as code file, returns true on success -bool ExportFontAsCode(Font font, const char *fileName) +bool ExportFontAsCode(RLFont font, const char *fileName) { bool success = false; @@ -980,7 +980,7 @@ bool ExportFontAsCode(Font font, const char *fileName) int byteCount = 0; byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n"); byteCount += sprintf(txtData + byteCount, "// //\n"); - byteCount += sprintf(txtData + byteCount, "// FontAsCode exporter v1.0 - Font data exported as an array of bytes //\n"); + byteCount += sprintf(txtData + byteCount, "// FontAsCode exporter v1.0 - RLFont data exported as an array of bytes //\n"); byteCount += sprintf(txtData + byteCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n"); byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n"); @@ -991,16 +991,16 @@ bool ExportFontAsCode(Font font, const char *fileName) byteCount += sprintf(txtData + byteCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// TODO: Fill the information and license of the exported font here: //\n"); byteCount += sprintf(txtData + byteCount, "// //\n"); - byteCount += sprintf(txtData + byteCount, "// Font name: .... //\n"); - byteCount += sprintf(txtData + byteCount, "// Font creator: .... //\n"); - byteCount += sprintf(txtData + byteCount, "// Font LICENSE: .... //\n"); + byteCount += sprintf(txtData + byteCount, "// RLFont name: .... //\n"); + byteCount += sprintf(txtData + byteCount, "// RLFont creator: .... //\n"); + byteCount += sprintf(txtData + byteCount, "// RLFont LICENSE: .... //\n"); byteCount += sprintf(txtData + byteCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n"); // Support font export and initialization // NOTE: This mechanism is highly coupled to raylib Image image = LoadImageFromTexture(font.texture); - if (image.format != PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) TRACELOG(LOG_WARNING, "Font export as code: Font image format is not GRAY+ALPHA!"); + if (image.format != PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) TRACELOG(LOG_WARNING, "RLFont export as code: RLFont image format is not GRAY+ALPHA!"); int imageDataSize = GetPixelDataSize(image.width, image.height, image.format); // Image data is usually GRAYSCALE + ALPHA and can be reduced to GRAYSCALE @@ -1018,7 +1018,7 @@ bool ExportFontAsCode(Font font, const char *fileName) // Save font image data (compressed) byteCount += sprintf(txtData + byteCount, "#define COMPRESSED_DATA_SIZE_FONT_%s %i\n\n", TextToUpper(fileNamePascal), compDataSize); - byteCount += sprintf(txtData + byteCount, "// Font image pixels data compressed (DEFLATE)\n"); + byteCount += sprintf(txtData + byteCount, "// RLFont image pixels data compressed (DEFLATE)\n"); byteCount += sprintf(txtData + byteCount, "// NOTE: Original pixel data simplified to GRAYSCALE\n"); byteCount += sprintf(txtData + byteCount, "static unsigned char fontData_%s[COMPRESSED_DATA_SIZE_FONT_%s] = { ", fileNamePascal, TextToUpper(fileNamePascal)); for (int i = 0; i < compDataSize - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%02x,\n " : "0x%02x, "), compData[i]); @@ -1026,7 +1026,7 @@ bool ExportFontAsCode(Font font, const char *fileName) RL_FREE(compData); #else // Save font image data (uncompressed) - byteCount += sprintf(txtData + byteCount, "// Font image pixels data\n"); + byteCount += sprintf(txtData + byteCount, "// RLFont image pixels data\n"); byteCount += sprintf(txtData + byteCount, "// NOTE: 2 bytes per pixel, GRAY + ALPHA channels\n"); byteCount += sprintf(txtData + byteCount, "static unsigned char fontImageData_%s[%i] = { ", fileNamePascal, imageDataSize); for (int i = 0; i < imageDataSize - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%02x,\n " : "0x%02x, "), ((unsigned char *)imFont.data)[i]); @@ -1034,7 +1034,7 @@ bool ExportFontAsCode(Font font, const char *fileName) #endif // Save font recs data - byteCount += sprintf(txtData + byteCount, "// Font characters rectangles data\n"); + byteCount += sprintf(txtData + byteCount, "// RLFont characters rectangles data\n"); byteCount += sprintf(txtData + byteCount, "static const Rectangle fontRecs_%s[%i] = {\n", fileNamePascal, font.glyphCount); for (int i = 0; i < font.glyphCount; i++) { @@ -1045,7 +1045,7 @@ bool ExportFontAsCode(Font font, const char *fileName) // Save font glyphs data // NOTE: Glyphs image data not saved (grayscale pixels), // it could be generated from image and recs - byteCount += sprintf(txtData + byteCount, "// Font glyphs info data\n"); + byteCount += sprintf(txtData + byteCount, "// RLFont glyphs info data\n"); byteCount += sprintf(txtData + byteCount, "// NOTE: No glyphs.image data provided\n"); byteCount += sprintf(txtData + byteCount, "static const GlyphInfo fontGlyphs_%s[%i] = {\n", fileNamePascal, font.glyphCount); for (int i = 0; i < font.glyphCount; i++) @@ -1055,9 +1055,9 @@ bool ExportFontAsCode(Font font, const char *fileName) byteCount += sprintf(txtData + byteCount, "};\n\n"); // Custom font loading function - byteCount += sprintf(txtData + byteCount, "// Font loading function: %s\n", fileNamePascal); - byteCount += sprintf(txtData + byteCount, "static Font LoadFont_%s(void)\n{\n", fileNamePascal); - byteCount += sprintf(txtData + byteCount, " Font font = { 0 };\n\n"); + byteCount += sprintf(txtData + byteCount, "// RLFont loading function: %s\n", fileNamePascal); + byteCount += sprintf(txtData + byteCount, "static RLFont LoadFont_%s(void)\n{\n", fileNamePascal); + byteCount += sprintf(txtData + byteCount, " RLFont font = { 0 };\n\n"); byteCount += sprintf(txtData + byteCount, " font.baseSize = %i;\n", font.baseSize); byteCount += sprintf(txtData + byteCount, " font.glyphCount = %i;\n", font.glyphCount); byteCount += sprintf(txtData + byteCount, " font.glyphPadding = %i;\n\n", font.glyphPadding); @@ -1077,8 +1077,8 @@ bool ExportFontAsCode(Font font, const char *fileName) #endif // We have two possible mechanisms to assign font.recs and font.glyphs data, // that data is already available as global arrays, we two options to assign that data: - // - 1. Data copy. This option consumes more memory and Font MUST be unloaded by user, requiring additional code. - // - 2. Data assignment. This option consumes less memory and Font MUST NOT be unloaded by user because data is on protected DATA segment + // - 1. Data copy. This option consumes more memory and RLFont MUST be unloaded by user, requiring additional code. + // - 2. Data assignment. This option consumes less memory and RLFont MUST NOT be unloaded by user because data is on protected DATA segment //#define SUPPORT_FONT_DATA_COPY #if defined(SUPPORT_FONT_DATA_COPY) byteCount += sprintf(txtData + byteCount, " // Copy glyph recs data from global fontRecs\n"); @@ -1106,7 +1106,7 @@ bool ExportFontAsCode(Font font, const char *fileName) RL_FREE(txtData); - if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Font as code exported successfully", fileName); + if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] RLFont as code exported successfully", fileName); else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export font as code", fileName); return success; @@ -1135,7 +1135,7 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color) { Vector2 position = { (float)posX, (float)posY }; - int defaultFontSize = 10; // Default Font chars height in pixel + int defaultFontSize = 10; // Default RLFont chars height in pixel if (fontSize < defaultFontSize) fontSize = defaultFontSize; int spacing = fontSize/defaultFontSize; @@ -1143,9 +1143,9 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color) } } -// Draw text using Font +// Draw text using RLFont // NOTE: chars spacing is NOT proportional to fontSize -void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) +void DrawTextEx(RLFont font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) { if (font.texture.id == 0) font = GetFontDefault(); // Security check in case of not valid font @@ -1186,8 +1186,8 @@ void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, f } } -// Draw text using Font and pro parameters (rotation) -void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint) +// Draw text using RLFont and pro parameters (rotation) +void DrawTextPro(RLFont font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint) { rlPushMatrix(); @@ -1201,7 +1201,7 @@ void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin, } // Draw one character (codepoint) -void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint) +void DrawTextCodepoint(RLFont font, int codepoint, Vector2 position, float fontSize, Color tint) { // Character index position in sprite font // NOTE: In case a codepoint is not available in the font, index returned points to '?' @@ -1225,7 +1225,7 @@ void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSiz } // Draw multiple character (codepoints) -void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint) +void DrawTextCodepoints(RLFont font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint) { int textOffsetY = 0; // Offset between lines (on linebreak '\n') float textOffsetX = 0.0f; // Offset X to next character to draw @@ -1269,7 +1269,7 @@ int MeasureText(const char *text, int fontSize) // Check if default font has been loaded if (GetFontDefault().texture.id != 0) { - int defaultFontSize = 10; // Default Font chars height in pixel + int defaultFontSize = 10; // Default RLFont chars height in pixel if (fontSize < defaultFontSize) fontSize = defaultFontSize; int spacing = fontSize/defaultFontSize; @@ -1279,8 +1279,8 @@ int MeasureText(const char *text, int fontSize) return (int)textSize.x; } -// Measure string size for Font -Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing) +// Measure string size for RLFont +Vector2 MeasureTextEx(RLFont font, const char *text, float fontSize, float spacing) { Vector2 textSize = { 0 }; @@ -1337,7 +1337,7 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing // Get index position for a unicode character on font // NOTE: If codepoint is not found in the font it fallbacks to '?' -int GetGlyphIndex(Font font, int codepoint) +int GetGlyphIndex(RLFont font, int codepoint) { int index = 0; @@ -1367,7 +1367,7 @@ int GetGlyphIndex(Font font, int codepoint) // Get glyph font info data for a codepoint (unicode character) // NOTE: If codepoint is not found in the font it fallbacks to '?' -GlyphInfo GetGlyphInfo(Font font, int codepoint) +GlyphInfo GetGlyphInfo(RLFont font, int codepoint) { GlyphInfo info = { 0 }; @@ -1378,7 +1378,7 @@ GlyphInfo GetGlyphInfo(Font font, int codepoint) // Get glyph rectangle in font atlas for a codepoint (unicode character) // NOTE: If codepoint is not found in the font it fallbacks to '?' -Rectangle GetGlyphAtlasRec(Font font, int codepoint) +Rectangle GetGlyphAtlasRec(RLFont font, int codepoint) { Rectangle rec = { 0 }; @@ -2098,12 +2098,12 @@ static int GetLine(const char *origin, char *buffer, int maxLength) #if defined(SUPPORT_FILEFORMAT_FNT) // Load a BMFont file (AngelCode font file) // REQUIRES: strstr(), sscanf(), strrchr(), memcpy() -static Font LoadBMFont(const char *fileName) +static RLFont LoadBMFont(const char *fileName) { #define MAX_BUFFER_SIZE 256 #define MAX_FONT_IMAGE_PAGES 8 - Font font = { 0 }; + RLFont font = { 0 }; char buffer[MAX_BUFFER_SIZE] = { 0 }; char *searchPoint = NULL; @@ -2140,7 +2140,7 @@ static Font LoadBMFont(const char *fileName) if (pageCount > MAX_FONT_IMAGE_PAGES) { - TRACELOG(LOG_WARNING, "FONT: [%s] Font defines more pages than supported: %i/%i", fileName, pageCount, MAX_FONT_IMAGE_PAGES); + TRACELOG(LOG_WARNING, "FONT: [%s] RLFont defines more pages than supported: %i/%i", fileName, pageCount, MAX_FONT_IMAGE_PAGES); pageCount = MAX_FONT_IMAGE_PAGES; } @@ -2162,7 +2162,7 @@ static Font LoadBMFont(const char *fileName) if (readVars < 1) { UnloadFileText(fileText); return font; } // No glyphCount read // Load all required images for further compose - Image *imFonts = (Image *)RL_CALLOC(pageCount, sizeof(Image)); // Font atlases, multiple images + Image *imFonts = (Image *)RL_CALLOC(pageCount, sizeof(Image)); // RLFont atlases, multiple images for (int i = 0; i < pageCount; i++) { @@ -2254,7 +2254,7 @@ static Font LoadBMFont(const char *fileName) font = GetFontDefault(); TRACELOG(LOG_WARNING, "FONT: [%s] Failed to load texture, reverted to default font", fileName); } - else TRACELOG(LOG_INFO, "FONT: [%s] Font loaded successfully (%i glyphs)", fileName, font.glyphCount); + else TRACELOG(LOG_INFO, "FONT: [%s] RLFont loaded successfully (%i glyphs)", fileName, font.glyphCount); return font; } @@ -2292,11 +2292,11 @@ static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, i bool fontMalformed = false; // Is the font malformed bool fontStarted = false; // Has font started (STARTFONT) - int fontBBw = 0; // Font base character bounding box width - int fontBBh = 0; // Font base character bounding box height - int fontBBxoff0 = 0; // Font base character bounding box X0 offset - int fontBByoff0 = 0; // Font base character bounding box Y0 offset - int fontAscent = 0; // Font ascent + int fontBBw = 0; // RLFont base character bounding box width + int fontBBh = 0; // RLFont base character bounding box height + int fontBBxoff0 = 0; // RLFont base character bounding box X0 offset + int fontBByoff0 = 0; // RLFont base character bounding box Y0 offset + int fontAscent = 0; // RLFont ascent bool charStarted = false; // Has character started (STARTCHAR) bool charBitmapStarted = false; // Has bitmap data started (BITMAP) diff --git a/src/rtextures.c b/src/rtextures.c index 97d9e3858..98ba98a2f 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -1533,7 +1533,7 @@ Image ImageText(const char *text, int fontSize, Color color) { Image imText = { 0 }; #if defined(SUPPORT_MODULE_RTEXT) - int defaultFontSize = 10; // Default Font chars height in pixel + int defaultFontSize = 10; // Default RLFont chars height in pixel if (fontSize < defaultFontSize) fontSize = defaultFontSize; int spacing = fontSize/defaultFontSize; imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color); // WARNING: Module required: rtext @@ -1546,7 +1546,7 @@ Image ImageText(const char *text, int fontSize, Color color) // Create an image from text (custom sprite font) // WARNING: Module required: rtext -Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint) +Image ImageTextEx(RLFont font, const char *text, float fontSize, float spacing, Color tint) { Image imText = { 0 }; #if defined(SUPPORT_MODULE_RTEXT) @@ -3739,7 +3739,7 @@ void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSiz } // Draw text (custom sprite font) within an image (destination) -void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) +void ImageDrawTextEx(Image *dst, RLFont font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) { Image imText = ImageTextEx(font, text, fontSize, spacing, tint);