rename Font into RLFont

prevent conflict with Xlib.h
This commit is contained in:
SergeyMC9730 2024-03-07 22:51:20 +08:00
parent 521ceeb174
commit 19cd976000
27 changed files with 327 additions and 329 deletions

View File

@ -266,8 +266,8 @@
* - void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle() * - 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() * - void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker()
* *
* - Font GetFontDefault(void); // -- GuiLoadStyleDefault() * - RLFont GetFontDefault(void); // -- GuiLoadStyleDefault()
* - Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle() * - 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 * - 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) * - 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 * - char *LoadFileText(const char *fileName); // -- GuiLoadStyle(), required to load charset data
@ -401,7 +401,7 @@
float height; float height;
} Rectangle; } 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 // It should be redesigned to be provided by user
typedef struct Texture2D { typedef struct Texture2D {
unsigned int id; // OpenGL texture id unsigned int id; // OpenGL texture id
@ -429,16 +429,16 @@
Image image; // Character image data Image image; // Character image data
} GlyphInfo; } 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 // It should be redesigned to be provided by user
typedef struct Font { typedef struct RLFont {
int baseSize; // Base size (default chars height) int baseSize; // Base size (default chars height)
int glyphCount; // Number of glyph characters int glyphCount; // Number of glyph characters
int glyphPadding; // Padding around the glyph characters int glyphPadding; // Padding around the glyph characters
Texture2D texture; // Texture atlas containing the glyphs Texture2D texture; // Texture atlas containing the glyphs
Rectangle *recs; // Rectangles in texture for the glyphs Rectangle *recs; // Rectangles in texture for the glyphs
GlyphInfo *glyphs; // Glyphs info data GlyphInfo *glyphs; // Glyphs info data
} Font; } RLFont;
#endif #endif
@ -672,9 +672,9 @@ RAYGUIAPI void GuiSetAlpha(float alpha); // Set gui contr
RAYGUIAPI void GuiSetState(int state); // Set gui state (global state) RAYGUIAPI void GuiSetState(int state); // Set gui state (global state)
RAYGUIAPI int GuiGetState(void); // Get gui state (global state) RAYGUIAPI int GuiGetState(void); // Get gui state (global state)
// Font set/get functions // RLFont set/get functions
RAYGUIAPI void GuiSetFont(Font font); // Set gui custom font (global state) RAYGUIAPI void GuiSetFont(RLFont font); // Set gui custom font (global state)
RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state) RAYGUIAPI RLFont GuiGetFont(void); // Get gui custom font (global state)
// Style set/get functions // Style set/get functions
RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property 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 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 bool guiLocked = false; // Gui lock state (no inputs processed)
static float guiAlpha = 1.0f; // Gui controls transparency 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 // Text required functions
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static Font GetFontDefault(void); // -- GuiLoadStyleDefault() static RLFont GetFontDefault(void); // -- GuiLoadStyleDefault()
static Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle(), load font 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 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) 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; } int GuiGetState(void) { return guiState; }
// Set custom gui font // Set custom gui font
// NOTE: Font loading/unloading is external to raygui // NOTE: RLFont loading/unloading is external to raygui
void GuiSetFont(Font font) void GuiSetFont(RLFont font)
{ {
if (font.texture.id > 0) if (font.texture.id > 0)
{ {
@ -1531,7 +1531,7 @@ void GuiSetFont(Font font)
} }
// Get custom gui font // Get custom gui font
Font GuiGetFont(void) RLFont GuiGetFont(void)
{ {
return guiFont; return guiFont;
} }
@ -4003,7 +4003,7 @@ void GuiLoadStyle(const char *fileName)
char fontFileName[256] = { 0 }; char fontFileName[256] = { 0 };
sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName); sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName);
Font font = { 0 }; RLFont font = { 0 };
int *codepoints = NULL; int *codepoints = NULL;
int codepointCount = 0; int codepointCount = 0;
@ -4366,7 +4366,7 @@ static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize)
else GuiSetStyle((int)controlId, (int)propertyId, propertyValue); 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) #if !defined(RAYGUI_STANDALONE)
// Load custom font if available // Load custom font if available
@ -4376,7 +4376,7 @@ static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize)
if (fontDataSize > 0) if (fontDataSize > 0)
{ {
Font font = { 0 }; RLFont font = { 0 };
int fontType = 0; // 0-Normal, 1-SDF int fontType = 0; // 0-Normal, 1-SDF
memcpy(&font.baseSize, fileDataPtr, sizeof(int)); memcpy(&font.baseSize, fileDataPtr, sizeof(int));
@ -4420,7 +4420,7 @@ static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize)
} }
else else
{ {
// Font atlas image data is not compressed // RLFont atlas image data is not compressed
imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageUncompSize); imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageUncompSize);
memcpy(imFont.data, fileDataPtr, fontImageUncompSize); memcpy(imFont.data, fileDataPtr, fontImageUncompSize);
fileDataPtr += fontImageUncompSize; fileDataPtr += fontImageUncompSize;

View File

@ -1,6 +1,6 @@
Copyright 2020 The DotGothic16 Project Authors (https://github.com/fontworks-fonts/DotGothic16) 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: This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL http://scripts.sil.org/OFL
@ -10,7 +10,7 @@ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
----------------------------------------------------------- -----------------------------------------------------------
PREAMBLE 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 development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership 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. to any document created using the fonts or their derivatives.
DEFINITIONS 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 Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation. 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). 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). distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting, "Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the 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. new environment.
"Author" refers to any designer, engineer, programmer, technical "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 & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify, a copy of the RLFont Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font redistribute, and sell modified and unmodified copies of the RLFont
Software, subject to the following conditions: 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. 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 redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text 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. 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 Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as Copyright Holder. This restriction only applies to the primary font name as
presented to the users. 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 Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written Copyright Holder(s) and the Author(s) or with their explicit written
permission. 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 must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created remain under this license does not apply to any document created
using the Font Software. using the RLFont Software.
TERMINATION TERMINATION
This license becomes null and void if any of the above conditions are This license becomes null and void if any of the above conditions are

View File

@ -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/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/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) | | 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_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_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) | | 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) | | 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 | | 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.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) | - | | 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) | | 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) |

View File

@ -47,7 +47,7 @@ int main(void)
// Load font containing all the provided codepoint glyphs // Load font containing all the provided codepoint glyphs
// A texture font atlas is automatically generated // 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 // Set bilinear scale filter for better font scaling
SetTextureFilter(font.texture, TEXTURE_FILTER_BILINEAR); SetTextureFilter(font.texture, TEXTURE_FILTER_BILINEAR);

View File

@ -60,17 +60,17 @@ typedef struct WaveTextConfig {
// Module Functions Declaration // Module Functions Declaration
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Draw a codepoint in 3D space // 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 // 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. // 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 `~~`. // 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 // 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. // 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 // Generates a nice color with a random hue
static Color GenerateRandomColor(float s, float v); static Color GenerateRandomColor(float s, float v);
@ -104,7 +104,7 @@ int main(void)
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f }; Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
// Use the default font // Use the default font
Font font = GetFontDefault(); RLFont font = GetFontDefault();
float fontSize = 8.0f; float fontSize = 8.0f;
float fontSpacing = 0.5f; float fontSpacing = 0.5f;
float lineSpacing = -1.0f; float lineSpacing = -1.0f;
@ -451,7 +451,7 @@ int main(void)
// Module Functions Definitions // Module Functions Definitions
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Draw codepoint at specified position in 3D space // 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 // Character index position in sprite font
// NOTE: In case a codepoint is not available in the font, index returned points to '?' // 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 // 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 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. // 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 len = TextLength(text);
int tempLen = 0; // Used to count longer text line num chars 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 `~~`. // 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 // 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 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. // 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 len = TextLength(text);
int tempLen = 0; // Used to count longer text line num chars int tempLen = 0; // Used to count longer text line num chars

View File

@ -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 * 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 * 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"); 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) // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
// TTF Font loading with custom generation parameters // TTF RLFont loading with custom generation parameters
Font font = LoadFontEx("resources/KAISG.ttf", 96, 0, 0); RLFont font = LoadFontEx("resources/KAISG.ttf", 96, 0, 0);
// Generate mipmap levels to use trilinear filtering // Generate mipmap levels to use trilinear filtering
// NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR // 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); //DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED);
DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY); 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(TextFormat("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY);
DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY); DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY);
@ -128,7 +128,7 @@ int main(void)
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadFont(font); // Font unloading UnloadFont(font); // RLFont unloading
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib [text] example - Font loading * raylib [text] example - RLFont loading
* *
* NOTE: raylib can load fonts from multiple input file formats: * 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) // 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 // BMFont (AngelCode) : RLFont data and image atlas have been generated using external program
Font fontBm = LoadFont("resources/pixantiqua.fnt"); 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 // 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') SetTextLineSpacing(48); // Set line spacing for multiline text (when line breaks are included '\n')
@ -88,8 +88,8 @@ int main(void)
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadFont(fontBm); // AngelCode Font unloading UnloadFont(fontBm); // AngelCode RLFont unloading
UnloadFont(fontTtf); // TTF Font unloading UnloadFont(fontTtf); // TTF RLFont unloading
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@ -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 * 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); unsigned char *fileData = LoadFileData("resources/anonymous_pro_bold.ttf", &fileSize);
// Default font generation from TTF font // Default font generation from TTF font
Font fontDefault = { 0 }; RLFont fontDefault = { 0 };
fontDefault.baseSize = 16; fontDefault.baseSize = 16;
fontDefault.glyphCount = 95; fontDefault.glyphCount = 95;
@ -55,7 +55,7 @@ int main(void)
UnloadImage(atlas); UnloadImage(atlas);
// SDF font generation from TTF font // SDF font generation from TTF font
Font fontSDF = { 0 }; RLFont fontSDF = { 0 };
fontSDF.baseSize = 16; fontSDF.baseSize = 16;
fontSDF.glyphCount = 95; fontSDF.glyphCount = 95;
// Parameters > font size: 16, no glyphs array provided (0), glyphs count: 0 (defaults to 95) // Parameters > font size: 16, no glyphs array provided (0), glyphs count: 0 (defaults to 95)

