Amos Professional Manual  Contents  Index

Fonts


TEXT
instruction: print graphical text
Text x,y,text$

This command is used to print text at the specified graphical coordinates. All coordinates are measured relative to the "baseline" of the current character set, which can be found using the TEXT BASE function, explained next. Normally, the baseline is the notional line on which all characters sit, and the "tails" of certain characters (like g,j,p,q and y) drop below this baseline. The next example demonstrates how text can be placed at any pixel position on the screen:

E> Do
    Ink Rnd(15)+1,Rnd(15) : Text Rnd(320)+1,Rnd(198)+1,"AMOS Professional"
   Loop

TEXT BASE
function: return the text base of the current character set
baseline=Text base

This function is used to get the reference position of the current font's baseline, given as the number of pixels between the top of the character, and the point that it will be printed on the screen. It is similar to the hot-spot of an Object.

TEXT LENGTH
function: return the length of a section of graphical text
width=Text Length(text$)

This function returns the number of pixels that make up the width of the characters in the current font, in a given string. This can vary for the same string, depending on the font in use. Furthermore, there are special fonts which assign different widths for each character in the same character set, known as "proportional" fonts. Here is a simple example:

E> TS="Centred Text"
   L=Text Length(T$)
   Text 160-L/2,100,T$

Wiping fonts from memory
As fonts are called, they build up in memory. Valuable memory is consumed, and it may be necessary to wipe fonts, using a line like this:

X> Trap Reserve As Data 10,1000000000

This forces AmigaDOS to clear out all unused memory, which will affect the fonts that have been stored. Obviously the huge amount of RAM that has been requested cannot possibly be reserved, even after the fonts have been cleared, and an "out of memory" error will be generated. A TRAP is included to cater for this event.

Back    Next
11.01.03