gfxPrimitivesSetFont function
Implementation
void gfxPrimitivesSetFont(List<int> fontdata, int cw, int ch) {
int i;
if (fontdata.isNotEmpty && cw != 0 && ch != 0) {
currentFontdata = fontdata;
charWidth = cw;
charHeight = ch;
} else {
currentFontdata = gfxPrimitivesFontdata;
charWidth = 8;
charHeight = 8;
}
charPitch = (charWidth + 7) ~/ 8;
charSize = charPitch * charHeight;
/* Maybe flip width/height for rendering */
if ((charRotation == 1) || (charRotation == 3)) {
charWidthLocal = charHeight;
charHeightLocal = charWidth;
} else {
charWidthLocal = charWidth;
charHeightLocal = charHeight;
}
/* Clear character cache */
for (i = 0; i < 256; i++) {
if (gfxPrimitivesFont[i] != nullptr) {
sdlDestroyTexture(gfxPrimitivesFont[i]);
gfxPrimitivesFont[i] = nullptr;
}
}
}