@DATABASE 0009
@(C) "Copyright © Cloanto Italia srl"
@REM Part of The Kara Collection CD-ROM, by Cloanto ®
@FONT topaz.font 8
@WIDTH 74

@NODE Main "Personal Fonts Maker - 5. PFM: The Brush Menu"
@TOC KARACDLOCAL:4/O0O0/Main

@{B}5.         PFM: The Brush Menu@{UB}

   Sections @{"3.17" LINK KARACDLOCAL:4/0008/Main 569} ("The 'Pencil/Brush' Gadget") and @{"3.18" LINK KARACDLOCAL:4/0008/Main 627} ("Define Brush")
introduce some general concepts about the brush and how it can be used.
This chapter explains in detail all the functions which can be applied to
the brush to load it, save it, transform it or change the position of the
handle.

   A brush must be defined (section @{"3.18" LINK KARACDLOCAL:4/0008/Main 627} "Define Brush") before the
functions explained in this chapter can be used. Only "Load Brush" and
"Handle" will work even if the brush mode is not active. The other menu
items are automatically disabled (section @{"1.9.8" LINK KARACDLOCAL:4/0056/Main 568} "Menus") by the program
when they cannot be used.


@{B}5.1        Load Brush@{UB}

   Once a brush has been defined, it can be saved to a file, loaded and
