home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / fonts / a_q / bbcfonts1 / !BBCFonts / !help next >
Text File  |  1991-03-16  |  9KB  |  203 lines

  1.  
  2.                         BBC FONT SELECTOR DOCUMENTATION
  3.  
  4.  
  5. On the March 1991 disc - as well as in the Public Domain - there were some
  6. examples of BBC Fonts.  These are fonts that replace the normal character
  7. set, and make life with your Archimedes a lot more varied.  
  8.  
  9. {P}Normally, each font is loaded by double-clicking on its icon in the
  10. filer. However, this is not particularly convenient because if you have
  11. many fonts, the filer display becomes too large for comfort.  Also, double-
  12. clicking on an icon causes a large, unsightly box to fill the screen,
  13. inviting you to press the space bar.  As well as this, auto-booting a font
  14. file is not particularly elegant and returning to the normal, Latin1 font
  15. involves using the CLI.
  16.  
  17. {P}To sort out these small problems, and to make the handling of such fonts
  18. easier, I have written a multi-tasking font selector for the Archimedes.
  19. The program supports the !Help application, but is very easy to use anyway.
  20.  
  21.  
  22. @XH = How to use the program
  23.  
  24.  
  25. {P}Load the program in the usual RISC-OS way - by double clicking on the
  26. 'abc' icon - so as the program installs itself on the icon bar.  If you
  27. click select over this icon, a list of fonts will appear in a window.  To
  28. change the typeface, simply click select over the name of the required font.
  29. The inverted icon shows you which font is currently selected.
  30.  
  31. {P}At first, you may only be able to select one of the six standard
  32. typefaces - those being Latin1-4, Greek and BFont.  These are not
  33. particularly exciting, so you may be wandering how you can add other fonts -
  34. such as Dungeon, IBM and Courier - to the list.
  35.  
  36. {P}This is very simple - just drag a BBC Font icon from the filer into the
  37. Selector Window.  If the list is not full - it can store up to fifty font
  38. names - and the font has not already been installed, its name will be added
  39. to the list.  You can now select it as before.  Note, however, that the font
  40. file must reside in the application's directory or one of its sub-
  41. directories, for example adfs::Apps20.$.!BBCFonts.Fonts.  You will need to
  42. copy the file into the application directory before installing it, if it is
  43. not already there.  By keeping all the fonts in one place, it means that if
  44. you copy the application to another disc, all fonts will be copied as well.
  45.  
  46. {P}If you decide that, after all, you do not want a particular font to
  47. appear in the list, click menu over the font name in question, and select
  48. the 'Remove' option.
  49.  
  50. {P}Another facility offered by the program is a 'Default font' option - that
  51. is, the font automatically selected whenever the program is loaded.  To do
  52. this, click with menu over the required font name, and select 'Default'.
  53. This menu option becomes ticked and the font icon turns blue.  The next time
  54. you load the program, this font will be selected - but only if you save the
  55. settings before you quit.  This can be achieved by selecting 'Save' from the
  56. menu, which stores the settings in a file called "<BBCFont$Dir>.Config".
  57.  
  58. {P}The config file, if present, is loaded automatically each time the
  59. program is run.  If you combine this facility with the machine's own
  60. auto-booting function, you can select your favourite font by simply
  61. inserting the right disc.  By renaming the '!BBCFonts.AutoBoot' file as
  62. '!BBCFonts.!Boot' the program will load when you click select over the drive
  63. icon.
  64.  
  65.  
  66. @XH = How the program works
  67.  
  68.  
  69. {P}The program installs itself in the usual RISC-OS way when run.  It then
  70. goes into the the polling loop and waits for something to happen.
  71.  
  72. {P}The three main things of any interest that can happen are:
  73.  
  74. {*} the mouse is clicked in the window or on the 'abc' icon
  75. {*} a file is dragged into the window
  76. {*} a menu option is selected
  77.  
  78. {P}If the user clicks with select in the window, the function
  79. FNwhere_am_i(x%,y%) is called.  Here x% and y% represent the co-ordinates of
  80. the mouse pointer relative to the top left hand corner of the window.  This
  81. is calculated by PROCget_win_info that uses the SYS "Wimp_GetWindowInfo"
  82. call to work out its origins.  FNwhere_am_i(x%,y%) takes this data and
  83. returns either the font number that the mouse is over, or &FF if no font is
  84. pointed at.  The array fnt$() contains the font names according to their
  85. numbers.
  86.  
  87. {P}The icons are drawn onto the window by the PROCredoing(main%) and
  88. PROCdraw_icon(x%,y%) procedures.  This method was used instead of creating
  89. Wimp icons because more programming was required with a PROCcreate_icon
  90. routine and the icon handle given would rarely be the same as the font
  91. number if fonts were deleted.
  92.  
  93. {P}When select is clicked over one of these icons, current% is set to the
  94. font number and the routine PROCselect_font(n%) is called.  This either
  95. issues a *Alphabet command if the font selected is a system font, or a *Load
  96. command if the font needs to be loaded.  It also calls
  97. SYS"Wimp_ForceRedraw",-1,0,0,1280,1024 which redraws all on-screen windows.
  98. For some reason, some fonts cause the icons around the windows to be changed
  99. after loading.  To return these to their normal shapes without affecting the
  100. other characters in the set, simply press f12 followed by Return.
  101.  
  102. {P}If the user clicks with menu in the window,
  103. PROCcreate_menu(title$,data$,menu%,y%) is called which creates the menu
  104. contained in data$.  Briefly, this holds the menu items separated by commas.
  105. Each item can be prefixed with + or - meaning that the option is ticked or
  106. dimmed respectively.  The function FNtest_opt(test%,s$) inserts s$ into the
  107. data string if the expression in test% is true.  For example
  108.  
  109. @L = PROCcreate_menu("Title","Opt 1,"+FNtest_opt(h%=1,"+")+"Opt 2",menu%,y%)
  110.  
  111. {P}would create a two-option menu with the second option ticked if h% is 1.
  112.  
  113. {P}In the opening of a menu, open$ and open% are given values so that
  114. PROCmenu_select, which is called when a menu item is selected, can determine
  115. which function to call.  Similarly, if PROCreopen_menu is called after
  116. adjust was clicked on a menu, it uses open% to work out which menu it should
  117. reopen.
  118.  
  119. {P}PROCmenu_select uses the data block provided as well as the open$
  120. variable to call a function which carries out the necessary actions.  For
  121. example FNmain_0 removes a font, as the first item on the main menu is
  122. 'Remove'.
  123.  
  124. {P}The most complex part of the program, apart from the window refreshing
  125. which uses a lot of formulas to place the right number if icons in the right
  126. places, is the receive message section.  If a file is dropped into the
  127. program window, the program first finds out if the file in question is a
  128. font file.
  129.  
  130. {P}If so, the program makes sure that the file is in a sub- directory of the
  131. application directory.  It does this by comparing the first part of the
  132. filename with the system variable <BBBFont$Dir>.  FNreadvar(var$) reads the
  133. system variable and puts it into a Basic string.  If the file does belong to
  134. the application directory, the name is shortened by removing <BBCFont$Dir>.
  135. This means that, should you ever move the application to another directory
  136. or disc, it will still work.
  137.  
  138. {P}The filename left after the subtraction of the <BBCFont$Dir> part may be
  139. something like 'NewFonts.AlienFont'.  The name printed in the window is the
  140. last part of this - 'AlienFont' - which is found by using the function
  141. FNlastbit(file$).  Finally, this name is checked with the last part of all
  142. the others to make sure that the same font is not stored twice in the list.
  143.  
  144. {P}After this, the window's size is changed by PROCset_extent.  This uses
  145. the SYS "Wimp_SetExtent" command to set the size of the window so that it
  146. can hold all the icons, but no more.
  147.  
  148. {P}Similarly, when FNmain_1, which removes a font, is called, PROCset_extent
  149. is used, followed by SYS "Wimp_OpenWindow" and SYS "Wimp_RedrawWindow" so
  150. that if the window gets smaller, this is shown on screen as well.
  151.  
  152. {P}The !Help system is supported in the usual way by responding to message
  153. number &502 from the Wimp Manager.  This gives full information on what
  154. happens wherever the mouse is clicked.
  155.  
  156. {P}The only part of the program left to describe is the save routine -
  157. FNmain_2.  This uses the standard PRINT# commands to store the names of the
  158. fonts, the number of fonts and the default font under the filename
  159. <BBCFont$Dir>.Config.  The PROCload_config routine finds out if such a file
  160. has been saved, and if so it loads the font list along with the default
  161. font.
  162.  
  163. {P}Most of the important procedures and functions have been mentioned above
  164. - the rest are just general wimp housekeeping commands.  There are also a
  165. few major, global variables, which are:
  166.  
  167. default%      - the default font number
  168. current%      - the current font number
  169. nofont%       - the total number of fonts
  170. win_height%   - the height of the main window
  171. main%         - the main window handle
  172. info%         - the info window handle
  173. menu%         - the menu data block
  174. curbuf%       - the buffer in which indirected icon data is stored
  175. block% and q% - general purpose data blocks
  176. fnt$()        - holds the last part(s) of a font file name, e.g.
  177.                 "AlienFont"          = "<BBCFont$Dir>.AlienFont"
  178.                 "NewFonts.AlienFont" = "<BBCFont$Dir>.NewFonts.AlienFont"
  179.  
  180.  
  181.  
  182. program  documentation  sprites  obey files
  183. -------------------------------------------
  184.  
  185. ⇨ nineteen ninety one ⇨ richard blythe
  186.  
  187. Mr Richard Blythe
  188. 35, Carminow Way
  189. Newquay
  190. Cornwall
  191. TR7 3AZ
  192. England
  193.  
  194.  
  195. assorted bbc fonts
  196. ------------------
  197.  
  198. ⇨ nineteen ninety     ⇨ skyfall public domain disc h13
  199. ⇨ nineteen ninety one ⇨ the micro user march subscription disc
  200.  
  201.  
  202. end
  203.