View File

@ -40,9 +40,9 @@ int main(void)
const char msg3[50] = "...and a THIRD one! GREAT! :D"; const char msg3[50] = "...and a THIRD one! GREAT! :D";
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
Font font1 = LoadFont("resources/custom_mecha.png"); // Font loading RLFont font1 = LoadFont("resources/custom_mecha.png"); // RLFont loading
Font font2 = LoadFont("resources/custom_alagard.png"); // Font loading RLFont font2 = LoadFont("resources/custom_alagard.png"); // RLFont loading
Font font3 = LoadFont("resources/custom_jupiter_crash.png"); // Font 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, Vector2 fontPosition1 = { screenWidth/2.0f - MeasureTextEx(font1, msg1, (float)font1.baseSize, -3).x/2,
screenHeight/2.0f - font1.baseSize/2.0f - 80.0f }; screenHeight/2.0f - font1.baseSize/2.0f - 80.0f };
@ -80,9 +80,9 @@ int main(void)
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadFont(font1); // Font unloading UnloadFont(font1); // RLFont unloading
UnloadFont(font2); // Font unloading UnloadFont(font2); // RLFont unloading
UnloadFont(font3); // Font unloading UnloadFont(font3); // RLFont unloading
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@ -31,7 +31,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts"); InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) // 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[0] = LoadFont("resources/fonts/alagard.png");
fonts[1] = LoadFont("resources/fonts/pixelplay.png"); fonts[1] = LoadFont("resources/fonts/pixelplay.png");

View File

@ -15,8 +15,8 @@
#include "raylib.h" #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 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(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 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 // 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 Vector2 lastMouse = { 0.0f, 0.0f }; // Stores last mouse coordinates
Color borderColor = MAROON; // Container border color 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 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 // 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); DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE);
} }
// Draw text using font inside rectangle limits with support for text selection // 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 int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop

View File

