home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 236 / 236.d81 / t.s2f < prev    next >
Text File  |  2022-08-26  |  5KB  |  196 lines

  1. u
  2.          S H P   2   F O N T
  3.            by Dave Moorman
  4.  
  5.  
  6.     Every time I get involved in some
  7. project, the first thing I seem to
  8. need is a tool to massage data or
  9. graphics into the form I need. Right
  10. now, I am working on a completely new
  11. Presenter Menu program for LOADSTAR,
  12. and I needed a way to get fancy-
  13. schmancy Windows display font text to
  14. our modest text screen.
  15.  
  16.     The first step isn't all that
  17. hard. I use Photo Delux to type the
  18. text in the typeface I want. This is
  19. saved as a 320x200 pixel GIF. Then I
  20. move the GIF to a D64 disk image, and
  21. fire up GoDot to turn it into a hi-res
  22. SHP (LOADSTAR's favorite graphics
  23. format) -- or a Doodle (then use
  24. STBPRINT to convert the edited Doodle
  25. to SHP).
  26.  
  27.     But then what? How do I get the
  28. bitmap to font characters? Johnny
  29. Harris published a good DOODLE TO FONT
  30. utility on 116. However, the program
  31. does a whole screen (or as much as can
  32. be squeezed into 256 characters). I
  33. wanted more control over the process.
  34. So here is SHP2FONT.
  35.  
  36.  
  37. USING THE UTILITY
  38. -----------------
  39.  
  40.     SHP2FONT is a step-by-step
  41. utility. First, you must have your
  42. bitmap graphic in the SHP format,
  43. which is easy to do with STBPRINT.
  44. Then you can choose the disk drive the
  45. SHP file is on by clicking on
  46.  
  47.             [1. Disk Drive]
  48.  
  49.  (or press <1>).
  50.  
  51.     Now on with the work. Choose
  52.  
  53.               [2. Get SHP]
  54.  
  55.  A scrolling menu of *.SHP files are
  56. offered. The one you choose is
  57. displayed until you click the mouse or
  58. press <BACK ARROW>.
  59.  
  60.  
  61.              [3. Make FTS]
  62.  
  63.  You [must] choose a SHP file before
  64. this action can happen.
  65.  
  66.     An FTS file contains the font
  67. (begining at +0 Page), the screen (at
  68. +8 Page), and color (at +12 Page).
  69. When you select this action, you are
  70. asked if you want to use 256, 192,
  71. 128, or 64 font characters -- or Not
  72. do it at all.
  73.  
  74.     The program looks at each 8-byte
  75. cell of the bitmap screen and compares
  76. it to the cells already recorded in
  77. the font. If a match occurs, that font
  78. character is used to replicate the
  79. bitmap on the text screen. If no
  80. matching character is found, a new
  81. character is created, copying the
  82. 8-byte cell from the bitmap.
  83.  
  84.     If you have enough characters to
  85. replicate each 8-byte bitmap cell, you
  86. get a text screen rendition of the
  87. bitmap. If you run out of characters
  88. in the font, the process just stops.
  89. Either way, you can save the result as
  90. an FTS file (with [5. Save File]).
  91.  
  92.     Remember, cells that are identical
  93. use the same font character. So if you
  94. have large patches of clear or solid
  95. cells, the bitmap may well fit in 192
  96. characters -- leaving you with the
  97. basic alphanumeric characters.
  98.  
  99.  
  100.             [5. Make Block]
  101.  
  102.     The alternative to replicating the
  103. whole bitmap is to make a block that
  104. uses 128 or 196 characters. Again, a
  105. SHP file must be chosen with [1.]
  106. before this action will work.
  107.  
  108.     When the bitmap is displayed, a
  109. single square will follow the mouse
  110. arrow around. Click to place this
  111. square in the upper left corner of the
  112. area you want to capture. Once you
  113. have clicked, three other squares move
  114. in concert with the mouse arrow to
  115. designate the other corners of the
  116. block. When you have the block
  117. defined, click again.
  118.  
  119.     If you goof up -- especially when
  120. you discover that the upper-left
  121. square is not quite where you want it,
  122. press <BACK ARROW> to return to the
  123. first phase. During the first phase,
  124. <BACK ARROW> will return you to the
  125. main menu.
  126.  
  127.     During the first phase, a Right
  128. Click will change the color of the
  129. blocks. A Right Click during the
  130. second phase toggles between 192 and
  131. 128 font characters available for the
  132. block. The squares will not move
  133. outside the given available space.
  134. However, when you toggle to 128
  135. characters, you will want to move the
  136. squares closer together then out again
  137. to mark the correct amount of area.
  138.  
  139.  
  140.                [5. Save]
  141.  
  142.     This action will not work unless
  143. you have made an FTS or a Block. Then,
  144. it will automatically save the
  145. appropriate file format. Just type in
  146. the name. If the file name exists on
  147. the disk, a warning will appear.
  148.  
  149.  
  150.                [6. Exit]
  151.  
  152.     Returns you to LOADSTAR or BASIC.
  153.  
  154.  
  155. The BLOCK File
  156. --------------
  157.  
  158.     Putting the Block on the screen is
  159. fairly easy -- even in BASIC. I
  160. reserved the last three bytes of the
  161. font (character screen code 255) to
  162. record the starting character, the
  163. width, and the height of the block. If
  164. you are using DotBASIC, the custom
  165. font is at 2048. Bload the font with
  166. the Block with:
  167.  
  168.  .bl,"f.block",dv,2048
  169.  
  170.     Then get the beginning screen
  171. code:
  172.  
  173.  bc=peek(4093):rem font+2045
  174.  
  175.     Set the upper left corner of the
  176. block with:
  177.  
  178.  bk=1024+by*40+bx
  179.  
  180.     Now you can use FOR-NEXT loops to
  181. put the block on the screen.
  182.  
  183.  for y = 0 to peek(4095):rem font+2047
  184.    for x = 0 to peek(4094):rem +2046
  185.      poke bk+y*40+x,bc:bc=bc+1
  186.    next
  187.  next
  188.  
  189.     Obviously, an ML routine would be
  190. quicker, and if you want to write one,
  191. you now know where to look for the
  192. necessary information.
  193.  
  194.  DMM
  195.  
  196.  
  197.