Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornComputing_199402.adf » 9402 » FontManage/Example1

FontManage/Example1

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornComputing_199402.adf » 9402
Filename: FontManage/Example1
Read OK:
File size: 0757 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > Example1
   20REM Example of Font Manager use
   30REM by Ben Summers
   40
   50
   60REM first check to see if we have the RISC OS 3.1 font manager
   70SYS "Font_CacheAddr" TO version%
   80IF version% < 300 THEN ERROR 0,"Font Manager too old"
   90
  100REM find a suitible mode (multisync if possible)
  110SYS "OS_CheckModeValid",20 TO ;f%
  120IF (f% AND 2) = 2 THEN MODE 12 ELSE MODE 20
  130
  140REM set up the palette
  150REM in this one, we're only going to use two colours.
  160REM how boring. Never mind, wait until the next program...
  170
  180white%  = &FFFFFF00
  190black%  = &00000000
  200purple% = &DD449900
  210
  220REM set palette for white on black
  230SYS "Font_SetPalette",,0,1,6,black%,white%,&65757254
  240REM set palette for purple on black
  250SYS "Font_SetPalette",,8,9,6,black%,purple%,&65757254
  260
  270REM ok, let's find a font or two...
  280size1% = 24 * 16
  290size2% = 42 * 16
  300size3% = 56 * 16
  310SYS "Font_FindFont",,"Trinity.Medium",size1%,size1%,0,0 TO font1%
  320SYS "Font_FindFont",,"Trinity.Bold",size1%,size1%,0,0 TO font2%
  330SYS "Font_FindFont",,"Trinity.Medium",size2%,size2%,0,0 TO font3%
  340SYS "Font_FindFont",,"Trinity.Bold",size3%,size3%,0,0 TO font4%
  350
  360REM right then, paint onto the screen, first selecting the colour
  370REM using colourtrans
  380
  390SYS "ColourTrans_SetFontColours",font1%,black%,white%,14
  400SYS "Font_Paint",font1%,"This is some text",784,128,768
  410
  420SYS "ColourTrans_SetFontColours",font2%,black%,purple%,14
  430SYS "Font_Paint",font2%,"in rather nice fonts...",784,128,640
  440
  450SYS "ColourTrans_SetFontColours",font3%,black%,purple%,14
  460SYS "Font_Paint",font3%,"which can be any size...",784,128,512
  470
  480SYS "ColourTrans_SetFontColours",font4%,black%,white%,14
  490SYS "Font_Paint",font4%,"and so easy to use!",784,128,320
  500
  510REM and finally, lose the fonts...
  520SYS "Font_LoseFont",font1%
  530SYS "Font_LoseFont",font2%
  540SYS "Font_LoseFont",font3%
  550SYS "Font_LoseFont",font4%
  560
  570
  580

