Here's some interesting example code dealing with Compugraphic outline
fonts and the Bullet font scaling engine from the 1992 Amiga Mail Vol. 2
article collection. I have modified the code to compile cleanly with
SAS/C 6.58 and to use pragmas and direct library calls rather than
calling the stub routines in amiga.lib.
I have modified the programs to open a new screen. The viewport modes,
bit depth, and background and foreground colors can be set with the
`V=VPModeID', `B=BitDepth' and `C=Colors' command line keywords. The
`V=VPModeID' keyword expects a hexadecimal value. I have included a
small utility called `ListVPModes' that displays a list of available
viewport modes that have a name, and their IDs. The `C=Colors' keyword
expects a six character long hexadecimal value that defines the
background and foreground color RGB triplets. For example, `fff000' sets
a white background and black foreground. The default viewport modes, bit
depth and colors are taken from the Workbench screen.
I have improved `View' somewhat:
- The program supports UCS-2 and UCS-4 encoded text files (use the U=UCS
command line keyword with 2 or 4 as the value). The Bullet font
scaling engine is limited to 16-bit code points, though.
- The leading (distance between baselines) can be set in percent of the
point size (default 120).
- The descender (the portion of a glyph that extends below the baseline)
can be set in percent of the point size (default 25). I wish there would
be a way to calculate the descender automatically, but that seems to
take using diskfont.library and OpenDiskFont(). I have made the
`ViewDiskfont' program mentioned below display some data about the font,
among them the descender percentage.
- Kerning can optionally be disabled.
- Whitespace characters are handled properly.
- The text scrolls up when it reaches the bottom of the window, rather
than the whole window being cleared.
- The output of the text can be paused/resumed with the Space key, or
ended with the `q' key.
- The program waits for the user to click the close gadget rather than
closing the window immediately at the end of the displayed file.
I have added a small program called `ViewChars', that lets you view a
range of Unicode characters. The `StartCode' and `EndCode' command line
arguments are expected to be hexadecimal values. Characters with no
glyph and no width are represented by a white square (U+25A1). The
default range is from U+0021 to U+007E inclusive. For relatively logical
reasons this program doesn't make use of any kerning information.
Outline fonts are supported by diskfont.library in AmigaOS 2.04 (V37)
and up, unfortunately the Text() function doesn't seem to make use of
any kerning information in the font, so if kerning adjustment is desired
it will be necessary to use the Bullet engine directly, and blit to the
raster ourselves, which is also done in the example programs. I have
included an additional program called `ViewDiskfont' that displays a
text string with a chosen font using diskfont.library and the Text()
function for demonstrational purposes. Please note that if you change
the XDPI or YDPI command line argument between invocations, it will be
necessary to use `avail flush' in order to clear any previously
generated font bitmaps from memory.
New in v1.8
- In `View.c', simplified the code for processing UCS-2 and UCS-4
- In 'View.c' and 'ViewChars.c', ScrollRaster() is now used to
scroll the text in the window up, rather than using RectFill() to
clear the whole window.
- In `View.c' and `ViewChars.c', the output of the text can be
paused/resumed with the Space key, or ended with the 'q' key.
- New file `input.c' that handles IDCMP input.
New in v1.7
- Corrected a typo in README; the default code point range in
`ViewChars' begins at U+0021, not U+0020.
- Moved the opening of the screen and the window to `window.c'.
- The programs now make the newly opened screen use the video modes
of the Workbench screen by default, rather than blindly assuming
HiRes (640 horizontal pixels).
- New command line keywords `V=VPModeID', `B=BitDepth' and
- A small utility called `ListVPModes' has been included that lists
available viewport modes that have a name, and their IDs.
- The `I=Interlace' command line switch has been removed.
- In `View' and `ViewChars' the descender (the portion of a glyph
that extends below the baseline) can now be set. I wish there
would be a way to calculate the descender automatically, but that
seems to take using diskfont.library and OpenDiskFont(). I have
made the `ViewDiskfont' program display some data about the font,
among them the descender percentage.
- In View.c and ViewChars.c, RectFill() painted over the borders.
- Moved the BumpRev revision files to `src/rev'.
New in v1.6
- In `ViewChars', the `StartCode' and `EndCode' command line
arguments are now expected to be hexadecimal values. It's more
natural to use hexadecimal when dealing with Unicode code points
New in v1.5
- The sample text files `SampleTextUCS2' and `SampleTextUCS4' in the
`Text' subdirectory stated that the ff, fi, fl and ffl ligatures
are located in the Arabic Presentation Forms-A Unicode block. We
need to get historical here. The Bullet engine was written at a
time when the Unicode standard was at version 1.0, and these
ligatures are in fact located in the Unicode 1.0 Private Use Area
New in v1.4
- Moved the source code to a `src' subdirectory.
- Added a command line argument to `View' to set the leading
(distance between baselines) in percent of the point size (default
- `View' now supports UCS-2 and UCS-4 encoded text files.
- Added a small program called `ViewChars' that lets you view a
range of Unicode characters.
- The programs can now be run from Workbench, although you won't be
able to provide any command line arguments. The default text file
for `View' is `Text/SampleText'.
- Now letting the menu bar be visible when opening the window of a
- Corrected a statement concerning `ViewDiskfont' in README
regarding the need to use `avail flush' when changing the command
line arguments. It only concerns the XDPI and YDPI values.
- Moved the sample text files to a `Text' subdirectory.
- Added icons to various files.
New in v1.3
- Now using BumpRev to manage revisions. This should have been done
- Added a note in README about diskfont.library and the Text()
function seemingly not supporting any kerning information in the
font. Also included an additional program called `ViewDiskfont'
that displays a text string with a chosen font using
diskfont.library and the Text() function for demonstrational
New in v1.2
- The programs now open a new screen.
- New command line switches: `N=NoKern' disables kerning (only
applicable to `View'), and `I=Interlace' sets interlaced video.
- The opened window is now made active by using the WA_Activate tag
in OpenWindowTags() in BulletMain.c and BulletMainFile.c.
- In View.c, RectFill() didn't fill the whole window. Fixed.
- In View.c, obtain the width of whitespace characters with
ObtainInfo() and the OT_WidthList tag, rather than just using 1/4
em as the width. Also adjust the kerning of whitespace.