-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11-01-fonts.html
327 lines (259 loc) · 14.7 KB
/
11-01-fonts.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!doctype html>
<html lang="en">
<head>
<!--
This Amos Professional Manual is written by asymetrix for the Amiga community and should stay completely FREE FOREVER.
Created 2008. :)
It was created from the original AMOS Professional Manual by Europress Software Ltd.
It has been updated by Fredrik Rambris.
-->
<title>Fonts - AMOS Professional Manual</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="keywords" content="Amos Professional, Amiga, Programming, Basic, Francois Lionet, Europress Software Ltd, Amos, computing, code, AmigaDOS">
<meta name="author" content="asymetrix,Fredrik Rambris">
<link rel="GitHub" href="https://github.com/fredrik-rambris/amospromanual">
<meta property="og:site_name" content="AMOS Professional Manual">
<meta property="og:image" content="https://amospromanual.dev/images/cover.jpg">
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="canonical" href="https://amospromanual.dev/11-01-fonts.html">
</head>
<body>
<section>
<h1>Fonts</h1>
<p>
A "font" refers to the physical shape of a set of printed characters. This Chapter explains how to
exploit the ready-made AMOS Professional fonts, how to import new ones, and how to design
your own fonts using the ready-made Font Editor program.</p>
</section>
<section id="01-text-fonts">
<h2>Text Fonts</h2>
<p>
Tile sets of fonts used by commands like PRINT, are known as "text fonts", and each AMOS
Professional window can have its own individual set, as required. Styles and special effects for
text fonts are controlled by instructions such as TEXT STYLE and WRITING, which are fully
explained in <a href="05-06-text.html">Chapter 5.6</a>.</p>
</section>
<section id="02-graphic-text-fonts">
<h2>Graphic Text Fonts</h2>
<p>
Although text fonts are suitable for normal uses, an infinite variety of styles can be achieved by
exploiting the much more flexible category of fonts known as "graphic text". Text fonts are
positioned by referring to their location in terms of characters, but graphic text can be controlled
much more accurately, because it is positioned using x,y-coordinates numbered in pixels. AMOS
Professional supports the thousands of graphic fonts, available in commercial packages or in the
public domain.</p>
</section>
<section id="03-rom-fonts">
<h2>ROM Fonts</h2>
<p>
There are also alternative fonts built into the Amiga's ROM chips, and these are also available for
use by the AMOS Professional system.</p>
<p>
All fonts are referred to by an individual index number in a font list. No matter what type of font
is to be used, you must first "get" it from wherever it is being stored, and then "set" it, ready for
use. Users who are familiar with the AMOS system will find that the AMOS Professional system
for handling fonts has been streamlined and improved. When a SET FONT command is given,
the system will do an automatic search to see if the required font is already in memory, and if all
is well, the specified font is immediately made available for use. If the required font is not found
in the current list of available fonts, it will be loaded, but the next time it is called by SET FONT
there will be no need to load it again.</p>
<h3 class="command" id="i-get-fonts">GET FONTS</h3>
<p><i>instruction: create a list of available fonts from System disc</i><br>
<b>Get Fonts</b></p>
<p>
The GET FONTS command creates an internal list of all available fonts on the System disc, and it
should always be called at least once before any changes in settings are made. In practice, you
will probably want to use this instruction at the beginning of a program, so that SET FONT may
be used freely at any later point.</p>
<p>
It is <b>very</b> important to remember that if you are distributing run-only or compiled programs to
be used by other people, and these programs make use of alternative fonts, then the required
font files <b>must</b> be included.</p>
<code class="prefix edit">Get Fonts
For F=0 To 10
Set Font F : T$="AMOS Professional Font: "+Str$(F)
Text 0,100,T$
Wait Key : Cls
Next F
</code>
<h3 class="command" id="i-get-disc-fonts">GET DISC FONTS</h3>
<p><i>instruction: create a list of available fonts from current disc</i><br>
<b>Get Disc Fonts</b></p>
<p>
This instruction is exactly the same as the GET FONTS command, except that it triggers a search
through the "Fonts" folder of your current disc only. If new fonts are to be used, then they must
first be copied into this folder.</p>
<h3 class="command" id="i-get-rom-fonts">GET ROM FONTS</h3>
<p><i>instruction: create a list of available ROM fonts</i><br>
<b>Get Rom Fonts</b></p>
<p>
As you might expect, this command produces a list of the fonts that are built into the computer's
ROM chips. At time of writing, the choice is rather limited:</p>
<code class="prefix edit">Screen Open 0,640,200,16,Hires
Get Rom Fonts
For A=1 To 10
Set Font A : A$="Hello, I'm "+ Font$(A) : Text 0,100,A$
Wait Key : Cls
Next A
</code>
<h3 class="command" id="fn-font-dollar">FONT$</h3>
<p><i>function: return details of available fonts</i><br>
report$=<b>Font$</b>(font number)</p>
<p>
This function is used to examine an existing font list and make a report, giving details of the
specified font number. The report is given as a string of 38 characters, holding the following
information: the name of the font, its physical height in pixels and its status set to either Disc or
Rom. For example:</p>
<code class="prefix edit">Get Fonts : Set Font 2
Print Font$(2)
</code>
<h3 class="command" id="i-set-font">SET FONT</h3>
<p><i>instruction: select font for use by Text command</i><br>
<b>Set Font</b> font number</p>
<p>
This simple command is used to select the character set to be employed by a TEXT instruction,
like this:</p>
<code class="prefix edit">Get Fonts
Set Font 2 : Text 100,100,"AMOS" : Set Font 1: Text 100,120,"Professional"
</code>
<h3 class="command" id="i-text">TEXT</h3>
<p><i>instruction: print graphical text</i><br>
<b>Text</b> x,y,text$</p>
<p>
This command is used to print text at the specified <b>graphical</b> 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:</p>
<code class="prefix edit">Do
Ink Rnd(15)+1,Rnd(15) : Text Rnd(320)+1,Rnd(198)+1,"AMOS Professional"
Loop
</code>
<h3 class="command" id="fn-text-base">TEXT BASE</h3>
<p><i>function: return the text base of the current character set</i><br>
baseline=<b>Text base</b></p>
<p>
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.</p>
<h3 class="command" id="fn-text-length">TEXT LENGTH</h3>
<p><i>function: return the length of a section of graphical text</i><br>
width=<b>Text Length</b>(text$)</p>
<p>
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:</p>
<code class="prefix edit">TS="Centred Text"
L=Text Length(T$)
Text 160-L/2,100,T$
</code>
</section>
<section id="04-wiping-fonts-from-memory">
<h2>Wiping fonts from memory</h2>
<p>
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:</p>
<code class="prefix ex">Trap Reserve As Data 10,1000000000</code>
<p>
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.</p>
</section>
<section id="05-assigning-fonts">
<h2>Assigning fonts</h2>
<p>
In the original AMOS system, you were obliged to go back to the Amiga Disc Operating System
every time that the current font directory needed changing. With AMOS Professional, ill('
ASSIGN instruction solves this problem.</p>
<h3 class="command" id="i-assign">ASSIGN</h3>
<p><i>instruction: assign a name to a file or device</i><br>
<b>Assign</b> "Name:" <b>To</b> "New_Pathname"<br>
<b>Assign</b> "Name:" <b>To</b> "Device"</p>
<p>
Supposing that you have an extensive library of fonts installed on a hard disc, as part of your
development system, but you are writing programs for users who only have use of the internal
floppy drive. You will need to test your programs with a reduced number of fonts, and employ
the internal drive instead of your hard disc. This is easily achieved with the following line:</p>
<code class="prefix ex">Assign "Fonts:" To "Df0:Fonts"</code>
<p>
Now, every time that GET FONTS or GET DISC FONTS is called, the internal drive will be used
instead of your hard disc.</p>
</section>
<section id="06-converting-font-coordinates">
<h2>Converting font coordinates</h2>
<p>
Obviously, with graphic fonts using coordinates measured in pixels, and text fonts positioned by
character coordinates, a set of conversion functions between the two systems is vital.</p>
<h3 class="command" id="fn-x-text">X TEXT</h3>
<h3 class="command" id="fn-y-text">Y TEXT</h3>
<p><i>functions: convert graphic coordinates to text coordinates</i><br>
text x-coordinate=<b>X Text</b>(graphic x-coordinate)<br>
text y-coordinate=<b>Y Text</b>(graphic y-coordinate)</p>
<p>
These self-explanatory functions convert coordinates from the standard graphical screen
coordinates that use pixels, to text coordinates, that are given in character lines and column
spacings. The resulting text coordinates are relative to the current window, and if the screen
coordinate lies outside of this window, a negative value will be returned.</p>
<h3 class="command" id="fn-x-graphic">X GRAPHIC</h3>
<h3 class="command" id="fn-y-graphic">Y GRAPHIC</h3>
<p><i>functions: convert text coordinates to graphic coordinates</i><br>
graphic x-coordinate=<b>X Graphic</b>(text x-coordinate)<br>
graphic y-coordinate=<b>Y Graphic</b>(text y-coordinate)</p>
<p>
This pair of functions performs the conversion of text format coordinates to graphic format
coordinates, and can be used to position text over an area of graphics on the screen.</p>
</section>
<section id="07-the-amos-professional-text-font-editor">
<h2>The AMOS Professional Text Font Editor</h2>
<p>
No matter how many fonts are available in your collection, there may be occasions when you
need to create your own character sets, or edit existing fonts for a specific purpose or special
effect. Nothing could be simpler!</p>
<p>
The AMOS Professional Text Font Editor is available on your Accessories disc, allowing fast,
precise and fool-proof loading, editing and saving of text fonts.</p>
<code class="prefix disc">Load "AMOSPro_Accessories:Font8x8_Editor.AMOS"</code>
<p>
The Font Editor screen is divided into three practical areas. The left-hand side of the screen is
used to display an entire character set. The top right-hand area of the screen displays an
enlarged 8 x 8 grid, which holds the individual character to be edited This is the working area.
The bottom right-hand screen contains a simple panel of options.</p>
<p><b>[LOAD FONT]</b><br>
Click on this option now, and a file requester will appear, asking you to load a font for editing.
This may be the Default Font which is available in the APSystem folder,
(AMOSPro.Default.Font).</p>
<p>
After clicking on your choice of font, the individual characters in the set are displayed on the
Font Editor working screen, and any of these characters can be selected by the mouse, for your
attention. As soon as a character is selected, its enlarged image appears in the editing window at
the top right-hand section of the screen.</p>
<p><b>[CLEAR][SET]</b><br>
This pair of options are used to affect <b>all</b> of the pixels that make up the current character, by
either clearing or setting them. Alternatively, individual pixels can be cleared or set by clicking
on them with any mouse button, to toggle their current status.</p>
<p><b>[STORE]</b><br>
The current character also appears in the [STORE] option panel. When you are satisfied with the
edited appearance of the current character, click on this panel to store it into the current font's
character set, before moving to the next operation.</p>
<p><b>[SAVE FONT]</b><br>
After your editing session is finished, the new font is saved to disc by clicking on this option,
and calling up the familiar file selector. After saving, you can continue the editing process, or call
up a new font to be edited.</p>
<p><b>[QUIT]</b><br>
Select this option to return to the AMOS Professional Edit screen.</p>
<p>
You are warned <b>not</b> to destroy the default font, otherwise AMOS Professional will be unusable
the next time it is initialised!</p>
</section>
<footer>
<a href="10-06-arexx.html" rel="prev">AREXX</a>
<a href="./">Contents</a>
<a href="14-appendix-g-command-index.html">Index</a>
<a href="11-02-speech.html" rel="next">Speech</a>
</footer>
</body>
</html>