home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
551-575
/
apd562
/
readme.doc
< prev
Wrap
Text File
|
1990-10-20
|
9KB
|
228 lines
FontUte 1.1
by Gary O'Connor Nov/90
Selecting a font for your programmes is a very important job. The
right font can `make or break' the appearance of your screens.
Amos makes it easy to use your disc fonts, with the `Get Fonts' and
the `Set Font' commands, but you can only `Get Fonts' from the currently
`ASSIGN'ed `fonts' directory.
At startup, AmigaDos ASSIGNs `fonts' to the `fonts' directory on your
boot disc (if it has a `fonts' directory), so you can only `Get Fonts' from
that disc. If you want a different font, you have to copy it to your boot
disc before you can use it.
FontUte gets around this problem by using the Amos function called
`DOSCALL'. (See page 287 in your manual)
`DOSCALL' allows you to use the DOS functions from within an Amos
programme. It is relatively easy to use, provided you have some knowledge
of Assembly Language methods. Don't let that frighten you, it's not really
that hard.
I will be explaining how to use it in an Amos Users Club newsletter
in the near future.
FontUte uses `DOSCALL' to assign `fonts' to the directory of any
disc you choose from the Menu, and then calls `Get Fonts'. It then uses the
`Font$' function to sort out the information needed to make the Fonts menu.
(see pages 106 and 107 in your manual). This version of the programme will
create menus for up to 58 different fonts, if you have that many in a
`fonts' directory.
All you need do, after that, is select a font from the Fonts menu and
it will be displayed on the screen in LowRes.
You can change the `Pen' and `Paper' colours by clicking on the
buttons at the bottom of the screen and, if you want to see what the font
would look like in HiRes, simply click the left Mouse Button and you have
it. Clicking the left Mouse button toggles the display between Low and
Hires.
The Hires screen will automatically disappear as you move the Mouse to
the top of the display, unless you have your finger on the right Mouse
button. If you have done this and you select a menu, some of it will be
obscured by the Hires screen.
Once you have selected a font, the `Sel' menu will be adjusted to
show you the
(1) Currently selected font.
(2) The Source disc for that font and
(3) The Currently selected disc.
When you find a font you like, go to the last menu and you can save it
in a variety of ways.
(1) Font to Disc.
This is ideal if you have two disc drives or more. It loads the font
from the source disk and puts it straight on to the disc you want it to go
to.
(2) Font to ram.
If you only have one drive, this option will make a fonts directory
in ram:, to which you can add as many fonts as you like, and then use the
third option.
(3) Ram to Disc.
As the name implies this option will dump a fonts directory from ram:
to the destination disc of your choice.
In all cases the save options carry out a series of checks to ensure
you don't corrupt a disc, and to make things easy for you by creating any
directories that are necessary.
First of all the programme checks the size of the space it needs to
complete the transfer. It then compares that against the free space on your
destination disc, in the case of selections 1 and 3, or the available
memory for selection 2. If there is insufficient space available, it aborts
on selection 2 and gives you the option of selecting another destination
disc for selections 1 and 3.
Once it is satisfied that there is enough room, it checks to see if
the destination drive has a `fonts' directory. If it doesn't, one is
created and the process continues. It looks to see if there is a directory,
in the `fonts' directory for the selected font. If it doesn't find one it
creates one etc. etc.
In short, you don't have to know anything about creating directories
to put the font you want on the disc you want it to be on.
The programme is based around the `DOSCALL' function and makes use of
the ability to activate CLI commands from within an Amos programme. There
are a couple of things you have to do, however, before you can actually
do this.
(1) YOU MUST NOT CLOSE THE CLI ON STARTUP!
(2) YOU MUST HAVE A `C' DIRECTORY THAT CONTAINS THE DESIRED COMMANDS!
It works this way.
You create a `string' that contains the Command string, just as you
would type it into the CLI.
A normal CLI command string might look like this
1> assign fonts: df2:fonts
This would assign `fonts' to the `fonts' directory on the disc in drive
two. The Amos string equivalent would be
CD$="assign fonts: df2:fonts"+CHR$(0)
As you can see, it is basically the same string only we have given it a
name and we've added a CHR$(0) to the end.
The reason for the CHR$(0) is that AmigaDos looks for that character to
establish where the string ends.
Now here's the good bit......
If you follow the above rules, you can use the `DDOS' Procedure from
this programme to activate your own CLI commands. Just highlight the
Procedure and save it. Then you can use it in any programme you wish. You
will have to do a couple of other things.
At the start of your programme, after any `DIM' statements, type in
this line
Global CD$,R
When you make a command string, always call it CD$. The `R' variable
is returned by DOSCALL. If `R=-1' the call was successful.
BUGS, OTHER ANNOYANCES and THINGS OF INTEREST in FontUte!
(1) For some reason, `ASSIGN' does not work from Amos on all discs that
do have a `fonts' directory.
I don't know why.
It doesn't mean that there's something wrong with the disc because
if you try to `ASSIGN' `fonts' to the disc from the CLI, it works
perfectly well.
It will not work on any disc that has it's `fonts' directory
created from this programme, but it will work on a `fonts' directory
that this programme has created in ram:.
Do not panic. Any directory created by this programme will work
perfectly in your programmes.
(2) Amos does something really interesting with fonts you have
selected. So long as you have not changed discs, everything works
beautifully, but, when you do change discs and select a font, whammo!
it loads the last font you selected from the previous disc into Font$(3)
and it cannot be disloged from that position until you change discs
again. Then it does it all over again with the disc you just removed.
That is why you will notice, if you are keen enough, that the font
numbers on the menu will go, once you change discs,
1
2
4
etc.
The reason I've done that is because, were you to select `Font 3',
after you had changed discs, the programme will crash!
I'll fix it in the next version.
Have you ever used the `Exist' function to find out which drives are
connected?
Did it annoy you when you found out that, unless there is a disc in
the drive when you test it, it says that drive doesn't exist?
This programme uses `DOSCALL' to activate the CLI's `Info' function
and then sifts that information to establish which drives are connected,
whether they have a disc in them or not!
To use any CLI function that gives you a readout on the CLI, from
Amos, you must send the output of the CLI function to a file. Then you
read that file to glean the wanted information.
(see the MENINF, CHKASSIGN and SIZES Procedures for an example.)
A normal call, from the CLI would look like this
1> Info
This would print you out a list of attached drives and devices as well
as other valuable information.
The same call, to use the `DDOS' Procedure, would look like this
CD$="Info >ram:InfoFile"+CHR$(0)
This redirects the output of the Info function to the file
ram:InfoFile, and you get your information from that.
This programme uses the CLI functions
Info: To establish which drives are connected and the Disc Names!
ASSIGN: To assign fonts and to check that the ASSIGN function worked!
List: To get file size information!
WR-WR-WR-WR-WRAP UP!
I hope this programme is of use to you and I ask you to study the
code. Maybe you can improve it, and if you can please do so!
If you like any of the code then take it and use it.
Amos is a great language!
Happy programming!
Gary O'Connor
Membership number 353.