Page 1 of 1

Font background color

Posted: Fri Feb 14, 2014 12:34 am
by DexOS
Is it possible to have the font background colour transparent, when using swi like
OS_Write0.
If so what are the SWI i should lookup.
Thanks.

Re: Font background color

Posted: Fri Feb 14, 2014 11:58 am
by Burngate
Maybe I'm misunderstanding things, but ...
Having re-read the PRM section on Character Output (PRM 1-503 onwards, and particularly 1-515 - 518) it seems these calls just output ASCII characters as bytes. It's up to the display device to translate those bytes into foreground/background pixels that humans understand.
Quite where that translation occurs I'm not sure - my long-term memory has failed with regard to how I used to put things on the screen, using fonts and such-like, but the following is a brain-dump of what i last did
Display.zip
(16.08 KiB) Downloaded 196 times
Somewhere in that spaghetti may be something useful - just don't expect proper professional-standard code from a self-professed cowboy

Re: Font background color

Posted: Fri Feb 14, 2014 5:38 pm
by AMcS
DexOS wrote:Is it possible to have the font background colour transparent, when using swi like
OS_Write0.
If so what are the SWI i should lookup.
Thanks.
If memory serves me right (not near my Pi at the minute !) using Fonts (as in Scalable Anti-aliased fonts) you need to use the Font_ module's SWI's. OS_Write0 is for purely text based output (am not sure if you can do that sort of blending with it).

In this particular case font blending is probably what you need (this is described in the PRMs and on the ROOL website - https://www.riscosopen.org/wiki/documen ... 20Blending). RISC OS supports both standard blending and also Alpha/Supermacy (so you can have a RISC OS font "overlaying" a video source background).

Again (from memory) you use:

Font_FindFont - to specify the font you want to use (something like Trinity, Homerton or whatever), that gives you a font handle
Follow the instructions in the Font Blending PRM note above.

Font_Paint is used to actually "display" the font.
When finished use Font_LoseFont to free the font you specified (and have a handle for).

To get a list of Fonts <F12> and type *FontCat to list the fonts
Trinity would be a "Times like" serif font while Homerton would be "Helvetica" like - san serif, Corpus would be like "Courier" (a fixed spaced typewriter like font).

The relevant information is in:
Font_Paint SWI:
https://www.riscosopen.org/wiki/documen ... Font_Paint

Font_FindFont SWI:
https://www.riscosopen.org/wiki/documen ... t_FindFont

Font_LoseFont SWI:
https://www.riscosopen.org/wiki/documen ... t_LoseFont

Note that anti-aliased fonts can be plotted to the nearest pixel (the co-ordinates start at bottom left (0,0) and go to (1279,1023) top right on a MODE 15 screen) - on that screen you could plot at 640,512 for a point mid screen.

I hope that helps.

Re: Font background color

Posted: Fri Feb 14, 2014 9:32 pm
by DexOS
Thank you very much for both your help, i will look into what you both have posted and once i get it working, i will post a example, so it may help others.