Fonts in BASIC
Jim Croskell (2836) 3 posts |
Hi There I recently obtained a Raspberry Pi 2 and started using RISC OS RC14. One feature of major interest to myself is learning BBC BASIC. I’m making good progress and have been able to get sprites working among other things. When it comes to fonts I’m struggling a bit and maybe someone might be able to shine a bit of light on things. I have been able to display text in a font but cannot to seem to get the colour correct via “ColourTrans_SetFontColours”. TBH – I’m not sure using the outline font is the best way for full screen work perhaps using Sprites is going to be faster. I did code up a routine to use sprites for text display but can only print in the colour I created the sprites with. Is it possible to to use sprites as text and change the colour you want to print in, or is this only possible using fonts? I’m currently playing around in 256 colour mode 13, and any examples of the best/correct to way go about displaying text using Fonts/Sprites would be much appreciated. Regards Jim |
John Williams (567) 768 posts |
As well as the desktop outline fonts there is also the original BBC System font. It is mono-spaced and is effectively an 8×8 pixel sprite for each character. I find the original – at the top of your Fonts list – rather ugly, but there exists a font editor and many alternative versions. OK, it’s primitive but characters plot fast and may be more easily adaptable for some purposes – and there is that retro feel! I actually use an adapted one for viewing e-mail and news: see here If it is of interest to you, I have a number of these fonts and an editor program which I could send you as a package if furnished with an address. Google seems to be preoccupied with other “BBC font” matters! |
Jim Croskell (2836) 3 posts |
This was the first approach that I discovered and I didn’t have problems getting things to work, the 8×8 limitation is what caused me me to look further afield.
Very kind of you to offer, as they will very likely come in handy at some point. I couldn’t find a way to PM you so: rjcroskell “at” gmail “dot” com I’m still very interested in the Outline / Sprite approach if anyone out there can help. Thanks Jim |
John Williams (567) 768 posts |
Sent. |
Robert Hampton (1923) 57 posts |
Jim, you may find this page useful for info about working with fonts: http://www.tofla.iconbar.com/tofla/gfx/fnt01/index.htm It’s a reproduction of an old article from Acorn Computing magazine. It’s from 1994 but should still be relevant. There are some example programs (all in BASIC) to download as well. Using Sprites may be faster, but plotting text using the font manager will probably look better. It all depends on what you need to do. As an aside, you may want to try a higher resolution mode for experimentation, like mode 28 (640×480) or 32 (800×600). Outline fonts will not look their best in mode 13. |
Jim Croskell (2836) 3 posts |
God knows how I never came across that from my numerous searches, but that page looks like it holds the answers/info I need regarding Outline Fonts, many thanks for bringing it my attention Robert. |