Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Screen fonts in SCREEN 0
#1
In the MS-DOS days of Norton Utilities, PC-Tools, etc., you would see programs redrawing their ASCII characters to get different boxes and characters.
We can easily create font files via the VGA Font Editor (see https://github.com/a740g/VGA-Font-Editor).
But how do we get this on the screen via SCREEN 0? No not SCREEN 13 or so.
I used to write an assembler program for that, but I've lost it, years ago....
Reply
#2
Easiest way is to just find a modern, monospaced font, you like.  Load it with _LoadFont.  Set it with _Font.   Done.
Reply
#3
(05-07-2024, 02:57 PM)BDS107 Wrote: In the MS-DOS days of Norton Utilities, PC-Tools, etc., you would see programs redrawing their ASCII characters to get different boxes and characters.
We can easily create font files via the VGA Font Editor (see https://github.com/a740g/VGA-Font-Editor).
But how do we get this on the screen via SCREEN 0? No not SCREEN 13 or so.
I used to write an assembler program for that, but I've lost it, years ago....
Yeah, that was cool how Norton and others did this. This was done by creating a new ASCII set in RAM and then hooking the BIOS call to that new section of RAM instead of grabbing the character from ROM. That is why the assembler program was needed, it would perform the redirection. This is not going to be possible with QB64 (as far as I know, the developers here are rather clever).

You'll need to create your own font file (.ttf) and then use the method Steve pointed out above.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#4
ha what a coincidence i've been working on screen 0 font editor all morning and afternoon.

i modified the Shmup game with few special characters i edited cannon and 2 sides of landing gear

attached is game, still working on naming system for editor
   

you need charset.h in same folder as qb64
Code: (Select All)
extern uint8 charset8x8[256][8][8];
extern uint8 charset8x16[256][16][8];

void Charset_8x16 (ptrszint offset){
memcpy(charset8x16,(void*)offset,sizeof(charset8x16));
}

void Charset_8x8 (ptrszint offset){
memcpy(charset8x8,(void*)offset,sizeof(charset8x8));
}


Attached Files
.zip   SHMUP special font.zip (Size: 4.16 KB / Downloads: 17)
b = b + ...
Reply
#5
(05-07-2024, 08:29 PM)bplus Wrote: ha what a coincidence i've been working on screen 0 font editor all morning and afternoon.

i modified the Shmup game with few special characters i edited cannon and 2 sides of landing gear

attached is game, still working on naming system for editor


you need charset.h in same folder as qb64
Code: (Select All)
extern uint8 charset8x8[256][8][8];
extern uint8 charset8x16[256][16][8];

void Charset_8x16 (ptrszint offset){
memcpy(charset8x16,(void*)offset,sizeof(charset8x16));
}

void Charset_8x8 (ptrszint offset){
memcpy(charset8x8,(void*)offset,sizeof(charset8x8));
}
I would not recommend this at all. This stuff is not portable and assumes the existence of some QB64 undocumented internals which can change in the future.

I would rather suggest doing what @SMcNeill said or if you are willing to wait, then we may have a way of loading PSF fonts (soonish).
Reply
#6
(05-07-2024, 10:58 PM)a740g Wrote: I would rather suggest doing what @SMcNeill said or if you are willing to wait, then we may have a way of loading PSF fonts (soonish).
I thought PSF fonts were Linux only. Am I incorrect in assuming this?
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#7
Quote:I would not recommend this at all. This stuff is not portable and assumes the existence of some QB64 undocumented internals which can change in the future.

I would rather suggest doing what @SMcNeill said or if you are willing to wait, then we may have a way of loading PSF fonts (soonish).

ok getting strange results when trying to
put #, ansinum * 16 + 1, char16$ ' for new character edit
all the new dots show up but all the erased ones remain when reload whole file.
BUT when i close program and reopen and run again the characters show correctly with erased dots and added dots for character edit. weird

i had to resort to doing edits into new file and loading that one and then editing into a still newer file...

steve's method doesn't let you grow your own font but i can do just fine without screen 0 in graphics screens.
b = b + ...
Reply
#8
(05-08-2024, 01:39 AM)bplus Wrote: steve's method doesn't let you grow your own font but i can do just fine without screen 0 in graphics screens.

Steve's method works just fine with build-your-own fonts. I'd suggest going with something as simple as a FNT format (which QB64 reads and works with, with no issues whatsoever with _LOADFONT), and then you'd have a resource that was portable and could be used in other places as well.

The documentation for FNT files is quite followable, and not hard to implement, so just plug it into your editor that you're making and go with it instead: https://www.metagraphics.com/metawindow/...-specs.htm
Reply
#9
(05-08-2024, 01:32 AM)TerryRitchie Wrote:
(05-07-2024, 10:58 PM)a740g Wrote: I would rather suggest doing what @SMcNeill said or if you are willing to wait, then we may have a way of loading PSF fonts (soonish).
I thought PSF fonts were Linux only. Am I incorrect in assuming this?
The PSF format was originally used in DOS and then used for Linux console fonts. The neat thing about the format is that it is super simple.

https://www.win.tue.nl/~aeb/linux/kbd/font-formats.html
Reply
#10
(05-08-2024, 02:41 AM)SMcNeill Wrote:
(05-08-2024, 01:39 AM)bplus Wrote: steve's method doesn't let you grow your own font but i can do just fine without screen 0 in graphics screens.

Steve's method works just fine with build-your-own fonts. I'd suggest going with something as simple as a FNT format (which QB64 reads and works with, with no issues whatsoever with _LOADFONT), and then you'd have a resource that was portable and could be used in other places as well.

The documentation for FNT files is quite followable, and not hard to implement, so just plug it into your editor that you're making and go with it instead: https://www.metagraphics.com/metawindow/...-specs.htm

yeah, no. Way too formal for me but changing my extension to .8x16 all the formatting header i need ;-))
without having to load set into some under-the-hood memory area this should be piece of cake specailly as we can keep using whatever font we want. oh i feel like free man now, don't need 256 characters either. maybe .8x16n100 or .8x16C c = 100 and good-bye stiffling bit math! good ole graphics screens is place for me Smile
b = b + ...
Reply




Users browsing this thread: 4 Guest(s)