1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-25 20:55:52 +00:00

Merge pull request #254 from SteveMcNeill/main

Bugfix to _FONT
This commit is contained in:
Steve McNeill 2022-11-25 05:03:33 -05:00 committed by GitHub
commit 15f0f86534
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25761,7 +25761,7 @@ got_font_index:
void sub__font(int32 f, int32 i, int32 passed) {
//_FONT "?[,?]"
static int32 i2;
int32 i2 = 0; //no need for a static variable here, when we just init it to zero before ever using it.
static img_struct *im;
if (new_error)
return;
@ -25785,19 +25785,12 @@ void sub__font(int32 f, int32 i, int32 passed) {
}
im = &img[i];
// validate f
i2 = 0;
if (f == 8)
i2 = 1;
if (f == 9)
i2 = 1;
if (f == 14)
i2 = 1;
if (f == 15)
i2 = 1;
if (f == 16)
i2 = 1;
if (f == 17)
if ((f == 8) || (f == 9) || ((f > 13) && (f < 18))) // built-in fonts 8, 9, 14, 15, 16, 17 should be valid
i2 = 1;
if (((f == 9) || (f == 15) || (f == 17)) && (!im->text)) { // but 9, 15, and 17 are *ONLY* valid for text screes
error(5);
return;
}
if (f >= 32 && f <= lastfont) {
if (font[f])
i2 = 1;
@ -25807,10 +25800,10 @@ void sub__font(int32 f, int32 i, int32 passed) {
return;
}
if (im->text && ((fontflags[f] & 16) == 0)) {
error(5);
if (im->text && ((fontflags[f] & 16) == 0)) { // fontflags[f] & 16 is the bit which we set for MONOSPACE fonts. If it's a SCREEN 0 screen, and the font
error(5);// isn't monospaced, toss and error and return.
return;
} // only monospace fonts can be used on text surfaces
}
// note: font changes to text screen mode images requires:
// i) font change across all screen pages
// ii) locking of the display