home *** CD-ROM | disk | FTP | other *** search
- u
- S H P 2 F O N T
- by Dave Moorman
-
-
- Every time I get involved in some
- project, the first thing I seem to
- need is a tool to massage data or
- graphics into the form I need. Right
- now, I am working on a completely new
- Presenter Menu program for LOADSTAR,
- and I needed a way to get fancy-
- schmancy Windows display font text to
- our modest text screen.
-
- The first step isn't all that
- hard. I use Photo Delux to type the
- text in the typeface I want. This is
- saved as a 320x200 pixel GIF. Then I
- move the GIF to a D64 disk image, and
- fire up GoDot to turn it into a hi-res
- SHP (LOADSTAR's favorite graphics
- format) -- or a Doodle (then use
- STBPRINT to convert the edited Doodle
- to SHP).
-
- But then what? How do I get the
- bitmap to font characters? Johnny
- Harris published a good DOODLE TO FONT
- utility on 116. However, the program
- does a whole screen (or as much as can
- be squeezed into 256 characters). I
- wanted more control over the process.
- So here is SHP2FONT.
-
-
- USING THE UTILITY
- -----------------
-
- SHP2FONT is a step-by-step
- utility. First, you must have your
- bitmap graphic in the SHP format,
- which is easy to do with STBPRINT.
- Then you can choose the disk drive the
- SHP file is on by clicking on
-
- [1. Disk Drive]
-
- (or press <1>).
-
- Now on with the work. Choose
-
- [2. Get SHP]
-
- A scrolling menu of *.SHP files are
- offered. The one you choose is
- displayed until you click the mouse or
- press <BACK ARROW>.
-
-
- [3. Make FTS]
-
- You [must] choose a SHP file before
- this action can happen.
-
- An FTS file contains the font
- (begining at +0 Page), the screen (at
- +8 Page), and color (at +12 Page).
- When you select this action, you are
- asked if you want to use 256, 192,
- 128, or 64 font characters -- or Not
- do it at all.
-
- The program looks at each 8-byte
- cell of the bitmap screen and compares
- it to the cells already recorded in
- the font. If a match occurs, that font
- character is used to replicate the
- bitmap on the text screen. If no
- matching character is found, a new
- character is created, copying the
- 8-byte cell from the bitmap.
-
- If you have enough characters to
- replicate each 8-byte bitmap cell, you
- get a text screen rendition of the
- bitmap. If you run out of characters
- in the font, the process just stops.
- Either way, you can save the result as
- an FTS file (with [5. Save File]).
-
- Remember, cells that are identical
- use the same font character. So if you
- have large patches of clear or solid
- cells, the bitmap may well fit in 192
- characters -- leaving you with the
- basic alphanumeric characters.
-
-
- [5. Make Block]
-
- The alternative to replicating the
- whole bitmap is to make a block that
- uses 128 or 196 characters. Again, a
- SHP file must be chosen with [1.]
- before this action will work.
-
- When the bitmap is displayed, a
- single square will follow the mouse
- arrow around. Click to place this
- square in the upper left corner of the
- area you want to capture. Once you
- have clicked, three other squares move
- in concert with the mouse arrow to
- designate the other corners of the
- block. When you have the block
- defined, click again.
-
- If you goof up -- especially when
- you discover that the upper-left
- square is not quite where you want it,
- press <BACK ARROW> to return to the
- first phase. During the first phase,
- <BACK ARROW> will return you to the
- main menu.
-
- During the first phase, a Right
- Click will change the color of the
- blocks. A Right Click during the
- second phase toggles between 192 and
- 128 font characters available for the
- block. The squares will not move
- outside the given available space.
- However, when you toggle to 128
- characters, you will want to move the
- squares closer together then out again
- to mark the correct amount of area.
-
-
- [5. Save]
-
- This action will not work unless
- you have made an FTS or a Block. Then,
- it will automatically save the
- appropriate file format. Just type in
- the name. If the file name exists on
- the disk, a warning will appear.
-
-
- [6. Exit]
-
- Returns you to LOADSTAR or BASIC.
-
-
- The BLOCK File
- --------------
-
- Putting the Block on the screen is
- fairly easy -- even in BASIC. I
- reserved the last three bytes of the
- font (character screen code 255) to
- record the starting character, the
- width, and the height of the block. If
- you are using DotBASIC, the custom
- font is at 2048. Bload the font with
- the Block with:
-
- .bl,"f.block",dv,2048
-
- Then get the beginning screen
- code:
-
- bc=peek(4093):rem font+2045
-
- Set the upper left corner of the
- block with:
-
- bk=1024+by*40+bx
-
- Now you can use FOR-NEXT loops to
- put the block on the screen.
-
- for y = 0 to peek(4095):rem font+2047
- for x = 0 to peek(4094):rem +2046
- poke bk+y*40+x,bc:bc=bc+1
- next
- next
-
- Obviously, an ML routine would be
- quicker, and if you want to write one,
- you now know where to look for the
- necessary information.
-
- DMM
-
-
-