mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Compare commits
6 Commits
223feca13a
...
6226abb0d3
| Author | SHA1 | Date | |
|---|---|---|---|
| 6226abb0d3 | |||
| 708c1539e4 | |||
| 917533224f | |||
| 0a92c863c4 | |||
| 12ce72c32d | |||
| 998a18b641 |
@ -1466,9 +1466,9 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G
|
||||
// Font loading/unloading functions
|
||||
RLAPI Font GetFontDefault(void); // Get the default Font
|
||||
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
|
||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, const 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, font size is provided in pixels height
|
||||
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, font size is provided in pixels height
|
||||
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
|
||||
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||
RLAPI bool IsFontValid(Font font); // Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
|
||||
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
|
||||
|
||||
@ -404,7 +404,7 @@ Font LoadFont(const char *fileName)
|
||||
// Load Font from TTF or BDF font file with generation parameters
|
||||
// NOTE: You can pass an array with desired characters, those characters should be available in the font
|
||||
// if array is NULL, default char set is selected 32..126
|
||||
Font LoadFontEx(const char *fileName, int fontSize, const int *codepoints, int codepointCount)
|
||||
Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount)
|
||||
{
|
||||
Font font = { 0 };
|
||||
|
||||
@ -549,7 +549,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
|
||||
}
|
||||
|
||||
// Load font from memory buffer, fileType refers to extension: i.e. ".ttf"
|
||||
Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount)
|
||||
Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount)
|
||||
{
|
||||
Font font = { 0 };
|
||||
|
||||
|
||||
@ -422,7 +422,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
|
||||
{
|
||||
Image image = { 0 };
|
||||
|
||||
// Security check for input data
|
||||
// Security checks for input data
|
||||
if ((fileData == NULL) || (dataSize == 0))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "IMAGE: Invalid file data");
|
||||
@ -650,16 +650,15 @@ bool ExportImage(Image image, const char *fileName)
|
||||
allocatedData = true;
|
||||
}
|
||||
|
||||
if (false) { } // Required to attach following 'else' cases
|
||||
#if defined(SUPPORT_FILEFORMAT_PNG)
|
||||
if (IsFileExtension(fileName, ".png"))
|
||||
else if (IsFileExtension(fileName, ".png"))
|
||||
{
|
||||
int dataSize = 0;
|
||||
unsigned char *fileData = stbi_write_png_to_mem((const unsigned char *)imgData, image.width*channels, image.width, image.height, channels, &dataSize);
|
||||
result = SaveFileData(fileName, fileData, dataSize);
|
||||
RL_FREE(fileData);
|
||||
}
|
||||
#else
|
||||
if (false) { }
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_BMP)
|
||||
else if (IsFileExtension(fileName, ".bmp")) result = stbi_write_bmp(fileName, image.width, image.height, channels, imgData);
|
||||
@ -703,7 +702,8 @@ bool ExportImage(Image image, const char *fileName)
|
||||
// NOTE: It's up to the user to track image parameters
|
||||
result = SaveFileData(fileName, image.data, GetPixelDataSize(image.width, image.height, image.format));
|
||||
}
|
||||
|
||||
else TRACELOG(LOG_WARNING, "IMAGE: Export image format requested not supported");
|
||||
|
||||
if (allocatedData) RL_FREE(imgData);
|
||||
#endif // SUPPORT_IMAGE_EXPORT
|
||||
|
||||
|
||||
@ -9041,7 +9041,7 @@
|
||||
"name": "fontSize"
|
||||
},
|
||||
{
|
||||
"type": "const int *",
|
||||
"type": "int *",
|
||||
"name": "codepoints"
|
||||
},
|
||||
{
|
||||
@ -9091,7 +9091,7 @@
|
||||
"name": "fontSize"
|
||||
},
|
||||
{
|
||||
"type": "const int *",
|
||||
"type": "int *",
|
||||
"name": "codepoints"
|
||||
},
|
||||
{
|
||||
|
||||
@ -6550,7 +6550,7 @@ return {
|
||||
params = {
|
||||
{type = "const char *", name = "fileName"},
|
||||
{type = "int", name = "fontSize"},
|
||||
{type = "const int *", name = "codepoints"},
|
||||
{type = "int *", name = "codepoints"},
|
||||
{type = "int", name = "codepointCount"}
|
||||
}
|
||||
},
|
||||
@ -6573,7 +6573,7 @@ return {
|
||||
{type = "const unsigned char *", name = "fileData"},
|
||||
{type = "int", name = "dataSize"},
|
||||
{type = "int", name = "fontSize"},
|
||||
{type = "const int *", name = "codepoints"},
|
||||
{type = "int *", name = "codepoints"},
|
||||
{type = "int", name = "codepointCount"}
|
||||
}
|
||||
},
|
||||
|
||||
@ -3468,7 +3468,7 @@ Function 395: LoadFontEx() (4 input parameters)
|
||||
Description: Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
|
||||
Param[1]: fileName (type: const char *)
|
||||
Param[2]: fontSize (type: int)
|
||||
Param[3]: codepoints (type: const int *)
|
||||
Param[3]: codepoints (type: int *)
|
||||
Param[4]: codepointCount (type: int)
|
||||
Function 396: LoadFontFromImage() (3 input parameters)
|
||||
Name: LoadFontFromImage
|
||||
@ -3485,7 +3485,7 @@ Function 397: LoadFontFromMemory() (6 input parameters)
|
||||
Param[2]: fileData (type: const unsigned char *)
|
||||
Param[3]: dataSize (type: int)
|
||||
Param[4]: fontSize (type: int)
|
||||
Param[5]: codepoints (type: const int *)
|
||||
Param[5]: codepoints (type: int *)
|
||||
Param[6]: codepointCount (type: int)
|
||||
Function 398: IsFontValid() (1 input parameters)
|
||||
Name: IsFontValid
|
||||
|
||||
@ -2286,7 +2286,7 @@
|
||||
<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 set, font size is provided in pixels height">
|
||||
<Param type="const char *" name="fileName" desc="" />
|
||||
<Param type="int" name="fontSize" desc="" />
|
||||
<Param type="const int *" name="codepoints" desc="" />
|
||||
<Param type="int *" name="codepoints" desc="" />
|
||||
<Param type="int" name="codepointCount" desc="" />
|
||||
</Function>
|
||||
<Function name="LoadFontFromImage" retType="Font" paramCount="3" desc="Load font from Image (XNA style)">
|
||||
@ -2299,7 +2299,7 @@
|
||||
<Param type="const unsigned char *" name="fileData" desc="" />
|
||||
<Param type="int" name="dataSize" desc="" />
|
||||
<Param type="int" name="fontSize" desc="" />
|
||||
<Param type="const int *" name="codepoints" desc="" />
|
||||
<Param type="int *" name="codepoints" desc="" />
|
||||
<Param type="int" name="codepointCount" desc="" />
|
||||
</Function>
|
||||
<Function name="IsFontValid" retType="bool" paramCount="1" desc="Check if a font is valid (font data loaded, WARNING: GPU texture not checked)">
|
||||
|
||||
Reference in New Issue
Block a user