mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-06 06:09:17 -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
|
// Font loading/unloading functions
|
||||||
RLAPI Font GetFontDefault(void); // Get the default Font
|
RLAPI Font GetFontDefault(void); // Get the default Font
|
||||||
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
|
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 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 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 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
|
||||||
|
|||||||
@ -404,7 +404,7 @@ Font LoadFont(const char *fileName)
|
|||||||
// Load Font from TTF or BDF font file with generation parameters
|
// 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
|
// 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, const int *codepoints, int codepointCount)
|
Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount)
|
||||||
{
|
{
|
||||||
Font font = { 0 };
|
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"
|
// 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 };
|
Font font = { 0 };
|
||||||
|
|
||||||
|
|||||||
@ -422,7 +422,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
|
|||||||
{
|
{
|
||||||
Image image = { 0 };
|
Image image = { 0 };
|
||||||
|
|
||||||
// Security check for input data
|
// Security checks for input data
|
||||||
if ((fileData == NULL) || (dataSize == 0))
|
if ((fileData == NULL) || (dataSize == 0))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "IMAGE: Invalid file data");
|
TRACELOG(LOG_WARNING, "IMAGE: Invalid file data");
|
||||||
@ -650,16 +650,15 @@ bool ExportImage(Image image, const char *fileName)
|
|||||||
allocatedData = true;
|
allocatedData = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false) { } // Required to attach following 'else' cases
|
||||||
#if defined(SUPPORT_FILEFORMAT_PNG)
|
#if defined(SUPPORT_FILEFORMAT_PNG)
|
||||||
if (IsFileExtension(fileName, ".png"))
|
else if (IsFileExtension(fileName, ".png"))
|
||||||
{
|
{
|
||||||
int dataSize = 0;
|
int dataSize = 0;
|
||||||
unsigned char *fileData = stbi_write_png_to_mem((const unsigned char *)imgData, image.width*channels, image.width, image.height, channels, &dataSize);
|
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);
|
result = SaveFileData(fileName, fileData, dataSize);
|
||||||
RL_FREE(fileData);
|
RL_FREE(fileData);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (false) { }
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(SUPPORT_FILEFORMAT_BMP)
|
#if defined(SUPPORT_FILEFORMAT_BMP)
|
||||||
else if (IsFileExtension(fileName, ".bmp")) result = stbi_write_bmp(fileName, image.width, image.height, channels, imgData);
|
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
|
// NOTE: It's up to the user to track image parameters
|
||||||
result = SaveFileData(fileName, image.data, GetPixelDataSize(image.width, image.height, image.format));
|
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);
|
if (allocatedData) RL_FREE(imgData);
|
||||||
#endif // SUPPORT_IMAGE_EXPORT
|
#endif // SUPPORT_IMAGE_EXPORT
|
||||||
|
|
||||||
|
|||||||
@ -9041,7 +9041,7 @@
|
|||||||
"name": "fontSize"
|
"name": "fontSize"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "const int *",
|
"type": "int *",
|
||||||
"name": "codepoints"
|
"name": "codepoints"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -9091,7 +9091,7 @@
|
|||||||
"name": "fontSize"
|
"name": "fontSize"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "const int *",
|
"type": "int *",
|
||||||
"name": "codepoints"
|
"name": "codepoints"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6550,7 +6550,7 @@ return {
|
|||||||
params = {
|
params = {
|
||||||
{type = "const char *", name = "fileName"},
|
{type = "const char *", name = "fileName"},
|
||||||
{type = "int", name = "fontSize"},
|
{type = "int", name = "fontSize"},
|
||||||
{type = "const int *", name = "codepoints"},
|
{type = "int *", name = "codepoints"},
|
||||||
{type = "int", name = "codepointCount"}
|
{type = "int", name = "codepointCount"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -6573,7 +6573,7 @@ return {
|
|||||||
{type = "const unsigned char *", name = "fileData"},
|
{type = "const unsigned char *", name = "fileData"},
|
||||||
{type = "int", name = "dataSize"},
|
{type = "int", name = "dataSize"},
|
||||||
{type = "int", name = "fontSize"},
|
{type = "int", name = "fontSize"},
|
||||||
{type = "const int *", name = "codepoints"},
|
{type = "int *", name = "codepoints"},
|
||||||
{type = "int", name = "codepointCount"}
|
{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
|
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[1]: fileName (type: const char *)
|
||||||
Param[2]: fontSize (type: int)
|
Param[2]: fontSize (type: int)
|
||||||
Param[3]: codepoints (type: const int *)
|
Param[3]: codepoints (type: int *)
|
||||||
Param[4]: codepointCount (type: int)
|
Param[4]: codepointCount (type: int)
|
||||||
Function 396: LoadFontFromImage() (3 input parameters)
|
Function 396: LoadFontFromImage() (3 input parameters)
|
||||||
Name: LoadFontFromImage
|
Name: LoadFontFromImage
|
||||||
@ -3485,7 +3485,7 @@ Function 397: LoadFontFromMemory() (6 input parameters)
|
|||||||
Param[2]: fileData (type: const unsigned char *)
|
Param[2]: fileData (type: const unsigned char *)
|
||||||
Param[3]: dataSize (type: int)
|
Param[3]: dataSize (type: int)
|
||||||
Param[4]: fontSize (type: int)
|
Param[4]: fontSize (type: int)
|
||||||
Param[5]: codepoints (type: const int *)
|
Param[5]: codepoints (type: int *)
|
||||||
Param[6]: codepointCount (type: int)
|
Param[6]: codepointCount (type: int)
|
||||||
Function 398: IsFontValid() (1 input parameters)
|
Function 398: IsFontValid() (1 input parameters)
|
||||||
Name: IsFontValid
|
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">
|
<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="const char *" name="fileName" desc="" />
|
||||||
<Param type="int" name="fontSize" 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="" />
|
<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="Font" paramCount="3" desc="Load font from Image (XNA style)">
|
||||||
@ -2299,7 +2299,7 @@
|
|||||||
<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="" />
|
||||||
<Param type="int" name="fontSize" 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="" />
|
<Param type="int" name="codepointCount" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="IsFontValid" retType="bool" paramCount="1" desc="Check if a font is valid (font data loaded, WARNING: GPU texture not checked)">
|
<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