New games every week!
JSE - Fonts Part Two Blog
21st May 2021
Huh..

-=-=-


View on YouTube

Well, it kinda works.
The new SetFont n (where n is a number from 0 to 6, so far) will set the font to one of the currently available fonts.
0 is default, 1 is Amstrad CPC, 2 is Commodore 64, 3 is ZX Spectrum, 4 is BBC Micro, 5 is Amiga Topaz and 6 is Amiga AMOS Pro's default font known as "2001" (Which must've seemed an impossible futuristic number at the time!!)

The fonts "mostly" work, but on some devices you can definitely see the joins so I need to optimise my glyph renderer a little better.
But.. Yeah, it's working.

As a side-effect, though, the fonts are displaying at about twice the resolution of the previous font, so you'll probably have to dig through your old code and fix up any text displays that are now looking a bit screwy!!

Future enhancements
1. More varied fonts
2. A better looking default font.

It should be noted that, due to the way this was created, most none-ascii values could quite frankly show up as pretty much anything!!! Apologies if you've been relying on those.

// System Fonts dim line(10) txt="" l=0 if System==5 then txt=" " for n=32 to 255 txt=txt+chr(n) if len(txt)>39 then line(l)=txt:l=l+1 txt="" if System==5 then txt=" " endif next line(l)=txt:l=l+1 Repeat Graphics 320,240,1 System=Floor(Millisecs()/1500) mod 7 SetFont System SetFontSize 8 if System==0 // Default Border 32,32,32 CLS 0,0,0 SetCol 180,255,180 Print "The default font is now the CPC font." Print Print "Why not suggest your favourite" Print "8x8 pixel font to replace it?" Print endif if System==1 // Amstrad Border 0,0,128 CLS 0,0,128 SetCol 255,255,0 Print " Amstrad 128K Microcomputer (v3)" Print Print " "+Chr(164)+"1985 Amstrad Consumer Electronics plc" Print " and Locomotive Software Ltd." Print Print " Basic 1.1" Print Print "Ready" y=CursorY() if Mills()%600<300 then Rect 0,y,8,8 Print Print endif if System==2 // Commodore 64 CLS 80,72,178 SetCol 143,137,225 Border 143,137,225 Print " **** COMMODORE 64 BASIC V2 ****" Print Print " 64K RAM SYSTEM 38911 BASIC BYTES FREE" Print Print "READY." y=CursorY() if Mills()%600<300 then Rect 0,y,8,8 Print Print endif if System==3 // ZX Spectrum Border 216,216,216 CLS 216,216,216 SetCol 0,0,0 Locate 0,ScreenHeight-18 Print Chr(169)+" 1982 Sinclair Research Ltd" Locate 0,0 endif if System==4 // BBC Micro Border 80,0,0 CLS 0,0,0 SetCol 255,255,255 Print "BBC Computer" Print Print "Acorn DFS" Print Print "BASIC" Print if Mills()%600<300 then Print ">_" if Mills()%600>=300 then Print ">" Print endif if System==5 // Amiga - Topaz Graphics 640,480,1 SetFontSize 8 Border 0,0,0 CLS 153,153,153 SetCol 0,0,0 Rect 0,0,ScreenWidth(),14 SetCol 255,255,255 Line 0,14,ScreenWidth(),14 Locate 2,4:Print "Amiga Workbench 761800 graphics mem 0 other mem" print;print; SetCol 255,255,255 Rect 2,CursorY,41*8,8*8 SetCol 0,0,0 Rect 2+1,CursorY+1,(41*8)-1,(8*8)-1 SetCol 153,153,153 Rect 2+1,CursorY+1,(41*8)-2,(8*8)-2 SetCol 0,0,0 Rect 2+1,CursorY+1,(41*8)-2,(1*8)+2 SetCol 51,102,170 Rect 2+1,CursorY+1,(41*8)-2,(1*8)+1 SetCol 0,0,0 Locate 8,CursorY+2 Print "Woot" Print endif if System==6 // Amiga - AMOS "2001" CLS 180,80,0 SetColor 255,255,255 Print "Not an AmigaDOS disc (92)" Print endif for m=0 to l-1 if System<>5 then Print line(m) if System==5 then Print " "+line(m) next Flip Forever

Views 99, Upvotes 19  
Jse , Fonts
New games every week!
Site credits : Jayenkai, one crazy fool who has far too much time on his hands.
(c) Jayenkai 2023 and onwards, RSS feed 96

Blog - JSE - Fonts Part Two - AGameAWeek