@ -135,8 +135,8 @@ struct {
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
static void RandomizeEmoji(void); // Fills the emoji array with random emojis 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 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(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 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 // Global variables
@ -166,9 +166,9 @@ int main(void)
// Load the font resources // Load the font resources
// NOTE: fontAsian is for asian languages, // NOTE: fontAsian is for asian languages,
// fontEmoji is the emojis and fontDefault is used for everything else // fontEmoji is the emojis and fontDefault is used for everything else
Font fontDefault = LoadFont("resources/dejavu.fnt"); RLFont fontDefault = LoadFont("resources/dejavu.fnt");
Font fontAsian = LoadFont("resources/noto_cjk.fnt"); RLFont fontAsian = LoadFont("resources/noto_cjk.fnt");
Font fontEmoji = LoadFont("resources/symbola.fnt"); RLFont fontEmoji = LoadFont("resources/symbola.fnt");
Vector2 hoveredPos = { 0.0f, 0.0f }; Vector2 hoveredPos = { 0.0f, 0.0f };
Vector2 selectedPos = { 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 message = emoji[selected].message;
const int horizontalPadding = 20, verticalPadding = 30; const int horizontalPadding = 20, verticalPadding = 30;
Font *font = &fontDefault; RLFont *font = &fontDefault;
// Set correct font for asian languages // Set correct font for asian languages
if (TextIsEqual(messages[message].language, "Chinese") || if (TextIsEqual(messages[message].language, "Chinese") ||
@ -331,13 +331,13 @@ static void RandomizeEmoji(void)
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Draw text using font inside rectangle limits // 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); DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE);
} }
// Draw text using font inside rectangle limits with support for text selection // 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 int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop

View File

@ -48,7 +48,7 @@ int main(void)
UnloadImage(cat); // Unload image from RAM UnloadImage(cat); // Unload image from RAM
// Load custom font for frawing on image // 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 // Draw over image using custom font
ImageDrawTextEx(&parrots, font, "PARROTS & CAT", (Vector2){ 300, 230 }, (float)font.baseSize, -2, WHITE); ImageDrawTextEx(&parrots, font, "PARROTS & CAT", (Vector2){ 300, 230 }, (float)font.baseSize, -2, WHITE);

View File

@ -27,8 +27,8 @@ int main(void)
Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM) Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
// TTF Font loading with custom generation parameters // TTF RLFont loading with custom generation parameters
Font font = LoadFontEx("resources/KAISG.ttf", 64, 0, 0); RLFont font = LoadFontEx("resources/KAISG.ttf", 64, 0, 0);
// Draw over image using custom font // Draw over image using custom font
ImageDrawTextEx(&parrots, font, "[Parrots font drawing]", (Vector2){ 20.0f, 20.0f }, (float)font.baseSize, 0.0f, RED); ImageDrawTextEx(&parrots, font, "[Parrots font drawing]", (Vector2){ 20.0f, 20.0f }, (float)font.baseSize, 0.0f, RED);

View File

@ -690,8 +690,8 @@
] ]
}, },
{ {
"name": "Font", "name": "RLFont",
"description": "Font, font texture and GlyphInfo array data", "description": "RLFont, font texture and GlyphInfo array data",
"fields": [ "fields": [
{ {
"type": "int", "type": "int",
@ -2818,7 +2818,7 @@
}, },
{ {
"name": "FontType", "name": "FontType",
"description": "Font type, defines generation method", "description": "RLFont type, defines generation method",
"values": [ "values": [
{ {
"name": "FONT_DEFAULT", "name": "FONT_DEFAULT",
@ -7126,7 +7126,7 @@
"returnType": "Image", "returnType": "Image",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -7999,7 +7999,7 @@
"name": "dst" "name": "dst"
}, },
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -8572,13 +8572,13 @@
}, },
{ {
"name": "GetFontDefault", "name": "GetFontDefault",
"description": "Get the default Font", "description": "Get the default RLFont",
"returnType": "Font" "returnType": "RLFont"
}, },
{ {
"name": "LoadFont", "name": "LoadFont",
"description": "Load font from file into GPU memory (VRAM)", "description": "Load font from file into GPU memory (VRAM)",
"returnType": "Font", "returnType": "RLFont",
"params": [ "params": [
{ {
"type": "const char *", "type": "const char *",
@ -8589,7 +8589,7 @@
{ {
"name": "LoadFontEx", "name": "LoadFontEx",
"description": "Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont", "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": [ "params": [
{ {
"type": "const char *", "type": "const char *",
@ -8612,7 +8612,7 @@
{ {
"name": "LoadFontFromImage", "name": "LoadFontFromImage",
"description": "Load font from Image (XNA style)", "description": "Load font from Image (XNA style)",
"returnType": "Font", "returnType": "RLFont",
"params": [ "params": [
{ {
"type": "Image", "type": "Image",
@ -8631,7 +8631,7 @@
{ {
"name": "LoadFontFromMemory", "name": "LoadFontFromMemory",
"description": "Load font from memory buffer, fileType refers to extension: i.e. '.ttf'", "description": "Load font from memory buffer, fileType refers to extension: i.e. '.ttf'",
"returnType": "Font", "returnType": "RLFont",
"params": [ "params": [
{ {
"type": "const char *", "type": "const char *",
@ -8665,7 +8665,7 @@
"returnType": "bool", "returnType": "bool",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
} }
] ]
@ -8753,7 +8753,7 @@
"returnType": "void", "returnType": "void",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
} }
] ]
@ -8764,7 +8764,7 @@
"returnType": "bool", "returnType": "bool",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -8821,7 +8821,7 @@
"returnType": "void", "returnType": "void",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -8848,11 +8848,11 @@
}, },
{ {
"name": "DrawTextPro", "name": "DrawTextPro",
"description": "Draw text using Font and pro parameters (rotation)", "description": "Draw text using RLFont and pro parameters (rotation)",
"returnType": "void", "returnType": "void",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -8891,7 +8891,7 @@
"returnType": "void", "returnType": "void",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -8918,7 +8918,7 @@
"returnType": "void", "returnType": "void",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -8975,11 +8975,11 @@
}, },
{ {
"name": "MeasureTextEx", "name": "MeasureTextEx",
"description": "Measure string size for Font", "description": "Measure string size for RLFont",
"returnType": "Vector2", "returnType": "Vector2",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -9002,7 +9002,7 @@
"returnType": "int", "returnType": "int",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -9017,7 +9017,7 @@
"returnType": "GlyphInfo", "returnType": "GlyphInfo",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {
@ -9032,7 +9032,7 @@
"returnType": "Rectangle", "returnType": "Rectangle",
"params": [ "params": [
{ {
"type": "Font", "type": "RLFont",
"name": "font" "name": "font"
}, },
{ {

View File

@ -690,8 +690,8 @@ return {
} }
}, },
{ {
name = "Font", name = "RLFont",
description = "Font, font texture and GlyphInfo array data", description = "RLFont, font texture and GlyphInfo array data",
fields = { fields = {
{ {
type = "int", type = "int",
@ -2818,7 +2818,7 @@ return {
}, },
{ {
name = "FontType", name = "FontType",
description = "Font type, defines generation method", description = "RLFont type, defines generation method",
values = { values = {
{ {
name = "FONT_DEFAULT", name = "FONT_DEFAULT",
@ -5490,7 +5490,7 @@ return {
description = "Create an image from text (custom sprite font)", description = "Create an image from text (custom sprite font)",
returnType = "Image", returnType = "Image",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "const char *", name = "text"}, {type = "const char *", name = "text"},
{type = "float", name = "fontSize"}, {type = "float", name = "fontSize"},
{type = "float", name = "spacing"}, {type = "float", name = "spacing"},
@ -5955,7 +5955,7 @@ return {
returnType = "void", returnType = "void",
params = { params = {
{type = "Image *", name = "dst"}, {type = "Image *", name = "dst"},
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "const char *", name = "text"}, {type = "const char *", name = "text"},
{type = "Vector2", name = "position"}, {type = "Vector2", name = "position"},
{type = "float", name = "fontSize"}, {type = "float", name = "fontSize"},
@ -6280,13 +6280,13 @@ return {
}, },
{ {
name = "GetFontDefault", name = "GetFontDefault",
description = "Get the default Font", description = "Get the default RLFont",
returnType = "Font" returnType = "RLFont"
}, },
{ {
name = "LoadFont", name = "LoadFont",
description = "Load font from file into GPU memory (VRAM)", description = "Load font from file into GPU memory (VRAM)",
returnType = "Font", returnType = "RLFont",
params = { params = {
{type = "const char *", name = "fileName"} {type = "const char *", name = "fileName"}
} }
@ -6294,7 +6294,7 @@ return {
{ {
name = "LoadFontEx", name = "LoadFontEx",
description = "Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont", 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 = { params = {
{type = "const char *", name = "fileName"}, {type = "const char *", name = "fileName"},
{type = "int", name = "fontSize"}, {type = "int", name = "fontSize"},
@ -6305,7 +6305,7 @@ return {
{ {
name = "LoadFontFromImage", name = "LoadFontFromImage",
description = "Load font from Image (XNA style)", description = "Load font from Image (XNA style)",
returnType = "Font", returnType = "RLFont",
params = { params = {
{type = "Image", name = "image"}, {type = "Image", name = "image"},
{type = "Color", name = "key"}, {type = "Color", name = "key"},
@ -6315,7 +6315,7 @@ return {
{ {
name = "LoadFontFromMemory", name = "LoadFontFromMemory",
description = "Load font from memory buffer, fileType refers to extension: i.e. '.ttf'", description = "Load font from memory buffer, fileType refers to extension: i.e. '.ttf'",
returnType = "Font", returnType = "RLFont",
params = { params = {
{type = "const char *", name = "fileType"}, {type = "const char *", name = "fileType"},
{type = "const unsigned char *", name = "fileData"}, {type = "const unsigned char *", name = "fileData"},
@ -6330,7 +6330,7 @@ return {
description = "Check if a font is ready", description = "Check if a font is ready",
returnType = "bool", returnType = "bool",
params = { params = {
{type = "Font", name = "font"} {type = "RLFont", name = "font"}
} }
}, },
{ {
@ -6373,7 +6373,7 @@ return {
description = "Unload font from GPU memory (VRAM)", description = "Unload font from GPU memory (VRAM)",
returnType = "void", returnType = "void",
params = { params = {
{type = "Font", name = "font"} {type = "RLFont", name = "font"}
} }
}, },
{ {
@ -6381,7 +6381,7 @@ return {
description = "Export font as code file, returns true on success", description = "Export font as code file, returns true on success",
returnType = "bool", returnType = "bool",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "const char *", name = "fileName"} {type = "const char *", name = "fileName"}
} }
}, },
@ -6411,7 +6411,7 @@ return {
description = "Draw text using font and additional parameters", description = "Draw text using font and additional parameters",
returnType = "void", returnType = "void",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "const char *", name = "text"}, {type = "const char *", name = "text"},
{type = "Vector2", name = "position"}, {type = "Vector2", name = "position"},
{type = "float", name = "fontSize"}, {type = "float", name = "fontSize"},
@ -6421,10 +6421,10 @@ return {
}, },
{ {
name = "DrawTextPro", name = "DrawTextPro",
description = "Draw text using Font and pro parameters (rotation)", description = "Draw text using RLFont and pro parameters (rotation)",
returnType = "void", returnType = "void",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "const char *", name = "text"}, {type = "const char *", name = "text"},
{type = "Vector2", name = "position"}, {type = "Vector2", name = "position"},
{type = "Vector2", name = "origin"}, {type = "Vector2", name = "origin"},
@ -6439,7 +6439,7 @@ return {
description = "Draw one character (codepoint)", description = "Draw one character (codepoint)",
returnType = "void", returnType = "void",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "int", name = "codepoint"}, {type = "int", name = "codepoint"},
{type = "Vector2", name = "position"}, {type = "Vector2", name = "position"},
{type = "float", name = "fontSize"}, {type = "float", name = "fontSize"},
@ -6451,7 +6451,7 @@ return {
description = "Draw multiple character (codepoint)", description = "Draw multiple character (codepoint)",
returnType = "void", returnType = "void",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "const int *", name = "codepoints"}, {type = "const int *", name = "codepoints"},
{type = "int", name = "codepointCount"}, {type = "int", name = "codepointCount"},
{type = "Vector2", name = "position"}, {type = "Vector2", name = "position"},
@ -6479,10 +6479,10 @@ return {
}, },
{ {
name = "MeasureTextEx", name = "MeasureTextEx",
description = "Measure string size for Font", description = "Measure string size for RLFont",
returnType = "Vector2", returnType = "Vector2",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "const char *", name = "text"}, {type = "const char *", name = "text"},
{type = "float", name = "fontSize"}, {type = "float", name = "fontSize"},
{type = "float", name = "spacing"} {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", description = "Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found",
returnType = "int", returnType = "int",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "int", name = "codepoint"} {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", description = "Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found",
returnType = "GlyphInfo", returnType = "GlyphInfo",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "int", name = "codepoint"} {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", description = "Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found",
returnType = "Rectangle", returnType = "Rectangle",
params = { params = {
{type = "Font", name = "font"}, {type = "RLFont", name = "font"},
{type = "int", name = "codepoint"} {type = "int", name = "codepoint"}
} }
}, },

View File

@ -374,9 +374,9 @@ Struct 11: GlyphInfo (5 fields)
Field[3]: int offsetY // Character offset Y when drawing Field[3]: int offsetY // Character offset Y when drawing
Field[4]: int advanceX // Character advance position X Field[4]: int advanceX // Character advance position X
Field[5]: Image image // Character image data Field[5]: Image image // Character image data
Struct 12: Font (6 fields) Struct 12: RLFont (6 fields)
Name: Font Name: RLFont
Description: Font, font texture and GlyphInfo array data Description: RLFont, font texture and GlyphInfo array data
Field[1]: int baseSize // Base size (default chars height) Field[1]: int baseSize // Base size (default chars height)
Field[2]: int glyphCount // Number of glyph characters Field[2]: int glyphCount // Number of glyph characters
Field[3]: int glyphPadding // Padding around the 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 Value[CUBEMAP_LAYOUT_PANORAMA]: 5
Enum 16: FontType (3 values) Enum 16: FontType (3 values)
Name: FontType Name: FontType
Description: Font type, defines generation method Description: RLFont type, defines generation method
Value[FONT_DEFAULT]: 0 Value[FONT_DEFAULT]: 0
Value[FONT_BITMAP]: 1 Value[FONT_BITMAP]: 1
Value[FONT_SDF]: 2 Value[FONT_SDF]: 2
@ -2751,7 +2751,7 @@ Function 291: ImageTextEx() (5 input parameters)
Name: ImageTextEx Name: ImageTextEx
Return type: Image Return type: Image
Description: Create an image from text (custom sprite font) 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[2]: text (type: const char *)
Param[3]: fontSize (type: float) Param[3]: fontSize (type: float)
Param[4]: spacing (type: float) Param[4]: spacing (type: float)
@ -3075,7 +3075,7 @@ Function 338: ImageDrawTextEx() (7 input parameters)
Return type: void Return type: void
Description: Draw text (custom sprite font) within an image (destination) Description: Draw text (custom sprite font) within an image (destination)
Param[1]: dst (type: Image *) Param[1]: dst (type: Image *)
Param[2]: font (type: Font) Param[2]: font (type: RLFont)
Param[3]: text (type: const char *) Param[3]: text (type: const char *)
Param[4]: position (type: Vector2) Param[4]: position (type: Vector2)
Param[5]: fontSize (type: float) Param[5]: fontSize (type: float)
@ -3296,17 +3296,17 @@ Function 372: GetPixelDataSize() (3 input parameters)
Param[3]: format (type: int) Param[3]: format (type: int)
Function 373: GetFontDefault() (0 input parameters) Function 373: GetFontDefault() (0 input parameters)
Name: GetFontDefault Name: GetFontDefault
Return type: Font Return type: RLFont
Description: Get the default Font Description: Get the default RLFont
No input parameters No input parameters
Function 374: LoadFont() (1 input parameters) Function 374: LoadFont() (1 input parameters)
Name: LoadFont Name: LoadFont
Return type: Font Return type: RLFont
Description: Load font from file into GPU memory (VRAM) Description: Load font from file into GPU memory (VRAM)
Param[1]: fileName (type: const char *) Param[1]: fileName (type: const char *)
Function 375: LoadFontEx() (4 input parameters) Function 375: LoadFontEx() (4 input parameters)
Name: LoadFontEx 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 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[1]: fileName (type: const char *)
Param[2]: fontSize (type: int) Param[2]: fontSize (type: int)
@ -3314,14 +3314,14 @@ Function 375: LoadFontEx() (4 input parameters)
Param[4]: codepointCount (type: int) Param[4]: codepointCount (type: int)
Function 376: LoadFontFromImage() (3 input parameters) Function 376: LoadFontFromImage() (3 input parameters)
Name: LoadFontFromImage Name: LoadFontFromImage
Return type: Font Return type: RLFont
Description: Load font from Image (XNA style) Description: Load font from Image (XNA style)
Param[1]: image (type: Image) Param[1]: image (type: Image)
Param[2]: key (type: Color) Param[2]: key (type: Color)
Param[3]: firstChar (type: int) Param[3]: firstChar (type: int)
Function 377: LoadFontFromMemory() (6 input parameters) Function 377: LoadFontFromMemory() (6 input parameters)
Name: LoadFontFromMemory Name: LoadFontFromMemory
Return type: Font Return type: RLFont
Description: Load font from memory buffer, fileType refers to extension: i.e. '.ttf' Description: Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
Param[1]: fileType (type: const char *) Param[1]: fileType (type: const char *)
Param[2]: fileData (type: const unsigned char *) Param[2]: fileData (type: const unsigned char *)
@ -3333,7 +3333,7 @@ Function 378: IsFontReady() (1 input parameters)
Name: IsFontReady Name: IsFontReady
Return type: bool Return type: bool
Description: Check if a font is ready Description: Check if a font is ready
Param[1]: font (type: Font) Param[1]: font (type: RLFont)
Function 379: LoadFontData() (6 input parameters) Function 379: LoadFontData() (6 input parameters)
Name: LoadFontData Name: LoadFontData
Return type: GlyphInfo * Return type: GlyphInfo *
@ -3364,12 +3364,12 @@ Function 382: UnloadFont() (1 input parameters)
Name: UnloadFont Name: UnloadFont
Return type: void Return type: void
Description: Unload font from GPU memory (VRAM) Description: Unload font from GPU memory (VRAM)
Param[1]: font (type: Font) Param[1]: font (type: RLFont)
Function 383: ExportFontAsCode() (2 input parameters) Function 383: ExportFontAsCode() (2 input parameters)
Name: ExportFontAsCode Name: ExportFontAsCode
Return type: bool Return type: bool
Description: Export font as code file, returns true on success 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 *) Param[2]: fileName (type: const char *)
Function 384: DrawFPS() (2 input parameters) Function 384: DrawFPS() (2 input parameters)
Name: DrawFPS Name: DrawFPS
@ -3390,7 +3390,7 @@ Function 386: DrawTextEx() (6 input parameters)
Name: DrawTextEx Name: DrawTextEx
Return type: void Return type: void
Description: Draw text using font and additional parameters 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[2]: text (type: const char *)
Param[3]: position (type: Vector2) Param[3]: position (type: Vector2)
Param[4]: fontSize (type: float) Param[4]: fontSize (type: float)
@ -3399,8 +3399,8 @@ Function 386: DrawTextEx() (6 input parameters)
Function 387: DrawTextPro() (8 input parameters) Function 387: DrawTextPro() (8 input parameters)
Name: DrawTextPro Name: DrawTextPro
Return type: void Return type: void
Description: Draw text using Font and pro parameters (rotation) Description: Draw text using RLFont and pro parameters (rotation)
Param[1]: font (type: Font) Param[1]: font (type: RLFont)
Param[2]: text (type: const char *) Param[2]: text (type: const char *)
Param[3]: position (type: Vector2) Param[3]: position (type: Vector2)
Param[4]: origin (type: Vector2) Param[4]: origin (type: Vector2)
@ -3412,7 +3412,7 @@ Function 388: DrawTextCodepoint() (5 input parameters)
Name: DrawTextCodepoint Name: DrawTextCodepoint
Return type: void Return type: void
Description: Draw one character (codepoint) Description: Draw one character (codepoint)
Param[1]: font (type: Font) Param[1]: font (type: RLFont)
Param[2]: codepoint (type: int) Param[2]: codepoint (type: int)
Param[3]: position (type: Vector2) Param[3]: position (type: Vector2)
Param[4]: fontSize (type: float) Param[4]: fontSize (type: float)
@ -3421,7 +3421,7 @@ Function 389: DrawTextCodepoints() (7 input parameters)
Name: DrawTextCodepoints Name: DrawTextCodepoints
Return type: void Return type: void
Description: Draw multiple character (codepoint) Description: Draw multiple character (codepoint)
Param[1]: font (type: Font) Param[1]: font (type: RLFont)
Param[2]: codepoints (type: const int *) Param[2]: codepoints (type: const int *)
Param[3]: codepointCount (type: int) Param[3]: codepointCount (type: int)
Param[4]: position (type: Vector2) Param[4]: position (type: Vector2)
@ -3442,8 +3442,8 @@ Function 391: MeasureText() (2 input parameters)
Function 392: MeasureTextEx() (4 input parameters) Function 392: MeasureTextEx() (4 input parameters)
Name: MeasureTextEx Name: MeasureTextEx
Return type: Vector2 Return type: Vector2
Description: Measure string size for Font Description: Measure string size for RLFont
Param[1]: font (type: Font) Param[1]: font (type: RLFont)
Param[2]: text (type: const char *) Param[2]: text (type: const char *)
Param[3]: fontSize (type: float) Param[3]: fontSize (type: float)
Param[4]: spacing (type: float) Param[4]: spacing (type: float)
@ -3451,19 +3451,19 @@ Function 393: GetGlyphIndex() (2 input parameters)
Name: GetGlyphIndex Name: GetGlyphIndex
Return type: int Return type: int
Description: Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found 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) Param[2]: codepoint (type: int)
Function 394: GetGlyphInfo() (2 input parameters) Function 394: GetGlyphInfo() (2 input parameters)
Name: GetGlyphInfo Name: GetGlyphInfo
Return type: GlyphInfo Return type: GlyphInfo
Description: Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found 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) Param[2]: codepoint (type: int)
Function 395: GetGlyphAtlasRec() (2 input parameters) Function 395: GetGlyphAtlasRec() (2 input parameters)
Name: GetGlyphAtlasRec Name: GetGlyphAtlasRec
Return type: Rectangle Return type: Rectangle
Description: Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found 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) Param[2]: codepoint (type: int)
Function 396: LoadUTF8() (2 input parameters) Function 396: LoadUTF8() (2 input parameters)
Name: LoadUTF8 Name: LoadUTF8

View File

@ -138,7 +138,7 @@
<Field type="int" name="advanceX" desc="Character advance position X" /> <Field type="int" name="advanceX" desc="Character advance position X" />
<Field type="Image" name="image" desc="Character image data" /> <Field type="Image" name="image" desc="Character image data" />
</Struct> </Struct>
<Struct name="Font" fieldCount="6" desc="Font, font texture and GlyphInfo array data"> <Struct name="RLFont" fieldCount="6" desc="RLFont, font texture and GlyphInfo array data">
<Field type="int" name="baseSize" desc="Base size (default chars height)" /> <Field type="int" name="baseSize" desc="Base size (default chars height)" />
<Field type="int" name="glyphCount" desc="Number of glyph characters" /> <Field type="int" name="glyphCount" desc="Number of glyph characters" />
<Field type="int" name="glyphPadding" desc="Padding around the glyph characters" /> <Field type="int" name="glyphPadding" desc="Padding around the glyph characters" />
@ -597,7 +597,7 @@
<Value name="CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE" integer="4" desc="Layout is defined by a 4x3 cross with cubemap faces" /> <Value name="CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE" integer="4" desc="Layout is defined by a 4x3 cross with cubemap faces" />
<Value name="CUBEMAP_LAYOUT_PANORAMA" integer="5" desc="Layout is defined by a panorama image (equirrectangular map)" /> <Value name="CUBEMAP_LAYOUT_PANORAMA" integer="5" desc="Layout is defined by a panorama image (equirrectangular map)" />
</Enum> </Enum>
<Enum name="FontType" valueCount="3" desc="Font type, defines generation method"> <Enum name="FontType" valueCount="3" desc="RLFont type, defines generation method">
<Value name="FONT_DEFAULT" integer="0" desc="Default font generation, anti-aliased" /> <Value name="FONT_DEFAULT" integer="0" desc="Default font generation, anti-aliased" />
<Value name="FONT_BITMAP" integer="1" desc="Bitmap font generation, no anti-aliasing" /> <Value name="FONT_BITMAP" integer="1" desc="Bitmap font generation, no anti-aliasing" />
<Value name="FONT_SDF" integer="2" desc="SDF font generation, requires external shader" /> <Value name="FONT_SDF" integer="2" desc="SDF font generation, requires external shader" />
@ -1783,7 +1783,7 @@
<Param type="Color" name="color" desc="" /> <Param type="Color" name="color" desc="" />
</Function> </Function>
<Function name="ImageTextEx" retType="Image" paramCount="5" desc="Create an image from text (custom sprite font)"> <Function name="ImageTextEx" retType="Image" paramCount="5" desc="Create an image from text (custom sprite font)">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="const char *" name="text" desc="" /> <Param type="const char *" name="text" desc="" />
<Param type="float" name="fontSize" desc="" /> <Param type="float" name="fontSize" desc="" />
<Param type="float" name="spacing" desc="" /> <Param type="float" name="spacing" desc="" />
@ -2013,7 +2013,7 @@
</Function> </Function>
<Function name="ImageDrawTextEx" retType="void" paramCount="7" desc="Draw text (custom sprite font) within an image (destination)"> <Function name="ImageDrawTextEx" retType="void" paramCount="7" desc="Draw text (custom sprite font) within an image (destination)">
<Param type="Image *" name="dst" desc="" /> <Param type="Image *" name="dst" desc="" />
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="const char *" name="text" desc="" /> <Param type="const char *" name="text" desc="" />
<Param type="Vector2" name="position" desc="" /> <Param type="Vector2" name="position" desc="" />
<Param type="float" name="fontSize" desc="" /> <Param type="float" name="fontSize" desc="" />
@ -2165,23 +2165,23 @@
<Param type="int" name="height" desc="" /> <Param type="int" name="height" desc="" />
<Param type="int" name="format" desc="" /> <Param type="int" name="format" desc="" />
</Function> </Function>
<Function name="GetFontDefault" retType="Font" paramCount="0" desc="Get the default Font"> <Function name="GetFontDefault" retType="RLFont" paramCount="0" desc="Get the default RLFont">
</Function> </Function>
<Function name="LoadFont" retType="Font" paramCount="1" desc="Load font from file into GPU memory (VRAM)"> <Function name="LoadFont" retType="RLFont" paramCount="1" desc="Load font from file into GPU memory (VRAM)">
<Param type="const char *" name="fileName" desc="" /> <Param type="const char *" name="fileName" desc="" />
</Function> </Function>
<Function name="LoadFontEx" retType="Font" paramCount="4" desc="Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont"> <Function name="LoadFontEx" retType="RLFont" paramCount="4" desc="Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont">
<Param type="const char *" name="fileName" desc="" /> <Param type="const char *" name="fileName" desc="" />
<Param type="int" name="fontSize" desc="" /> <Param type="int" name="fontSize" desc="" />
<Param type="int *" name="codepoints" desc="" /> <Param type="int *" name="codepoints" desc="" />
<Param type="int" name="codepointCount" desc="" /> <Param type="int" name="codepointCount" desc="" />
</Function> </Function>
<Function name="LoadFontFromImage" retType="Font" paramCount="3" desc="Load font from Image (XNA style)"> <Function name="LoadFontFromImage" retType="RLFont" paramCount="3" desc="Load font from Image (XNA style)">
<Param type="Image" name="image" desc="" /> <Param type="Image" name="image" desc="" />
<Param type="Color" name="key" desc="" /> <Param type="Color" name="key" desc="" />
<Param type="int" name="firstChar" desc="" /> <Param type="int" name="firstChar" desc="" />
</Function> </Function>
<Function name="LoadFontFromMemory" retType="Font" paramCount="6" desc="Load font from memory buffer, fileType refers to extension: i.e. '.ttf'"> <Function name="LoadFontFromMemory" retType="RLFont" paramCount="6" desc="Load font from memory buffer, fileType refers to extension: i.e. '.ttf'">
<Param type="const char *" name="fileType" desc="" /> <Param type="const char *" name="fileType" desc="" />
<Param type="const unsigned char *" name="fileData" desc="" /> <Param type="const unsigned char *" name="fileData" desc="" />
<Param type="int" name="dataSize" desc="" /> <Param type="int" name="dataSize" desc="" />
@ -2190,7 +2190,7 @@
<Param type="int" name="codepointCount" desc="" /> <Param type="int" name="codepointCount" desc="" />
</Function> </Function>
<Function name="IsFontReady" retType="bool" paramCount="1" desc="Check if a font is ready"> <Function name="IsFontReady" retType="bool" paramCount="1" desc="Check if a font is ready">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
</Function> </Function>
<Function name="LoadFontData" retType="GlyphInfo *" paramCount="6" desc="Load font data for further use"> <Function name="LoadFontData" retType="GlyphInfo *" paramCount="6" desc="Load font data for further use">
<Param type="const unsigned char *" name="fileData" desc="" /> <Param type="const unsigned char *" name="fileData" desc="" />
@ -2213,10 +2213,10 @@
<Param type="int" name="glyphCount" desc="" /> <Param type="int" name="glyphCount" desc="" />
</Function> </Function>
<Function name="UnloadFont" retType="void" paramCount="1" desc="Unload font from GPU memory (VRAM)"> <Function name="UnloadFont" retType="void" paramCount="1" desc="Unload font from GPU memory (VRAM)">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
</Function> </Function>
<Function name="ExportFontAsCode" retType="bool" paramCount="2" desc="Export font as code file, returns true on success"> <Function name="ExportFontAsCode" retType="bool" paramCount="2" desc="Export font as code file, returns true on success">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="const char *" name="fileName" desc="" /> <Param type="const char *" name="fileName" desc="" />
</Function> </Function>
<Function name="DrawFPS" retType="void" paramCount="2" desc="Draw current FPS"> <Function name="DrawFPS" retType="void" paramCount="2" desc="Draw current FPS">
@ -2231,15 +2231,15 @@
<Param type="Color" name="color" desc="" /> <Param type="Color" name="color" desc="" />
</Function> </Function>
<Function name="DrawTextEx" retType="void" paramCount="6" desc="Draw text using font and additional parameters"> <Function name="DrawTextEx" retType="void" paramCount="6" desc="Draw text using font and additional parameters">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="const char *" name="text" desc="" /> <Param type="const char *" name="text" desc="" />
<Param type="Vector2" name="position" desc="" /> <Param type="Vector2" name="position" desc="" />
<Param type="float" name="fontSize" desc="" /> <Param type="float" name="fontSize" desc="" />
<Param type="float" name="spacing" desc="" /> <Param type="float" name="spacing" desc="" />
<Param type="Color" name="tint" desc="" /> <Param type="Color" name="tint" desc="" />
</Function> </Function>
<Function name="DrawTextPro" retType="void" paramCount="8" desc="Draw text using Font and pro parameters (rotation)"> <Function name="DrawTextPro" retType="void" paramCount="8" desc="Draw text using RLFont and pro parameters (rotation)">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="const char *" name="text" desc="" /> <Param type="const char *" name="text" desc="" />
<Param type="Vector2" name="position" desc="" /> <Param type="Vector2" name="position" desc="" />
<Param type="Vector2" name="origin" desc="" /> <Param type="Vector2" name="origin" desc="" />
@ -2249,14 +2249,14 @@
<Param type="Color" name="tint" desc="" /> <Param type="Color" name="tint" desc="" />
</Function> </Function>
<Function name="DrawTextCodepoint" retType="void" paramCount="5" desc="Draw one character (codepoint)"> <Function name="DrawTextCodepoint" retType="void" paramCount="5" desc="Draw one character (codepoint)">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="int" name="codepoint" desc="" /> <Param type="int" name="codepoint" desc="" />
<Param type="Vector2" name="position" desc="" /> <Param type="Vector2" name="position" desc="" />
<Param type="float" name="fontSize" desc="" /> <Param type="float" name="fontSize" desc="" />
<Param type="Color" name="tint" desc="" /> <Param type="Color" name="tint" desc="" />
</Function> </Function>
<Function name="DrawTextCodepoints" retType="void" paramCount="7" desc="Draw multiple character (codepoint)"> <Function name="DrawTextCodepoints" retType="void" paramCount="7" desc="Draw multiple character (codepoint)">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="const int *" name="codepoints" desc="" /> <Param type="const int *" name="codepoints" desc="" />
<Param type="int" name="codepointCount" desc="" /> <Param type="int" name="codepointCount" desc="" />
<Param type="Vector2" name="position" desc="" /> <Param type="Vector2" name="position" desc="" />
@ -2271,22 +2271,22 @@
<Param type="const char *" name="text" desc="" /> <Param type="const char *" name="text" desc="" />
<Param type="int" name="fontSize" desc="" /> <Param type="int" name="fontSize" desc="" />
</Function> </Function>
<Function name="MeasureTextEx" retType="Vector2" paramCount="4" desc="Measure string size for Font"> <Function name="MeasureTextEx" retType="Vector2" paramCount="4" desc="Measure string size for RLFont">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="const char *" name="text" desc="" /> <Param type="const char *" name="text" desc="" />
<Param type="float" name="fontSize" desc="" /> <Param type="float" name="fontSize" desc="" />
<Param type="float" name="spacing" desc="" /> <Param type="float" name="spacing" desc="" />
</Function> </Function>
<Function name="GetGlyphIndex" retType="int" paramCount="2" desc="Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found"> <Function name="GetGlyphIndex" retType="int" paramCount="2" desc="Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="int" name="codepoint" desc="" /> <Param type="int" name="codepoint" desc="" />
</Function> </Function>
<Function name="GetGlyphInfo" retType="GlyphInfo" paramCount="2" desc="Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found"> <Function name="GetGlyphInfo" retType="GlyphInfo" paramCount="2" desc="Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="int" name="codepoint" desc="" /> <Param type="int" name="codepoint" desc="" />
</Function> </Function>
<Function name="GetGlyphAtlasRec" retType="Rectangle" paramCount="2" desc="Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found"> <Function name="GetGlyphAtlasRec" retType="Rectangle" paramCount="2" desc="Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found">
<Param type="Font" name="font" desc="" /> <Param type="RLFont" name="font" desc="" />
<Param type="int" name="codepoint" desc="" /> <Param type="int" name="codepoint" desc="" />
</Function> </Function>
<Function name="LoadUTF8" retType="char *" paramCount="2" desc="Load UTF-8 text encoded from codepoints array"> <Function name="LoadUTF8" retType="char *" paramCount="2" desc="Load UTF-8 text encoded from codepoints array">

View File

@ -194,12 +194,12 @@ ImageMipmaps|void|(Image *image);|
ImageDither|void|(Image *image, int rBpp, int gBpp, int bBpp, int aBpp);| ImageDither|void|(Image *image, int rBpp, int gBpp, int bBpp, int aBpp);|
ImageExtractPalette|Color *|(Image image, int maxPaletteSize, int *extractCount);| ImageExtractPalette|Color *|(Image image, int maxPaletteSize, int *extractCount);|
ImageText|Image|(const char *text, int fontSize, Color color);| 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);| ImageDraw|void|(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec);|
ImageDrawRectangle|void|(Image *dst, Rectangle rec, Color color);| ImageDrawRectangle|void|(Image *dst, Rectangle rec, Color color);|
ImageDrawRectangleLines|void|(Image *dst, Rectangle rec, int thick, 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);| 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);| ImageFlipVertical|void|(Image *image);|
ImageFlipHorizontal|void|(Image *image);| ImageFlipHorizontal|void|(Image *image);|
ImageRotate|void|(Image *image, int degrees);| 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);| 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);| 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);| DrawTextureNPatch|void|(Texture2D texture, NPatchInfo nPatchInfo, Rectangle destRec, Vector2 origin, float rotation, Color tint);|
GetFontDefault|Font|(void);| GetFontDefault|RLFont|(void);|
LoadFont|Font|(const char *fileName);| LoadFont|RLFont|(const char *fileName);|
LoadFontEx|Font|(const char *fileName, int fontSize, int *fontChars, int charsCount);| LoadFontEx|RLFont|(const char *fileName, int fontSize, int *fontChars, int charsCount);|
LoadFontFromImage|Font|(Image image, Color key, int firstChar);| LoadFontFromImage|RLFont|(Image image, Color key, int firstChar);|
LoadFontData|CharInfo *|(const char *fileName, int fontSize, int *fontChars, int charsCount, int type);| 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);| 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);| DrawFPS|void|(int posX, int posY);|
DrawText|void|(const char *text, int posX, int posY, int fontSize, Color color);| 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);| DrawTextEx|void|(RLFont 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);| DrawTextRec|void|(RLFont 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);| 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);| MeasureText|int|(const char *text, int fontSize);|
MeasureTextEx|Vector2|(Font font, const char *text, float fontSize, float spacing);| MeasureTextEx|Vector2|(RLFont font, const char *text, float fontSize, float spacing);|
GetGlyphIndex|int|(Font font, int character);| GetGlyphIndex|int|(RLFont font, int character);|
TextIsEqual|bool|(const char *text1, const char *text2);| TextIsEqual|bool|(const char *text1, const char *text2);|
TextLength|unsigned int|(const char *text);| TextLength|unsigned int|(const char *text);|
TextFormat|const char *|(const char *text, ...);| TextFormat|const char *|(const char *text, ...);|
@ -406,7 +406,7 @@ Texture|struct||
RenderTexture|struct|| RenderTexture|struct||
NPatchInfo|struct|| NPatchInfo|struct||
CharInfo|struct|| CharInfo|struct||
Font|struct|| RLFont|struct||
Camera|struct|| Camera|struct||
Camera2D|struct|| Camera2D|struct||
Mesh|struct|| Mesh|struct||

View File

@ -1670,7 +1670,7 @@
</KeyWord> </KeyWord>
<KeyWord name="ImageTextEx" func="yes"> <KeyWord name="ImageTextEx" func="yes">
<Overload retVal="Image" descr="Create an image from text (custom sprite font)"> <Overload retVal="Image" descr="Create an image from text (custom sprite font)">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="const char *text" /> <Param name="const char *text" />
<Param name="float fontSize" /> <Param name="float fontSize" />
<Param name="float spacing" /> <Param name="float spacing" />
@ -1990,7 +1990,7 @@
<KeyWord name="ImageDrawTextEx" func="yes"> <KeyWord name="ImageDrawTextEx" func="yes">
<Overload retVal="void" descr="Draw text (custom sprite font) within an image (destination)"> <Overload retVal="void" descr="Draw text (custom sprite font) within an image (destination)">
<Param name="Image *dst" /> <Param name="Image *dst" />
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="const char *text" /> <Param name="const char *text" />
<Param name="Vector2 position" /> <Param name="Vector2 position" />
<Param name="float fontSize" /> <Param name="float fontSize" />
@ -2215,20 +2215,20 @@
</KeyWord> </KeyWord>
<!-------------------------------------------------------------------------------------- --> <!-------------------------------------------------------------------------------------- -->
<!-- Font Loading and Text Drawing Functions (Module: text) --> <!-- RLFont Loading and Text Drawing Functions (Module: text) -->
<!-------------------------------------------------------------------------------------- --> <!-------------------------------------------------------------------------------------- -->
<!-- Font loading/unloading functions --> <!-- RLFont loading/unloading functions -->
<KeyWord name="GetFontDefault" func="yes"> <KeyWord name="GetFontDefault" func="yes">
<Overload retVal="Font" descr="Get the default Font"></Overload> <Overload retVal="RLFont" descr="Get the default RLFont"></Overload>
</KeyWord> </KeyWord>
<KeyWord name="LoadFont" func="yes"> <KeyWord name="LoadFont" func="yes">
<Overload retVal="Font" descr="Load font from file into GPU memory (VRAM)"> <Overload retVal="RLFont" descr="Load font from file into GPU memory (VRAM)">
<Param name="const char *fileName" /> <Param name="const char *fileName" />
</Overload> </Overload>
</KeyWord> </KeyWord>
<KeyWord name="LoadFontEx" func="yes"> <KeyWord name="LoadFontEx" func="yes">
<Overload retVal="Font" descr="Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set"> <Overload retVal="RLFont" descr="Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set">
<Param name="const char *fileName" /> <Param name="const char *fileName" />
<Param name="int fontSize" /> <Param name="int fontSize" />
<Param name="int *codepoints" /> <Param name="int *codepoints" />
@ -2236,14 +2236,14 @@
</Overload> </Overload>
</KeyWord> </KeyWord>
<KeyWord name="LoadFontFromImage" func="yes"> <KeyWord name="LoadFontFromImage" func="yes">
<Overload retVal="Font" descr="Load font from Image (XNA style)"> <Overload retVal="RLFont" descr="Load font from Image (XNA style)">
<Param name="Image image" /> <Param name="Image image" />
<Param name="Color key" /> <Param name="Color key" />
<Param name="int firstChar" /> <Param name="int firstChar" />
</Overload> </Overload>
</KeyWord> </KeyWord>
<KeyWord name="LoadFontFromMemory" func="yes"> <KeyWord name="LoadFontFromMemory" func="yes">
<Overload retVal="Font" descr="Load font from memory buffer, fileType refers to extension: i.e. '.ttf'"> <Overload retVal="RLFont" descr="Load font from memory buffer, fileType refers to extension: i.e. '.ttf'">
<Param name="const char *fileType" /> <Param name="const char *fileType" />
<Param name="const unsigned char" /> <Param name="const unsigned char" />
<Param name="int dataSize" /> <Param name="int dataSize" />
@ -2254,7 +2254,7 @@
</KeyWord> </KeyWord>
<KeyWord name="IsFontReady" func="yes"> <KeyWord name="IsFontReady" func="yes">
<Overload retVal="bool" descr="Check if a font is ready"> <Overload retVal="bool" descr="Check if a font is ready">
<Param name="Font font" /> <Param name="RLFont font" />
</Overload> </Overload>
</KeyWord> </KeyWord>
<KeyWord name="LoadFontData" func="yes"> <KeyWord name="LoadFontData" func="yes">
@ -2285,12 +2285,12 @@
</KeyWord> </KeyWord>
<KeyWord name="UnloadFont" func="yes"> <KeyWord name="UnloadFont" func="yes">
<Overload retVal="void" descr="Unload font from GPU memory (VRAM)"> <Overload retVal="void" descr="Unload font from GPU memory (VRAM)">
<Param name="Font font" /> <Param name="RLFont font" />
</Overload> </Overload>
</KeyWord> </KeyWord>
<KeyWord name="ExportFontAsCode" func="yes"> <KeyWord name="ExportFontAsCode" func="yes">
<Overload retVal="bool" descr="Export font as code file, returns true on success"> <Overload retVal="bool" descr="Export font as code file, returns true on success">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="const char *fileName" /> <Param name="const char *fileName" />
</Overload> </Overload>
</KeyWord> </KeyWord>
@ -2313,7 +2313,7 @@
</KeyWord> </KeyWord>
<KeyWord name="DrawTextEx" func="yes"> <KeyWord name="DrawTextEx" func="yes">
<Overload retVal="void" descr="Draw text using font and additional parameters"> <Overload retVal="void" descr="Draw text using font and additional parameters">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="const char *text" /> <Param name="const char *text" />
<Param name="Vector2 position" /> <Param name="Vector2 position" />
<Param name="float fontSize" /> <Param name="float fontSize" />
@ -2322,8 +2322,8 @@
</Overload> </Overload>
</KeyWord> </KeyWord>
<KeyWord name="DrawTextPro" func="yes"> <KeyWord name="DrawTextPro" func="yes">
<Overload retVal="void" descr="Draw text using Font and pro parameters (rotation)"> <Overload retVal="void" descr="Draw text using RLFont and pro parameters (rotation)">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="const char *text" /> <Param name="const char *text" />
<Param name="Vector2 position" /> <Param name="Vector2 position" />
<Param name="Vector2 origin" /> <Param name="Vector2 origin" />
@ -2335,7 +2335,7 @@
</KeyWord> </KeyWord>
<KeyWord name="DrawTextCodepoint" func="yes"> <KeyWord name="DrawTextCodepoint" func="yes">
<Overload retVal="void" descr="Draw one character (codepoint)"> <Overload retVal="void" descr="Draw one character (codepoint)">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="int codepoint" /> <Param name="int codepoint" />
<Param name="Vector2 position" /> <Param name="Vector2 position" />
<Param name="float fontSize" /> <Param name="float fontSize" />
@ -2344,7 +2344,7 @@
</KeyWord> </KeyWord>
<KeyWord name="DrawTextCodepoints" func="yes"> <KeyWord name="DrawTextCodepoints" func="yes">
<Overload retVal="void" descr="Draw multiple character (codepoint)"> <Overload retVal="void" descr="Draw multiple character (codepoint)">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="const int *codepoints" /> <Param name="const int *codepoints" />
<Param name="int codepointCount" /> <Param name="int codepointCount" />
<Param name="Vector2 position" /> <Param name="Vector2 position" />
@ -2367,8 +2367,8 @@
</Overload> </Overload>
</KeyWord> </KeyWord>
<KeyWord name="MeasureTextEx" func="yes"> <KeyWord name="MeasureTextEx" func="yes">
<Overload retVal="Vector2" descr="Measure string size for Font"> <Overload retVal="Vector2" descr="Measure string size for RLFont">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="const char *text" /> <Param name="const char *text" />
<Param name="float fontSize" /> <Param name="float fontSize" />
<Param name="float spacing" /> <Param name="float spacing" />
@ -2376,19 +2376,19 @@
</KeyWord> </KeyWord>
<KeyWord name="GetGlyphIndex" func="yes"> <KeyWord name="GetGlyphIndex" func="yes">
<Overload retVal="int" descr="Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found"> <Overload retVal="int" descr="Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="int codepoint" /> <Param name="int codepoint" />
</Overload> </Overload>
</KeyWord> </KeyWord>
<KeyWord name="GetGlyphInfo" func="yes"> <KeyWord name="GetGlyphInfo" func="yes">
<Overload retVal="GlyphInfo" descr="Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found"> <Overload retVal="GlyphInfo" descr="Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="int codepoint" /> <Param name="int codepoint" />
</Overload> </Overload>
</KeyWord> </KeyWord>
<KeyWord name="GetGlyphAtlasRec" func="yes"> <KeyWord name="GetGlyphAtlasRec" func="yes">
<Overload retVal="Rectangle" descr="Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found"> <Overload retVal="Rectangle" descr="Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found">
<Param name="Font font" /> <Param name="RLFont font" />
<Param name="int codepoint" /> <Param name="int codepoint" />
</Overload> </Overload>
</KeyWord> </KeyWord>
@ -2822,7 +2822,7 @@
<Param name="Vector2 size" /> <Param name="Vector2 size" />
<Param name="Vector2 origin" /> <Param name="Vector2 origin" />
<Param name="float rotation" /> <Param name="float rotation" />
<Param name="0ó¿8± " /> <Param name="0<EFBFBD>8<EFBFBD> " />
</Overload> </Overload>
</KeyWord> </KeyWord>
@ -3452,5 +3452,3 @@
<Param name="AudioCallback processor" /> <Param name="AudioCallback processor" />
</Overload> </Overload>
</KeyWord> </KeyWord>

View File

@ -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 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 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 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 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 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 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 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 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 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 // Texture loading functions
// NOTE: These functions require GPU access // 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 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 // RLFont loading/unloading functions
RLAPI Font GetFontDefault(void); // Get the default Font RLAPI RLFont GetFontDefault(void); // Get the default RLFont
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM) RLAPI RLFont 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 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 Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) RLAPI RLFont 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 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(Font font); // Check if a font is ready 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 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 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 UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM)
RLAPI void UnloadFont(Font font); // Unload font from GPU memory (VRAM) RLAPI void UnloadFont(RLFont 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 bool ExportFontAsCode(RLFont font, const char *fileName); // Export font as code file, returns true on success
// Text drawing functions // Text drawing functions
RLAPI void DrawFPS(int posX, int posY); // Draw current FPS 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 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 DrawTextEx(RLFont 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 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(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint) RLAPI void DrawTextCodepoint(RLFont 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 DrawTextCodepoints(RLFont font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); // Draw multiple character (codepoint)
// Text font info functions // Text font info functions
RLAPI void SetTextLineSpacing(int spacing); // Set vertical line spacing when drawing with line-breaks 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 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 Vector2 MeasureTextEx(RLFont font, const char *text, float fontSize, float spacing); // Measure string size for RLFont
RLAPI int GetGlyphIndex(Font font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found 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(Font font, int codepoint); // Get glyph font info data 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(Font font, int codepoint); // Get glyph rectangle in font atlas 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) // Text codepoints management functions (unicode characters)
RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array

View File

@ -400,7 +400,7 @@ endif
ifeq ($(PLATFORM),PLATFORM_DRM) ifeq ($(PLATFORM),PLATFORM_DRM)
# without EGL_NO_X11 eglplatform.h tears Xlib.h in which tears X.h in # 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 += -DEGL_NO_X11
CFLAGS += -Werror=implicit-function-declaration CFLAGS += -Werror=implicit-function-declaration
endif endif

View File

@ -168,11 +168,11 @@
// which is the origin of each character. The current point's vertical // which is the origin of each character. The current point's vertical
// position is the baseline. Even "baked fonts" use this model. // 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 // The vertical qualities of the font, used to vertically position
// and space the characters. See docs for stbtt_GetFontVMetrics. // 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 // The preferred interface for specifying font sizes in stb_truetype
// is to specify how tall the font's vertical extent should be in pixels. // is to specify how tall the font's vertical extent should be in pixels.
// If that sounds good enough, skip the next paragraph. // If that sounds good enough, skip the next paragraph.

View File

@ -72,7 +72,7 @@
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX #include <sys/time.h> // 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_WAYLAND
//#define GLFW_EXPOSE_NATIVE_MIR //#define GLFW_EXPOSE_NATIVE_MIR
#include "GLFW/glfw3native.h" // Required for: glfwGetX11Window() #include "GLFW/glfw3native.h" // Required for: glfwGetX11Window()

View File

@ -21,7 +21,7 @@
* - Bindings to multiple programming languages available! * - Bindings to multiple programming languages available!
* *
* NOTES: * 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 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 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) * - 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 Image image; // Character image data
} GlyphInfo; } GlyphInfo;
// Font, font texture and GlyphInfo array data // RLFont, font texture and GlyphInfo array data
typedef struct Font { typedef struct RLFont {
int baseSize; // Base size (default chars height) int baseSize; // Base size (default chars height)
int glyphCount; // Number of glyph characters int glyphCount; // Number of glyph characters
int glyphPadding; // Padding around the glyph characters int glyphPadding; // Padding around the glyph characters
Texture2D texture; // Texture atlas containing the glyphs Texture2D texture; // Texture atlas containing the glyphs
Rectangle *recs; // Rectangles in texture for the glyphs Rectangle *recs; // Rectangles in texture for the glyphs
GlyphInfo *glyphs; // Glyphs info data GlyphInfo *glyphs; // Glyphs info data
} Font; } RLFont;
// Camera, defines position/orientation in 3d space // Camera, defines position/orientation in 3d space
typedef struct Camera3D { typedef struct Camera3D {
@ -876,7 +876,7 @@ typedef enum {
CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirrectangular map) CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirrectangular map)
} CubemapLayout; } CubemapLayout;
// Font type, defines generation method // RLFont type, defines generation method
typedef enum { typedef enum {
FONT_DEFAULT = 0, // Default font generation, anti-aliased FONT_DEFAULT = 0, // Default font generation, anti-aliased
FONT_BITMAP, // Bitmap font generation, no anti-aliasing 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 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 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 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 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 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 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 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 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 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 // Texture loading functions
// NOTE: These functions require GPU access // 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 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 // RLFont loading/unloading functions
RLAPI Font GetFontDefault(void); // Get the default Font RLAPI RLFont GetFontDefault(void); // Get the default RLFont
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM) RLAPI RLFont 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 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 Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) RLAPI RLFont 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 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(Font font); // Check if a font is ready 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 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 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 UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM)
RLAPI void UnloadFont(Font font); // Unload font from GPU memory (VRAM) RLAPI void UnloadFont(RLFont 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 bool ExportFontAsCode(RLFont font, const char *fileName); // Export font as code file, returns true on success
// Text drawing functions // Text drawing functions
RLAPI void DrawFPS(int posX, int posY); // Draw current FPS 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 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 DrawTextEx(RLFont 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 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(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint) RLAPI void DrawTextCodepoint(RLFont 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 DrawTextCodepoints(RLFont font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); // Draw multiple character (codepoint)
// Text font info functions // Text font info functions
RLAPI void SetTextLineSpacing(int spacing); // Set vertical line spacing when drawing with line-breaks 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 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 Vector2 MeasureTextEx(RLFont font, const char *text, float fontSize, float spacing); // Measure string size for RLFont
RLAPI int GetGlyphIndex(Font font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found 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(Font font, int codepoint); // Get glyph font info data 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(Font font, int codepoint); // Get glyph rectangle in font atlas 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) // Text codepoints management functions (unicode characters)
RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array

View File

@ -127,7 +127,7 @@
#if defined(SUPPORT_DEFAULT_FONT) #if defined(SUPPORT_DEFAULT_FONT)
// Default font provided by raylib // Default font provided by raylib
// NOTE: Default font is loaded on InitWindow() and disposed on CloseWindow() [module: core] // NOTE: Default font is loaded on InitWindow() and disposed on CloseWindow() [module: core]
static Font defaultFont = { 0 }; static RLFont defaultFont = { 0 };
#endif #endif
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -139,7 +139,7 @@ static Font defaultFont = { 0 };
// Module specific Functions Declaration // Module specific Functions Declaration
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(SUPPORT_FILEFORMAT_FNT) #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 #endif
#if defined(SUPPORT_FILEFORMAT_BDF) #if defined(SUPPORT_FILEFORMAT_BDF)
static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, int *codepoints, int codepointCount, int *outFontSize); 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 defaultFont.glyphPadding = 0; // Characters padding
// Default font is directly defined here (data generated from a sprite font image) // 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 // This data is automatically allocated to Stack and automatically deallocated at the end of this function
unsigned int defaultFontData[512] = { unsigned int defaultFontData[512] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00200020, 0x0001b000, 0x00000000, 0x00000000, 0x8ef92520, 0x00020a00, 0x7dbe8000, 0x1f7df45f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00200020, 0x0001b000, 0x00000000, 0x00000000, 0x8ef92520, 0x00020a00, 0x7dbe8000, 0x1f7df45f,
@ -315,18 +315,18 @@ extern void UnloadFontDefault(void)
#endif // SUPPORT_DEFAULT_FONT #endif // SUPPORT_DEFAULT_FONT
// Get the default font, useful to be used with extended parameters // Get the default font, useful to be used with extended parameters
Font GetFontDefault() RLFont GetFontDefault()
{ {
#if defined(SUPPORT_DEFAULT_FONT) #if defined(SUPPORT_DEFAULT_FONT)
return defaultFont; return defaultFont;
#else #else
Font font = { 0 }; RLFont font = { 0 };
return font; return font;
#endif #endif
} }
// Load Font from file into GPU memory (VRAM) // Load RLFont from file into GPU memory (VRAM)
Font LoadFont(const char *fileName) RLFont LoadFont(const char *fileName)
{ {
// Default values for ttf font generation // Default values for ttf font generation
#ifndef FONT_TTF_DEFAULT_SIZE #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 #define FONT_TTF_DEFAULT_CHARS_PADDING 4 // TTF font generation default chars padding
#endif #endif
Font font = { 0 }; RLFont font = { 0 };
#if defined(SUPPORT_FILEFORMAT_TTF) #if defined(SUPPORT_FILEFORMAT_TTF)
if (IsFileExtension(fileName, ".ttf") || IsFileExtension(fileName, ".otf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS); 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; 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 // 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 // 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 // Loading file to memory
int dataSize = 0; 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) // 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 #ifndef MAX_GLYPHS_FROM_IMAGE
#define MAX_GLYPHS_FROM_IMAGE 256 // Maximum number of glyphs supported on image scan #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)) #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 charSpacing = 0;
int lineSpacing = 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" // 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 }; char fileExtLower[16] = { 0 };
strncpy(fileExtLower, TextToLower(fileType), 16 - 1); 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 // 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 return ((font.texture.id > 0) && // Validate OpenGL id fot font texture atlas
(font.baseSize > 0) && // Validate font size (font.baseSize > 0) && // Validate font size
@ -944,8 +944,8 @@ void UnloadFontData(GlyphInfo *glyphs, int glyphCount)
} }
} }
// Unload Font from GPU memory (VRAM) // Unload RLFont from GPU memory (VRAM)
void UnloadFont(Font font) void UnloadFont(RLFont font)
{ {
// NOTE: Make sure font is not default font (fallback) // NOTE: Make sure font is not default font (fallback)
if (font.texture.id != GetFontDefault().texture.id) if (font.texture.id != GetFontDefault().texture.id)
@ -959,7 +959,7 @@ void UnloadFont(Font font)
} }
// Export font as code file, returns true on success // 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; bool success = false;
@ -980,7 +980,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
int byteCount = 0; int byteCount = 0;
byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n"); byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n");
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, "// //\n");
byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\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"); 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, "// //\n");
byteCount += sprintf(txtData + byteCount, "// TODO: Fill the information and license of the exported font here: //\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, "// //\n");
byteCount += sprintf(txtData + byteCount, "// Font name: .... //\n"); byteCount += sprintf(txtData + byteCount, "// RLFont name: .... //\n");
byteCount += sprintf(txtData + byteCount, "// Font creator: .... //\n"); byteCount += sprintf(txtData + byteCount, "// RLFont creator: .... //\n");
byteCount += sprintf(txtData + byteCount, "// Font LICENSE: .... //\n"); byteCount += sprintf(txtData + byteCount, "// RLFont LICENSE: .... //\n");
byteCount += sprintf(txtData + byteCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// //\n");
byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n"); byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n");
// Support font export and initialization // Support font export and initialization
// NOTE: This mechanism is highly coupled to raylib // NOTE: This mechanism is highly coupled to raylib
Image image = LoadImageFromTexture(font.texture); 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); int imageDataSize = GetPixelDataSize(image.width, image.height, image.format);
// Image data is usually GRAYSCALE + ALPHA and can be reduced to GRAYSCALE // 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) // 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, "#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, "// 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)); 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]); 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); RL_FREE(compData);
#else #else
// Save font image data (uncompressed) // 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, "// NOTE: 2 bytes per pixel, GRAY + ALPHA channels\n");
byteCount += sprintf(txtData + byteCount, "static unsigned char fontImageData_%s[%i] = { ", fileNamePascal, imageDataSize); 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]); 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 #endif
// Save font recs data // 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); byteCount += sprintf(txtData + byteCount, "static const Rectangle fontRecs_%s[%i] = {\n", fileNamePascal, font.glyphCount);
for (int i = 0; i < font.glyphCount; i++) for (int i = 0; i < font.glyphCount; i++)
{ {
@ -1045,7 +1045,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
// Save font glyphs data // Save font glyphs data
// NOTE: Glyphs image data not saved (grayscale pixels), // NOTE: Glyphs image data not saved (grayscale pixels),
// it could be generated from image and recs // 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, "// NOTE: No glyphs.image data provided\n");
byteCount += sprintf(txtData + byteCount, "static const GlyphInfo fontGlyphs_%s[%i] = {\n", fileNamePascal, font.glyphCount); byteCount += sprintf(txtData + byteCount, "static const GlyphInfo fontGlyphs_%s[%i] = {\n", fileNamePascal, font.glyphCount);
for (int i = 0; i < font.glyphCount; i++) 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"); byteCount += sprintf(txtData + byteCount, "};\n\n");
// Custom font loading function // Custom font loading function
byteCount += sprintf(txtData + byteCount, "// Font loading function: %s\n", fileNamePascal); byteCount += sprintf(txtData + byteCount, "// RLFont loading function: %s\n", fileNamePascal);
byteCount += sprintf(txtData + byteCount, "static Font LoadFont_%s(void)\n{\n", fileNamePascal); byteCount += sprintf(txtData + byteCount, "static RLFont LoadFont_%s(void)\n{\n", fileNamePascal);
byteCount += sprintf(txtData + byteCount, " Font font = { 0 };\n\n"); byteCount += sprintf(txtData + byteCount, " RLFont font = { 0 };\n\n");
byteCount += sprintf(txtData + byteCount, " font.baseSize = %i;\n", font.baseSize); 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.glyphCount = %i;\n", font.glyphCount);
byteCount += sprintf(txtData + byteCount, " font.glyphPadding = %i;\n\n", font.glyphPadding); byteCount += sprintf(txtData + byteCount, " font.glyphPadding = %i;\n\n", font.glyphPadding);
@ -1077,8 +1077,8 @@ bool ExportFontAsCode(Font font, const char *fileName)
#endif #endif
// We have two possible mechanisms to assign font.recs and font.glyphs data, // 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: // 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. // - 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 Font MUST NOT be unloaded by user because data is on protected DATA segment // - 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 //#define SUPPORT_FONT_DATA_COPY
#if defined(SUPPORT_FONT_DATA_COPY) #if defined(SUPPORT_FONT_DATA_COPY)
byteCount += sprintf(txtData + byteCount, " // Copy glyph recs data from global fontRecs\n"); 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); 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); else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export font as code", fileName);
return success; 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 }; 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; if (fontSize < defaultFontSize) fontSize = defaultFontSize;
int spacing = 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 // 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 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) // Draw text using RLFont and pro parameters (rotation)
void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint) void DrawTextPro(RLFont font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint)
{ {
rlPushMatrix(); rlPushMatrix();
@ -1201,7 +1201,7 @@ void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin,
} }
// Draw one character (codepoint) // 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 // Character index position in sprite font
// NOTE: In case a codepoint is not available in the font, index returned points to '?' // 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) // 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') int textOffsetY = 0; // Offset between lines (on linebreak '\n')
float textOffsetX = 0.0f; // Offset X to next character to draw 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 // Check if default font has been loaded
if (GetFontDefault().texture.id != 0) 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; if (fontSize < defaultFontSize) fontSize = defaultFontSize;
int spacing = fontSize/defaultFontSize; int spacing = fontSize/defaultFontSize;
@ -1279,8 +1279,8 @@ int MeasureText(const char *text, int fontSize)
return (int)textSize.x; return (int)textSize.x;
} }
// Measure string size for Font // Measure string size for RLFont
Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing) Vector2 MeasureTextEx(RLFont font, const char *text, float fontSize, float spacing)
{ {
Vector2 textSize = { 0 }; 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 // Get index position for a unicode character on font
// NOTE: If codepoint is not found in the font it fallbacks to '?' // 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; int index = 0;
@ -1367,7 +1367,7 @@ int GetGlyphIndex(Font font, int codepoint)
// Get glyph font info data for a codepoint (unicode character) // Get glyph font info data for a codepoint (unicode character)
// NOTE: If codepoint is not found in the font it fallbacks to '?' // 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 }; GlyphInfo info = { 0 };
@ -1378,7 +1378,7 @@ GlyphInfo GetGlyphInfo(Font font, int codepoint)
// Get glyph rectangle in font atlas for a codepoint (unicode character) // Get glyph rectangle in font atlas for a codepoint (unicode character)
// NOTE: If codepoint is not found in the font it fallbacks to '?' // 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 }; Rectangle rec = { 0 };
@ -2098,12 +2098,12 @@ static int GetLine(const char *origin, char *buffer, int maxLength)
#if defined(SUPPORT_FILEFORMAT_FNT) #if defined(SUPPORT_FILEFORMAT_FNT)
// Load a BMFont file (AngelCode font file) // Load a BMFont file (AngelCode font file)
// REQUIRES: strstr(), sscanf(), strrchr(), memcpy() // REQUIRES: strstr(), sscanf(), strrchr(), memcpy()
static Font LoadBMFont(const char *fileName) static RLFont LoadBMFont(const char *fileName)
{ {
#define MAX_BUFFER_SIZE 256 #define MAX_BUFFER_SIZE 256
#define MAX_FONT_IMAGE_PAGES 8 #define MAX_FONT_IMAGE_PAGES 8
Font font = { 0 }; RLFont font = { 0 };
char buffer[MAX_BUFFER_SIZE] = { 0 }; char buffer[MAX_BUFFER_SIZE] = { 0 };
char *searchPoint = NULL; char *searchPoint = NULL;
@ -2140,7 +2140,7 @@ static Font LoadBMFont(const char *fileName)
if (pageCount > MAX_FONT_IMAGE_PAGES) 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; 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 if (readVars < 1) { UnloadFileText(fileText); return font; } // No glyphCount read
// Load all required images for further compose // 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++) for (int i = 0; i < pageCount; i++)
{ {
@ -2254,7 +2254,7 @@ static Font LoadBMFont(const char *fileName)
font = GetFontDefault(); font = GetFontDefault();
TRACELOG(LOG_WARNING, "FONT: [%s] Failed to load texture, reverted to default font", fileName); 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; return font;
} }
@ -2292,11 +2292,11 @@ static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, i
bool fontMalformed = false; // Is the font malformed bool fontMalformed = false; // Is the font malformed
bool fontStarted = false; // Has font started (STARTFONT) bool fontStarted = false; // Has font started (STARTFONT)
int fontBBw = 0; // Font base character bounding box width int fontBBw = 0; // RLFont base character bounding box width
int fontBBh = 0; // Font base character bounding box height int fontBBh = 0; // RLFont base character bounding box height
int fontBBxoff0 = 0; // Font base character bounding box X0 offset int fontBBxoff0 = 0; // RLFont base character bounding box X0 offset
int fontBByoff0 = 0; // Font base character bounding box Y0 offset int fontBByoff0 = 0; // RLFont base character bounding box Y0 offset
int fontAscent = 0; // Font ascent int fontAscent = 0; // RLFont ascent
bool charStarted = false; // Has character started (STARTCHAR) bool charStarted = false; // Has character started (STARTCHAR)
bool charBitmapStarted = false; // Has bitmap data started (BITMAP) bool charBitmapStarted = false; // Has bitmap data started (BITMAP)

View File

@ -1533,7 +1533,7 @@ Image ImageText(const char *text, int fontSize, Color color)
{ {
Image imText = { 0 }; Image imText = { 0 };
#if defined(SUPPORT_MODULE_RTEXT) #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; if (fontSize < defaultFontSize) fontSize = defaultFontSize;
int spacing = fontSize/defaultFontSize; int spacing = fontSize/defaultFontSize;
imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color); // WARNING: Module required: rtext 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) // Create an image from text (custom sprite font)
// WARNING: Module required: rtext // 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 }; Image imText = { 0 };
#if defined(SUPPORT_MODULE_RTEXT) #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) // 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); Image imText = ImageTextEx(font, text, fontSize, spacing, tint);