home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_USER / 1990 / USERSP90.MSA / TEXT_CLINIC.DOC < prev    next >
Text File  |  1990-07-25  |  5KB  |  125 lines

  1.                              C L I N I C
  2.  
  3.  
  4.           In Mathew Lodge's Clinic this month there are questions
  5.            on C, the STE, as well as a guide to using GDOS fonts
  6.  
  7.  
  8. Welcome to this second disk-based clinic. The change over to disk means that
  9. you don't have to type the listings in any more - something you might
  10. appreciate with the longer C listings being sent in. First of all, a short
  11. question about the STE.
  12.  
  13.  
  14. STE cookies?
  15. ============
  16. There have been several rumours flying around about the 'Cookie Jar' feature of
  17. the STE. David Hoggan (and I!) have the following query: "Atari's 'cookie jar'
  18. (which contains information on the hardware internally and externally attached
  19. to the STE). What is it, and can anybody get it to work?"
  20.  
  21.  
  22. C for yourself
  23. ==============
  24. The C language is proving popular with ST programmers, judging by the amount of
  25. code that is sent to the clinic. This month I've had a few queries about C, the
  26. first of which is from Simon May of Bury St. Edmunds, Suffolk.
  27.     "From the public domain, I've acquired Gulam (a UNIX like shell), and
  28. Sozobon C. I'm currently trying to get the GULAM.PRG program to "auto" load in
  29. medium resolution. The DESKTOP.INF file on the disk was saved in medium
  30. resolution.
  31.     "If I put GULAM in the AUTO folder, it loads okay, but in low res. I've
  32. tried a small C program to change resolution, then Pexec GULAM.PRG. The program
  33. loads, but the screen display is complete garbage. A friend informs me that I
  34. need a GEM start routine. What exactly would a this do, and could I easily
  35. write one?
  36.     "Finally, I cannot output to the printer from C. I try to use the 'stdprn'
  37. file handle with fprintf, but in Gulam the output appears on the screen, and
  38. from the desktop my output just disappears."
  39.  
  40.  
  41. Fontastic
  42. =========
  43. Andrew Brown of Wetherby in West Yorkshire wanted to use the font features of
  44. Atari GDOS, but couldn't find any documentation. By burning a little midnight
  45. oil and deciphering a few books, he came up with this description of how to use
  46. fonts.
  47.     "You will of course need GDOS.PRG in your AUTO folder, and a correctly set
  48. up ASSIGN.SYS file together with all the fonts you're going to use. After the
  49. initial appl_init() call, you will need to determine the VDI graphics handle
  50. for the screen, then load up all the fonts into memory, like this:
  51.  
  52. main()
  53. {
  54. int gr_handle, ap_id, dummy, font_count, font_index;
  55. char name[35];
  56.  
  57.   ap_id=appl_init();
  58.   gr_handle=graf_handle(&dummy,&dummy,&dummy,&dummy);
  59.   font_count=vst_load_fonts(gr_handle,1);
  60.  
  61.     The variable, 'font-count', is the number of fonts successfully loaded from
  62. disk. The actual number available for use is one greater than this because of
  63. the permanently resident ROM 6x6 system font. To select a font, you need to do
  64. the following VDI call:
  65.  
  66. vst_font(gr_handle,font_index);
  67.  
  68.     Unfortunately, 'font_index' is not simply a number between one and the
  69. number of fonts available. Each font has its own unique identification number
  70. that has to be determined by the following VDI call:
  71.  
  72. font_index=vqt_name(gr_handle,number,&name[0]);
  73.  
  74.     Here, 'number' is the 1 to n+1 number described above. This function also
  75. returns the full name of the font in the character array 'name', that can be up
  76. to 35 characters long. The font is now selected and can be used with v_gtext
  77. and v_justified as normal. Manipulation with vst_effects, vst_height and so on
  78. all work as normal.
  79.  
  80.     The only other font function that merits a specific mention is this one:
  81.  
  82. vqt_font(gr_handle,&minADE,&maxADE,&distances[0],&maxwidth,&effects[0]);
  83.  
  84.     The int variable 'minADE' is the lowest ASCII character in the font and
  85. 'maxADE' is the highest. The 'distances' array (five words) will be filled with
  86. relative distances of the top, ascent, half, descent and bottom line from the
  87. baseline, and 'maxwidth' is the width of the widest character in the font. The
  88. five-word 'effects' array is filled with information telling you how GDOS makes
  89. the characters italic, light, underlined and so on.
  90.  
  91.     Finally, as your program exits, do not forget this call:
  92.  
  93. vst_unload_fonts(gr_handle,1);"
  94.  
  95.  
  96. Winding down
  97. ============
  98. Keep the letters coming - especially the solutions and comments on other
  99. people's problems and ideas, but don't forget that the clinic depends on your
  100. problems too! Remember to include your full name (or title, if preferred), and
  101. give your phone number if possible.
  102.  
  103.     If you have a listing longer than about 25 lines then please include it on
  104. a disk - I don't have time to type long listings in. Putting the text of your
  105. letter on disk is doubly helpful - First Word or First Word Plus format if
  106. possible, but straight ASCII is fine.
  107.  
  108.     If you are sending a complete program, then I also like to see it running
  109. before putting it into the column, so please include a double-clickable version
  110. of your program if at all possible. If you want the disk and/or listing back,
  111. also include a stamped addressed envelope. No SAE, no disk.
  112.  
  113. Mathew Lodge
  114. Programmer's Clinic
  115. Maen Melin
  116. Holmes Chapel Road
  117. Lach Dennis
  118. Northwich
  119. Cheshire
  120. CW9 7SZ
  121.  
  122.  
  123.  
  124.  
  125.