� > Example1
!� Example of Font Manager use
� by Ben Summers
(
2
<@� first check to see if we have the RISC OS 3.1 font manager
F"ș "Font_CacheAddr" � version%
P1� version% < 300 � � 0,"Font Manager too old"
Z
d2� find a suitible mode (multisync if possible)
n#ș "OS_CheckModeValid",20 � ;f%
x � (f% � 2) = 2 � � 12 � � 20
�
�� set up the palette
�7� in this one, we're only going to use two colours.
�<� how boring. Never mind, wait until the next program...
�
�white%  = &FFFFFF00
�black%  = &00000000
�purple% = &DD449900
�
�$� set palette for white on black
�7ș "Font_SetPalette",,0,1,6,black%,white%,&65757254
�%� set palette for purple on black
�8ș "Font_SetPalette",,8,9,6,black%,purple%,&65757254

%� ok, let's find a font or two...
size1% = 24 * 16
"size2% = 42 * 16
,size3% = 56 * 16
6Cș "Font_FindFont",,"Trinity.Medium",size1%,size1%,0,0 � font1%
@Aș "Font_FindFont",,"Trinity.Bold",size1%,size1%,0,0 � font2%
JCș "Font_FindFont",,"Trinity.Medium",size2%,size2%,0,0 � font3%
TAș "Font_FindFont",,"Trinity.Bold",size3%,size3%,0,0 � font4%
^
hC� right then, paint onto the screen, first selecting the colour
r� using colourtrans
|
�;ș "ColourTrans_SetFontColours",font1%,black%,white%,14
�:ș "Font_Paint",font1%,"This is some text",784,128,768
�
�<ș "ColourTrans_SetFontColours",font2%,black%,purple%,14
�@ș "Font_Paint",font2%,"in rather nice fonts...",784,128,640
�
�<ș "ColourTrans_SetFontColours",font3%,black%,purple%,14
�Aș "Font_Paint",font3%,"which can be any size...",784,128,512
�
�;ș "ColourTrans_SetFontColours",font4%,black%,white%,14
�<ș "Font_Paint",font4%,"and so easy to use!",784,128,320
�
�$� and finally, lose the fonts...
ș "Font_LoseFont",font1%
ș "Font_LoseFont",font2%
ș "Font_LoseFont",font3%
&ș "Font_LoseFont",font4%
0
:
D
�
00000000  0d 00 0a 10 f4 20 3e 20  45 78 61 6d 70 6c 65 31  |..... > Example1|
00000010  0d 00 14 21 f4 20 45 78  61 6d 70 6c 65 20 6f 66  |...!. Example of|
00000020  20 46 6f 6e 74 20 4d 61  6e 61 67 65 72 20 75 73  | Font Manager us|
00000030  65 0d 00 1e 14 f4 20 62  79 20 42 65 6e 20 53 75  |e..... by Ben Su|
00000040  6d 6d 65 72 73 0d 00 28  04 0d 00 32 04 0d 00 3c  |mmers..(...2...<|
00000050  40 f4 20 66 69 72 73 74  20 63 68 65 63 6b 20 74  |@. first check t|
00000060  6f 20 73 65 65 20 69 66  20 77 65 20 68 61 76 65  |o see if we have|
00000070  20 74 68 65 20 52 49 53  43 20 4f 53 20 33 2e 31  | the RISC OS 3.1|
00000080  20 66 6f 6e 74 20 6d 61  6e 61 67 65 72 0d 00 46  | font manager..F|
00000090  22 c8 99 20 22 46 6f 6e  74 5f 43 61 63 68 65 41  |".. "Font_CacheA|
000000a0  64 64 72 22 20 b8 20 76  65 72 73 69 6f 6e 25 0d  |ddr" . version%.|
000000b0  00 50 31 e7 20 76 65 72  73 69 6f 6e 25 20 3c 20  |.P1. version% < |
000000c0  33 30 30 20 8c 20 85 20  30 2c 22 46 6f 6e 74 20  |300 . . 0,"Font |
000000d0  4d 61 6e 61 67 65 72 20  74 6f 6f 20 6f 6c 64 22  |Manager too old"|
000000e0  0d 00 5a 04 0d 00 64 32  f4 20 66 69 6e 64 20 61  |..Z...d2. find a|
000000f0  20 73 75 69 74 69 62 6c  65 20 6d 6f 64 65 20 28  | suitible mode (|
00000100  6d 75 6c 74 69 73 79 6e  63 20 69 66 20 70 6f 73  |multisync if pos|
00000110  73 69 62 6c 65 29 0d 00  6e 23 c8 99 20 22 4f 53  |sible)..n#.. "OS|
00000120  5f 43 68 65 63 6b 4d 6f  64 65 56 61 6c 69 64 22  |_CheckModeValid"|
00000130  2c 32 30 20 b8 20 3b 66  25 0d 00 78 20 e7 20 28  |,20 . ;f%..x . (|
00000140  66 25 20 80 20 32 29 20  3d 20 32 20 8c 20 eb 20  |f% . 2) = 2 . . |
00000150  31 32 20 8b 20 eb 20 32  30 0d 00 82 04 0d 00 8c  |12 . . 20.......|
00000160  18 f4 20 73 65 74 20 75  70 20 74 68 65 20 70 61  |.. set up the pa|
00000170  6c 65 74 74 65 0d 00 96  37 f4 20 69 6e 20 74 68  |lette...7. in th|
00000180  69 73 20 6f 6e 65 2c 20  77 65 27 72 65 20 6f 6e  |is one, we're on|
00000190  6c 79 20 67 6f 69 6e 67  20 74 6f 20 75 73 65 20  |ly going to use |
000001a0  74 77 6f 20 63 6f 6c 6f  75 72 73 2e 0d 00 a0 3c  |two colours....<|
000001b0  f4 20 68 6f 77 20 62 6f  72 69 6e 67 2e 20 4e 65  |. how boring. Ne|
000001c0  76 65 72 20 6d 69 6e 64  2c 20 77 61 69 74 20 75  |ver mind, wait u|
000001d0  6e 74 69 6c 20 74 68 65  20 6e 65 78 74 20 70 72  |ntil the next pr|
000001e0  6f 67 72 61 6d 2e 2e 2e  0d 00 aa 04 0d 00 b4 17  |ogram...........|
000001f0  77 68 69 74 65 25 20 20  3d 20 26 46 46 46 46 46  |white%  = &FFFFF|
00000200  46 30 30 0d 00 be 17 62  6c 61 63 6b 25 20 20 3d  |F00....black%  =|
00000210  20 26 30 30 30 30 30 30  30 30 0d 00 c8 17 70 75  | &00000000....pu|
00000220  72 70 6c 65 25 20 3d 20  26 44 44 34 34 39 39 30  |rple% = &DD44990|
00000230  30 0d 00 d2 04 0d 00 dc  24 f4 20 73 65 74 20 70  |0.......$. set p|
00000240  61 6c 65 74 74 65 20 66  6f 72 20 77 68 69 74 65  |alette for white|
00000250  20 6f 6e 20 62 6c 61 63  6b 0d 00 e6 37 c8 99 20  | on black...7.. |
00000260  22 46 6f 6e 74 5f 53 65  74 50 61 6c 65 74 74 65  |"Font_SetPalette|
00000270  22 2c 2c 30 2c 31 2c 36  2c 62 6c 61 63 6b 25 2c  |",,0,1,6,black%,|
00000280  77 68 69 74 65 25 2c 26  36 35 37 35 37 32 35 34  |white%,&65757254|
00000290  0d 00 f0 25 f4 20 73 65  74 20 70 61 6c 65 74 74  |...%. set palett|
000002a0  65 20 66 6f 72 20 70 75  72 70 6c 65 20 6f 6e 20  |e for purple on |
000002b0  62 6c 61 63 6b 0d 00 fa  38 c8 99 20 22 46 6f 6e  |black...8.. "Fon|
000002c0  74 5f 53 65 74 50 61 6c  65 74 74 65 22 2c 2c 38  |t_SetPalette",,8|
000002d0  2c 39 2c 36 2c 62 6c 61  63 6b 25 2c 70 75 72 70  |,9,6,black%,purp|
000002e0  6c 65 25 2c 26 36 35 37  35 37 32 35 34 0d 01 04  |le%,&65757254...|
000002f0  04 0d 01 0e 25 f4 20 6f  6b 2c 20 6c 65 74 27 73  |....%. ok, let's|
00000300  20 66 69 6e 64 20 61 20  66 6f 6e 74 20 6f 72 20  | find a font or |
00000310  74 77 6f 2e 2e 2e 0d 01  18 14 73 69 7a 65 31 25  |two.......size1%|
00000320  20 3d 20 32 34 20 2a 20  31 36 0d 01 22 14 73 69  | = 24 * 16..".si|
00000330  7a 65 32 25 20 3d 20 34  32 20 2a 20 31 36 0d 01  |ze2% = 42 * 16..|
00000340  2c 14 73 69 7a 65 33 25  20 3d 20 35 36 20 2a 20  |,.size3% = 56 * |
00000350  31 36 0d 01 36 43 c8 99  20 22 46 6f 6e 74 5f 46  |16..6C.. "Font_F|
00000360  69 6e 64 46 6f 6e 74 22  2c 2c 22 54 72 69 6e 69  |indFont",,"Trini|
00000370  74 79 2e 4d 65 64 69 75  6d 22 2c 73 69 7a 65 31  |ty.Medium",size1|
00000380  25 2c 73 69 7a 65 31 25  2c 30 2c 30 20 b8 20 66  |%,size1%,0,0 . f|
00000390  6f 6e 74 31 25 0d 01 40  41 c8 99 20 22 46 6f 6e  |ont1%..@A.. "Fon|
000003a0  74 5f 46 69 6e 64 46 6f  6e 74 22 2c 2c 22 54 72  |t_FindFont",,"Tr|
000003b0  69 6e 69 74 79 2e 42 6f  6c 64 22 2c 73 69 7a 65  |inity.Bold",size|
000003c0  31 25 2c 73 69 7a 65 31  25 2c 30 2c 30 20 b8 20  |1%,size1%,0,0 . |
000003d0  66 6f 6e 74 32 25 0d 01  4a 43 c8 99 20 22 46 6f  |font2%..JC.. "Fo|
000003e0  6e 74 5f 46 69 6e 64 46  6f 6e 74 22 2c 2c 22 54  |nt_FindFont",,"T|
000003f0  72 69 6e 69 74 79 2e 4d  65 64 69 75 6d 22 2c 73  |rinity.Medium",s|
00000400  69 7a 65 32 25 2c 73 69  7a 65 32 25 2c 30 2c 30  |ize2%,size2%,0,0|
00000410  20 b8 20 66 6f 6e 74 33  25 0d 01 54 41 c8 99 20  | . font3%..TA.. |
00000420  22 46 6f 6e 74 5f 46 69  6e 64 46 6f 6e 74 22 2c  |"Font_FindFont",|
00000430  2c 22 54 72 69 6e 69 74  79 2e 42 6f 6c 64 22 2c  |,"Trinity.Bold",|
00000440  73 69 7a 65 33 25 2c 73  69 7a 65 33 25 2c 30 2c  |size3%,size3%,0,|
00000450  30 20 b8 20 66 6f 6e 74  34 25 0d 01 5e 04 0d 01  |0 . font4%..^...|
00000460  68 43 f4 20 72 69 67 68  74 20 74 68 65 6e 2c 20  |hC. right then, |
00000470  70 61 69 6e 74 20 6f 6e  74 6f 20 74 68 65 20 73  |paint onto the s|
00000480  63 72 65 65 6e 2c 20 66  69 72 73 74 20 73 65 6c  |creen, first sel|
00000490  65 63 74 69 6e 67 20 74  68 65 20 63 6f 6c 6f 75  |ecting the colou|
000004a0  72 0d 01 72 17 f4 20 75  73 69 6e 67 20 63 6f 6c  |r..r.. using col|
000004b0  6f 75 72 74 72 61 6e 73  0d 01 7c 04 0d 01 86 3b  |ourtrans..|....;|
000004c0  c8 99 20 22 43 6f 6c 6f  75 72 54 72 61 6e 73 5f  |.. "ColourTrans_|
000004d0  53 65 74 46 6f 6e 74 43  6f 6c 6f 75 72 73 22 2c  |SetFontColours",|
000004e0  66 6f 6e 74 31 25 2c 62  6c 61 63 6b 25 2c 77 68  |font1%,black%,wh|
000004f0  69 74 65 25 2c 31 34 0d  01 90 3a c8 99 20 22 46  |ite%,14...:.. "F|
00000500  6f 6e 74 5f 50 61 69 6e  74 22 2c 66 6f 6e 74 31  |ont_Paint",font1|
00000510  25 2c 22 54 68 69 73 20  69 73 20 73 6f 6d 65 20  |%,"This is some |
00000520  74 65 78 74 22 2c 37 38  34 2c 31 32 38 2c 37 36  |text",784,128,76|
00000530  38 0d 01 9a 04 0d 01 a4  3c c8 99 20 22 43 6f 6c  |8.......<.. "Col|
00000540  6f 75 72 54 72 61 6e 73  5f 53 65 74 46 6f 6e 74  |ourTrans_SetFont|
00000550  43 6f 6c 6f 75 72 73 22  2c 66 6f 6e 74 32 25 2c  |Colours",font2%,|
00000560  62 6c 61 63 6b 25 2c 70  75 72 70 6c 65 25 2c 31  |black%,purple%,1|
00000570  34 0d 01 ae 40 c8 99 20  22 46 6f 6e 74 5f 50 61  |4...@.. "Font_Pa|
00000580  69 6e 74 22 2c 66 6f 6e  74 32 25 2c 22 69 6e 20  |int",font2%,"in |
00000590  72 61 74 68 65 72 20 6e  69 63 65 20 66 6f 6e 74  |rather nice font|
000005a0  73 2e 2e 2e 22 2c 37 38  34 2c 31 32 38 2c 36 34  |s...",784,128,64|
000005b0  30 0d 01 b8 04 0d 01 c2  3c c8 99 20 22 43 6f 6c  |0.......<.. "Col|
000005c0  6f 75 72 54 72 61 6e 73  5f 53 65 74 46 6f 6e 74  |ourTrans_SetFont|
000005d0  43 6f 6c 6f 75 72 73 22  2c 66 6f 6e 74 33 25 2c  |Colours",font3%,|
000005e0  62 6c 61 63 6b 25 2c 70  75 72 70 6c 65 25 2c 31  |black%,purple%,1|
000005f0  34 0d 01 cc 41 c8 99 20  22 46 6f 6e 74 5f 50 61  |4...A.. "Font_Pa|
00000600  69 6e 74 22 2c 66 6f 6e  74 33 25 2c 22 77 68 69  |int",font3%,"whi|
00000610  63 68 20 63 61 6e 20 62  65 20 61 6e 79 20 73 69  |ch can be any si|
00000620  7a 65 2e 2e 2e 22 2c 37  38 34 2c 31 32 38 2c 35  |ze...",784,128,5|
00000630  31 32 0d 01 d6 04 0d 01  e0 3b c8 99 20 22 43 6f  |12.......;.. "Co|
00000640  6c 6f 75 72 54 72 61 6e  73 5f 53 65 74 46 6f 6e  |lourTrans_SetFon|
00000650  74 43 6f 6c 6f 75 72 73  22 2c 66 6f 6e 74 34 25  |tColours",font4%|
00000660  2c 62 6c 61 63 6b 25 2c  77 68 69 74 65 25 2c 31  |,black%,white%,1|
00000670  34 0d 01 ea 3c c8 99 20  22 46 6f 6e 74 5f 50 61  |4...<.. "Font_Pa|
00000680  69 6e 74 22 2c 66 6f 6e  74 34 25 2c 22 61 6e 64  |int",font4%,"and|
00000690  20 73 6f 20 65 61 73 79  20 74 6f 20 75 73 65 21  | so easy to use!|
000006a0  22 2c 37 38 34 2c 31 32  38 2c 33 32 30 0d 01 f4  |",784,128,320...|
000006b0  04 0d 01 fe 24 f4 20 61  6e 64 20 66 69 6e 61 6c  |....$. and final|
000006c0  6c 79 2c 20 6c 6f 73 65  20 74 68 65 20 66 6f 6e  |ly, lose the fon|
000006d0  74 73 2e 2e 2e 0d 02 08  1d c8 99 20 22 46 6f 6e  |ts......... "Fon|
000006e0  74 5f 4c 6f 73 65 46 6f  6e 74 22 2c 66 6f 6e 74  |t_LoseFont",font|
000006f0  31 25 0d 02 12 1d c8 99  20 22 46 6f 6e 74 5f 4c  |1%...... "Font_L|
00000700  6f 73 65 46 6f 6e 74 22  2c 66 6f 6e 74 32 25 0d  |oseFont",font2%.|
00000710  02 1c 1d c8 99 20 22 46  6f 6e 74 5f 4c 6f 73 65  |..... "Font_Lose|
00000720  46 6f 6e 74 22 2c 66 6f  6e 74 33 25 0d 02 26 1d  |Font",font3%..&.|
00000730  c8 99 20 22 46 6f 6e 74  5f 4c 6f 73 65 46 6f 6e  |.. "Font_LoseFon|
00000740  74 22 2c 66 6f 6e 74 34  25 0d 02 30 04 0d 02 3a  |t",font4%..0...:|
00000750  04 0d 02 44 04 0d ff                              |...D...|
00000757