re-used again. The brush data is stored in the IFF ILBM (from "Interchange
File Format - InterLeaved BitMap") graphical format. This is a standard
shared by most Amiga software working with bit-map graphics.

   This function can be used to load a brush file previously stored by the
Personal Fonts Maker or another program using the IFF ILBM format.

   The standard file requester (section @{"3.23" LINK KARACDLOCAL:4/0008/Main 822}) allows the user to choose
the file to be loaded. An error message is displayed if the file does not
contain graphic data in the requested format.

   Both font environments share the same brush. If a brush has been
defined, it will be cleared by the brush being loaded, even if this
function is called from the font environment other than the environment in
which the original brush was defined. A warning message is displayed
before a brush which has not yet been saved is cleared by the brush being
loaded.

   If the selected file contains more than one image, only the last image
is loaded. The IFF ILBM format does not make any distinctions between
brushes and other types of images, like full screens. The Personal Fonts
Maker will load any of these, as long as the image is not too large. The
program can load pictures as big as 255 by 255 dots. If the image is wider
and/or taller than 255 dots, an error message is displayed.

   The Personal Fonts Maker also reads some non-graphical data in the IFF
file. In particular, the program supports the "BMHD" (from "BitMap
HeaDer"), "BODY" and "GRAB" IFF chunks. The program can deal with bitmap
masking, multiple-colour to two-colour conversion information and brush
handle position data. More information on the IFF format and details on
the IFF chunks mentioned above can be found in the official Commodore "'EA
IFF 85' Standard for Interchange Format Files" documentation.

   If the Personal Fonts Maker cannot find and process the necessary
instructions in the file on how to convert a multiple-colour image into an
on/off dot pattern, the default "OR" conversion mode is applied. This
means that for each position of the source image where there is a "1" in
one @{U}or@{UU} more bitplanes, the resulting brush bitmap will contain a coloured
("black", or "On") dot.

   One possible application of this function is the data exchange with
programs connected to external hardware devices. In particular, fonts
which are available on paper can be read by a scanner and converted into
IFF pictures by the software. The resulting characters could then be
loaded into the Personal Fonts Maker's memory with this function. Most
programs which are bundled with scanning devices have a so-called "Line
Art" option. This mode can be activated to produce better looking fonts.


@{B}5.2        Save Brush@{UB}

   This function saves the current brush to the specified file. The
documentation of the standard file requester (section @{"3.23" LINK KARACDLOCAL:4/0008/Main 822}), overwrite
warning message (section @{"7.11.4" LINK KARACDLOCAL:4/0054/Main 869}), Workbench icon (section @{"7.8" LINK KARACDLOCAL:4/0054/Main 634}), problems
with peripheral storage units (section @{"14.1" LINK KARACDLOCAL:4/0051/Main 10}) and brush data formats
(sections @{"2.4" LINK KARACDLOCAL:4/0055/Main 343} and @{"5.1" LINK Main 17}) is valid for this function.

   The program creates an IFF file containing the "BMHD" (from "BitMap
HeaDer"), "CMAP" (from "Colour MAP"), "GRAB" and "BODY" IFF chunks. The
Commodore documentation contains a detailed technical description of the
IFF format and the chunks mentioned here.

   To the non-technical user, all this means that the brush is saved in
such a way that it can be loaded from all programs handling the IFF ILBM
format. The file contains information on the brush image and the position
of the handle (section @{"5.9" LINK Main 283}). When the Personal Fonts Maker loads the
brush again, both the image and the brush handle associated with the brush
will be used.


@{B}5.3        Horizontal Flip@{UB}

   The same flip functions already described in section @{"3.20" LINK KARACDLOCAL:4/0008/Main 699}, which
modify the content of the character editing box, also exist for the
brush.

   This function transforms the image contained in the brush into its
"mirror" image. The columns of dots, from the left to the right, which
originally made up the brush image, are re-arranged from the right to the
left, in the same sequence.


@{B}5.4        Vertical Flip@{UB}

   This function, like "Horizontal Flip", modifies the brush image. The
brush is turned upside-down each time the function is selected.

   The effect of this function can be undone by repeating the function an
even number of times on the same brush. This is also valid for "Horizontal
Flip".


@{B}5.5        Rotate 90 Degrees@{UB}

   This function rotates the brush by 90 degrees clockwise. The horizontal
and vertical dimensions of the brush are reversed. If the brush is square
(i.e. if it is as wide as it is tall, in dots) the dimensions do not
change.

   The brush handle remains in the same position. If the function is
executed four (or a multiple of four) times on the same brush, the
resulting brush will be identical to the original brush.


@{B}5.6        Italicize@{UB}

   This function is generally used to produce an italic version of a
normal text character. Sections @{"2.6.13" LINK KARACDLOCAL:4/0055/Main 865} ("The ITAF Parameter") and @{"7.4" LINK KARACDLOCAL:4/0054/Main 469}
("Italic Factor") explain how to set the level of "italicness" of the
modified brush.

   When this function is executed, the image in the brush is slanted to
the right. The bottom line of the brush always remains in the same
position. The ITAF ("Italic Factor") parameter determines the number of
consecutive lines which have to be slanted to the right by one dot,
relative to the lines below.

   If the value specified by ITAF is smaller than or equal to the height
of the brush, the brush is not modified. In all other cases, the image
resulting from this operation is larger than the original one. The brush
width is increased accordingly, so that the image is not cut. The maximum
width of the brush is 255 dots. The operation is not performed if the
resulting brush would be slanted beyond this limit. The brush itself
remains rectangular, i.e. its outline is not italicized.

   For example, if ITAF is equal to 2, and the brush is 6 dots tall, this
function will shift the middle two rows of dots in the image to the right
by one position, and the top two rows by two positions, in the same
direction. The two bottom rows will remain on the same position. The total
brush width will be increased by two dots, so that the resulting image
(which has become larger) is not cut.

   This is one of the functions which are often recorded in a macro
sequence and repeated on a group of characters, if not on the whole font,
to produce a new font.


@{B}5.7        Reverse@{UB}

   This function reverses each dot in the brush image. Coloured dots
become transparent, and vice versa.

   After the function is executed an even (2, 4, 6 etc.) number of times,
the resulting brush is the same as the original brush.


@{B}5.8        Resize@{UB}

   The functions described in the following subsections modify the size of
the brush. The image in the brush is stretched to the new size. The image
is never cut. The maximum brush dimensions are 255 columns by 255 lines.
The minimum size is one dot. The functions do nothing if the resulting
image dimensions would exceed these limits.


@{B}5.8.1      Stretch@{UB}

   This function stretches the brush to a size defined by the user. The
new size is selected by using the mouse in the character editing box.

   When this function is selected, the "brush stretch" mode begins. When
the mouse pointer is over the character editing box it changes its default
image to the stretch symbol. This is to remind the user that the "brush
stretch" mode is active.

   The user is requested to define a new size for the brush. To do so, a
rectangle must be marked with the mouse, like the brush definition
described in section @{"3.18" LINK KARACDLOCAL:4/0008/Main 627}.

   The brush stretch mode is active until the user selects one corner of
the brush rectangle in the editing box, presses a mouse button, moves the
mouse pointer to the opposite corner, and releases the mouse button. The
operation can be cancelled by selecting the function again before the left
mouse button is pressed in the character editing box. The brush stretch
mode can also be interrupted by selecting the "Pencil/Brush" gadget
(section @{"3.17" LINK KARACDLOCAL:4/0008/Main 569}) or the equivalent keyboard shortcuts, or by redefining a
new brush.

   During the selection of the rectangle corresponding to the new size,
the mouse pointer is used to select the dot-positions which mark the
beginning and end of the rectangle. The two positions represent opposite
corners of the rectangle. When the mouse pointer is over the character
editing box and a mouse button is pressed (and held down), a green border
is drawn around the dot under the pointer. This is to highlight the
rectangle which is being selected. One corner of the rectangle will remain
linked with the initial position. The other corner will follow the mouse
pointer. When the mouse is moved (with the button still pressed), the
rectangle will change shape accordingly. When the mouse button is finally
released, the definition of the new brush size is complete. The program
automatically stretches the brush image to the new size. The resulting
brush will have the same height and width as the selected rectangle.


@{B}5.8.2      Halve@{UB}

   This function halves the brush. The width and the height are halved,
therefore the total brush surface is reduced to a quarter of the original
brush.

   This function, like all functions which reduce an image down to a
smaller dimension, causes a loss of data. Since the size of the dots which
make up the image does not change, the number of dots is reduced. In the
case of this function, the resulting image has about one quarter of the
the dots in the original brush. Even for a human, it is not easy to decide
which dots to "sacrifice".

   The Personal Fonts Maker reduces the image in a very mechanical way:
every second row of dots from the top is "discarded". Then, the same is
done for every second dot of the remaining rows. If the dimension which
has to be halved contains an odd number of dots, the step rate is
calculated in a way that the first and last dots (or columns, or rows) are
not removed.

   A "Double" operation following "Halve" will usually @{U}not@{UU} restore the
original image, unless the first image consisted of "bricks" of 2 by 2
dots of the same colour.


@{B}5.8.3      Halve Horizontal@{UB}

   This function is a subset of "Halve". Only the width is halved, while
the height is left unchanged.

   Every second column, starting from the left, is removed. The same
exceptions already described for the "Halve" operation apply if the image
consists of an odd number of columns.


@{B}5.8.4      Halve Vertical@{UB}

   This function "flattens" the brush. The width is not varied, but the
brush height is halved. This is done discarding every second row of dots
from the top, unless the image consists of an odd number of rows, in which
case the procedure is slightly more complex.


@{B}5.8.5      Double@{UB}

   This function doubles both the horizontal and vertical brush
dimensions. The resulting brush will have four times as many dots as the
original brush. Like all other brush editing functions, this function is
not executed if the resulting brush would exceed the maximum limit of 255
dots, either horizontally or vertically.

   To double the brush image, the program first duplicates every row of
dots, and then does the same with every column. The result is an image
where the original dots appear as "bricks" of four dots (2 x 2) having the
same colour as the original dot.


@{B}5.8.6      Double Horizontal@{UB}

   This function is a subset of "Double". The brush is doubled only
horizontally. While the width is doubled, the height remains the same.


@{B}5.8.7      Double Vertical@{UB}

   This function is a subset of "Double". The brush is doubled only
vertically. While the height is doubled, the width remains the same as
that of the original brush.


@{B}5.9        Handle@{UB}

   As described in section @{"3.17" LINK KARACDLOCAL:4/0008/Main 569} ("The 'Pencil/Brush' Gadget"), an outline
of the brush is associated with the mouse pointer over the character
editing box when the brush mode is active. The outline indicates the area
over which the brush image would be copied selecting a mouse button. If
the brush is larger than the character editing box, or if part of the
brush is not over the character editing box, only the part over the box is
outlined.

   The brush outline is moved when the mouse pointer goes from one dot in
the box over another dot. If the pointer is moved, but remains over the
same dot, the outline is not moved.

   The Personal Fonts Maker allows the user to select which dot of the
brush rectangle should be linked with the mouse pointer. One of five
positions can be selected: the four corners, plus the centre of the brush.
The following five subsections explain each possible setting in detail.

   Once the position of the handle has been selected, it can be changed
only by choosing a different position, or loading a new brush. The "Flip"
and "Rotate" functions do not flip or rotate the position of the brush
handle. If the brush size is varied, the handle will be re-positioned so
that it stays on the same relative position (a corner or the centre of the
brush rectangle).

   The handle's position is stored with the image data of the brush when
the brush is saved (section @{"5.2" LINK Main 69} "Save Brush"). When a brush is loaded,
the original handle position associated with that brush is restored.


@{B}5.9.1      Upper Left@{UB}

   This option places the brush handle on the top left corner of the
brush. This means that the outline displayed over the character editing
box will have its upper left dot under the mouse pointer.

   This brush position is the only which is guaranteed not to be moved by
a brush resizing operation. Therefore, the brush handle will always be
linked with the same dot. The top left corner is also the origin of the
coordinate systems of different functions of the Personal Fonts Maker.
These properties make this handle position particularly interesting when
the size of the brush is unknown, as in macro operations, and relative
brush movements are recorded (macros are explained in chapter @{"6" LINK KARACDLOCAL:4/0053/Main 1}).


@{B}5.9.2      Upper Right@{UB}

   This option links the brush handle with the top right corner of the
brush rectangle.


@{B}5.9.3      Centre@{UB}

   The brush handle position is placed at the centre of the brush. If the
centre falls between two dots, the lowest of two dots on the same column,
or the rightmost of two horizontally adjacent dots is selected.

   This is the default initial brush handle position of the Personal Fonts
Maker.


@{B}5.9.4      Lower Left@{UB}

   This option places the handle at the lower left corner of the brush.


@{B}5.9.5      Lower Right@{UB}

   This option links the brush handle with the lower right corner of the
brush rectangle. As for all other positions except "Upper Left", a
resizing of the brush implies that the position of the handle is also
moved. In all positions except "Upper Left", the handle has to be moved
over a different dot if the brush is resized, since three out of four
edges of the brush are repositioned by a stretch operation. This is to
ensure that the selected relative position (the lower right brush corner,
in this case) always remains on the same corner.

@ENDNODE
