If bitmap buffer is empty, do not render anything
Resolves #8272
#6846 added an error if the bitmap buffer is empty. https://github.com/python-pillow/Pillow/blob/d6cfebd016db25549d05a9c5caa2ef3b53cff5c5/src/_imagingft.c#L1028-L1032
However, this new issue found the buffer is empty for a space character in a particular font, which seems like a realistic scenario, and has been confirmed as valid by one of the FreeType maintainers - https://github.com/python-pillow/Pillow/issues/8272#issuecomment-2305870693
So if the bitmap buffer is empty, this PR just doesn't draw anything, uses the advances to update the position for the next character, and moves on.
We might want to add a test that triggers the if (stroker != NULL) branch in font_render to make sure that passing such a glyph to the stroker API is safe.
You're concerned about passing a glyph where bitmap buffer is empty to this block? test_bitmap_font_stroke actually already does this.
Note then the glyph outline in question is not empty but degenerate. It contains two points but still produces a blank space. In this particular case, it results in a 0×1 bitmap, aka one empty row. Do not check for bitmap.rows, or check both dimentions
The glyph outline may not be empty, but the bitmap buffer is. From my understanding, we're safe to skip drawing and just advance if that is the case. I presume the size of the glyph does not affect the advance.
Correct, just advance if the buffer is NULL regardless of its dimensions. You have sufficient error checking from FreeType calls.