Added warning to fontconvert when requested size is too large

This commit is contained in:
Laurence Bank
2024-11-01 08:48:06 +00:00
parent f6c1605644
commit 6df1be6fa3
+7
View File
@@ -204,6 +204,13 @@ int main(int argc, char *argv[])
// code currently doesn't check for overflow. (Doesn't
// check that size & offsets are within bounds either for
// that matter...please convert fonts responsibly.)
// Check that the requested font size fits within the limits
// of the 8-bit member variables
if (bitmap->width > 255 || (face->glyph->advance.x>>6) > 255) {
printf("The requested size is too large to fit in the BB_GLYPH member vars\nEither request a smaller size or change the member variables to be 16-bits\n");
return -1;
}
pGlyphs[index].bitmapOffset = iOffset;
pGlyphs[index].width = bitmap->width;
pGlyphs[index].height = bitmap->rows;