Editable text in BASIC
Richard Ashbery (495) 163 posts |
I need to link some text (preferably RISC OS outline fonts that can be resized) to other BASIC files. Can this be coded ideally without SWIs (poor knowledge) and then CHAINed to the other files which are all in widescreen mode (1920 × 1080). Have any of you a BASIC program to do this please? |
Chris Hall (132) 3559 posts |
If I understood what you were asking I could probably answer more usefully. |
Richard Ashbery (495) 163 posts |
Fair point Chris. Is this any clearer? 1. I have a group of BASIC graphic files. Maybe there is another way! |
Chris (121) 472 posts |
Using outline fonts from BASIC is quite straightforward, but you do need to use the Font Manager’s SWI commands. At its simplest, you need to: 1. ‘Find’ the font you want you use (say, Trinity) in the size and weight you want. This is a bit like opening a file with Something like the following should work (untested):
You can read up more on the Font calls here: https://www.riscosopen.org/wiki/documentation/show/FontManager |
Richard Ashbery (495) 163 posts |
Looks promising Chris but fails on the first SWI with “font not found” although it looks as though it should work according to the ‘Font calls’ link from riscosopen. |
Chris (121) 472 posts |
Heh. Serves me right for trying to do it without testing. I’ve tweaked it a bit – does it work now? |
Richard Ashbery (495) 163 posts |
Yes it does. I’ve placed a MODE statement MODE 1920,1080,8 at the start of your edited version and changed the x,y parameters from 192 to 480 to increase text size to 30 point. I get a horrible red/green outline text in Trinity.Medium – could this be altered to a single colour? |
Chris (121) 472 posts |
I’ve not got a lot of experience of plotting fonts outside the desktop, but I think you need to set the font colours using ColourTrans. This call seems to be what you want. If you add the following line to the above code, before the
|
Richard Ashbery (495) 163 posts |
“ColourTrans_SetFontColours” does it. Brilliant. ‘Armed’ with your SWI instructions I can now place the required text anywhere on the screen. I usually manage to write simpler BASIC but understanding SWIs is an issue for a non-programmer like myself. Many thanks for your help. |
Steve Pampling (1551) 8172 posts |
This might sound strange, but you can help with the documentation. Just ask questions about the bits of the PRM’s that you don’t understand and then following an explanation you do understand it becomes apparent what needs altering in the documents (maybe an example code sample or two) |
Steve Drain (222) 1620 posts |
Apropos of nothing useful, I recall my first Archimedes with Arthur. In an early edition of Archive there was BASIC code to demonstrate the use of outline fonts, by Adrian Look I think. I remember the astonishment and pleasure of experimenting with it after years of bitmapped system fonts. ;-) |
Chris (121) 472 posts |
Great!
Some of the terminology around SWIs is confusing, and some indeed are complex to use, but in principle there’s not a whole lot of difference between calling a SWI via the
you’d call the equivalent SWI like this:
The main difference is that the parameters of a SWI call are numbered Some SWIs return information too, in which case you need the
The As Steve says, though, if you’re interested in investigating more, ask away, and do point out where the existing docs aren’t helpful. |