Formatting changes

This commit is contained in:
Uneven Prankster 2025-01-27 07:06:46 -03:00
parent 6e2c28c671
commit 5e8a67eec0

View File

@ -2227,14 +2227,17 @@ static Font LoadBMFont(const char *fileName)
{
imFonts[i] = LoadImage(TextFormat("%s/%s", GetDirectoryPath(fileName), imFileName[i]));
PixelFormat format = imFonts[i].format;
if (format != PIXELFORMAT_UNCOMPRESSED_GRAYSCALE && format != PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 && format != PIXELFORMAT_UNCOMPRESSED_R8G8B8){
int pageFormat = imFonts[i].format;
if (pageFormat != PIXELFORMAT_UNCOMPRESSED_GRAYSCALE && pageFormat != PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 && pageFormat != PIXELFORMAT_UNCOMPRESSED_R8G8B8)
{
TRACELOG(LOG_WARNING, "FONT: [%s] Page number %i used an unsupported pixel format", fileName, i);
continue;
}
// Convert image to GRAYSCALE + ALPHA, using the mask as the alpha channel
Image imFontAlpha = {
Image imFont = {
.data = RL_CALLOC(imFonts[i].width * imFonts[i].height, 2),
.width = imFonts[i].width,
.height = imFonts[i].height,
@ -2243,9 +2246,13 @@ static Font LoadBMFont(const char *fileName)
};
int stride = 1;
if (format == PIXELFORMAT_UNCOMPRESSED_R8G8B8){
if (pageFormat == PIXELFORMAT_UNCOMPRESSED_R8G8B8)
{
stride = 3;
}else if (format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8){
}
else if (pageFormat == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)
{
stride = 4;
}