NBS

Reference puw.-

NATL INST. OF STAND & TECH

AlllQS 17mS7

o. o NBS TECHNICAL NOTE 1176

U.S. DEPARTMENT OF COMMERCE/National Bureau of Standards

Utility Programs

for Generating tlie

IHershiey Character Fonts

on IVIicrocomputers and

Laboratory Plotters

•QC

100

U5753

1176

iy83
NATIONAL BUREAU OF STANDARDS

The National Bureau of Standards' was established by an act of Congress on March 3, 1901. The Bureau's overall goal is to strengthen and advance the Nation's science and technology

and facilitate their effective application for public benefit. To this end, the Bureau conducts

research and provides: (1) a basis for the Nation's physical measurement system, (2) scientific and technological services for industry and government, (3) a technical basis for equity in trade, and (4) technical services to promote public safety. The Bureau's technical work is per- formed by the National Measurement Laboratory, the National Engineering Laboratory, and

the Institute for Computer Sciences and Technology.

THE NATIONAL MEASUREMENT LABORATORY provides the national system of

physical and chemical and materials measurement; coordinates the system with measurement

systems of other nations and furnishes essential services leading to accurate and uniform

physical and chemical measurement throughout the Nation's scientific community, industry,

and commerce; conducts materials research leading to improved methods of measurement,

standards, and data on the properties of materials needed by industry, commerce, educational

institutions, and Government; provides advisory and research services to other Government

agencies; develops, produces, and distributes Standard Reference Materials; and provides

calibration services. The Laboratory consists of the following centers:

Absolute Physical Quantities^ — Radiation Research — Chemical Physics —

Analytical Chemistry — Materials Science

THE NATIONAL ENGINEERING LABORATORY provides technology and technical ser- vices to the public and private sectors to address national needs and to solve national problems; conducts research in engineering and applied science in support of these efforts; builds and maintains competence in the necessary disciplines required to carry out this research and technical service; develops engineering data and measurement capabilities;

provides engineering measurement traceability services; develops test methods and proposes

engineering standards and code changes; develops and proposes new engineering practices;

and develops and improves mechanisms to transfer results of its research to the ultimate user. The Laboratory consists of the following centers:

Applied Mathematics — Electronics and Electrical Engineering^ — Manufacturing

Engineering — Building Technology — Fire Research — Chemical Engineering^

THE INSTITUTE FOR COMPUTER SCIENCES AND TECHNOLOGY conducts

research and provides scientific and technical services to aid Federal agencies in the selection, acquisition, application, and use of computer technology to improve effectiveness and

economy in Government operations in accordance with Public Law 89-306 (40 U.S.C. 759), relevant Executive Orders, and other directives; carries out this mission by managing the Federal Information Processing Standards Program, developing Federal ADP standards

guidelines, and managing Federal participation in ADP voluntary standardization activities; provides scientific and technological advisory services and assistance to Federal agencies; and

provides the technical foundation for computer-related policies of the Federal Government.

The Institute consists of the following centers:

Programming Science and Technology — Computer Systems Engineering.

'Headquarters and Laboratories at Gailhersburg, MD, unless otherwise noted; mailing address Washington, DC 20234. 'Some divisions within the center are located at Boulder, CO 80303.
OF $TfiJ?D}UiDS

Utility Programs for Generating the JX'J^'

iHershey Character Fonts on tS4S

Microcomputers and Laboratory Plotters '^^

C. E. Dick

J. Hilsenrath

National Measurement Laboratory

National Bureau of Standards

Washington, DC 20234

'r

'.4iiA: Q

U.S. DEPARTMENT OF COMMERCE, Malcolm Baldrige, Secretary

NATIONAL BUREAU OF STANDARDS, Ernest Ambler, Director

Issued June 1 983
National Bureau of Standards Technical Note 1 1 76

Natl. Bur. Stand. (U.S.) Tech. Note 11 76, 45 pages (June 1983)

CODEN: NBTNAE

U.S. GOVERNMENT PRINTING OFFICE

WASHINGTON: 1983

For sale by the Superintendent of Documents, U.S. Government Printing Office, Washington, DC 20402

Price $3.75

(Add 25 percent for other than U.S. mailing)
ABSTRACT

Two programs are described that allow for the storage and manipulation of digitized fonts of graphic arts symbols and characters on

the Apple II computer system. These fonts are based on the work of

A. V. Hershey and provide the user with a repertory of digitized

characters suitable for use in the preparation of camera-ready

illustration in the laboratory environment. The programs described

contain routines for reading files of the Hershey coordinates,

storing them as text files, displaying them as individual characters or combined text on the high resolution display, and two

methods for editing them or creating special symbols and graphics.

Key words: Applesoft basic programs; camera-ready illustrations;

digitized graphic symbols; Hershey character fonts; microcomputers.

Ill

Table of Contents

Page

Introduction 1

The Origin and Diffusion of the Hershey Fonts 2

The Current Programs 3

The Hershey Characters 4

Candy Apple 5

The Fonts 12

Conclusion 13

References 14

Appendix A 16

Listing 1. Candy Apple Program 17

Listing 2. Candy Apple variable listing 22

Listing 3. Catalog of Candy Apple disk 26

Listing 4. Candy Wrapper program 2 7
List of Figures

Page

Figure 1. Cartographic letter A showing coordinate system 31

Figure 2. Hires display of English gothic 32

Figure 3. Math symbols and Carto fonts 33

Figure 4 . Index font 34

Figure 5. Simplex font 35

Figure 6. Complex font 36

Figure 7. Gothic font 37

Figure 8. Script font 38

Figure 9. Candy Apple logo produced by Candy Wrapper 39

VI
utility Programs for Generating the Hershey Character Fonts

on

Microcomputers and Laboratory Plotters

INTRODUCTION

With the advent of microcomputers able to drive inexpensive

x-y plotters, it is now possible for scientists to produce camera

ready illustrations in their own laboratory. Such drawings have,

in the past, required costly and time consuming drafting and hand

lettering by graphics artists.

The ingredients of such an in-house facility, in addition to

the microcomputer and plotter, are:

a) a collection of mechanical drafting routines

b) a repertory of graphic arts fonts in digitized form

c) computer programs to store, retrieve, edit, and display

them on video terminals, printers, and plotters.

Mechanical drafting and data handling routines have been

under development for some time and are the subject of a forthcoming report. For the character digitization, we have been

able to draw on the pioneering and definitive work of Dr. Allen V.

Hershey as subsequently presented by Wolcott and Hilsenrath. The

third item on the above list, the software required to digitize

and display the characters, is the subject of this report. This

* report describes two programs for the Apple II computer operating

under the disk operating system (DOS 3.3). The first program,

which is treated in detail, contains routines for reading files of

Hershey coordinates and storing them in a more compact format as

text files, displaying individual characters or complete fonts on

the hires (high resolution) screen, and two methods for editing or

* In this report certain commercial products are referenced by

name. These references are for informational purposes only

and do not imply that they are necessarily the best

available for the purpose or do not imply endorsement by NBS.

- 1 - C.E. Dick and J. Hilsenrath
making new characters. This program is the main subject of this

report. The second program, which is treated as an appendix to

this paper, details utilities for combining individual Hershey

characters on the hires screen for the creation of logos for use

in other programs. It is meant to be illustrative of some of the

possible applications of the Hershey fonts.

THE ORIGIN AND DIFFUSION OF THE HERSHEY FONTS

In the mid sixties. Dr. Allen V. Hershey undertook a project

at the Naval Weapons Laboratory in Dahlgren, Virginia, to automate

the preparation of his highly mathematical reports and those of

others involving complex chemical structures and electrical

diagrams. That work produced a comprehensive suite of FORTRAN

typographic programs; a repertory of occidental alphabets and

oriental ideograms, cartographic symbols, etc. The typographic

system has been fully documented in a series of NWL reports (1-5).

Early applications of the system are to be found in Hershey' s own

scientific publications (f-10) in which the system was honed.

More than 120 copies of the original system have been

distributed (largely in card .decks) to universities, industries,

and government ] abora tor ies . Applications range from computer

assisted typesetting to computer driven engraving machines with

the output characters appearing on all types of printers and

plotters (11). Although Hershey' s characters have been

incorporated in many commercial graphics packages, unfortunately,

they do not all acknowledge the source. NBS has used the system

for well over ten years, and in 1976 undertook the publication, in

book form (12), of the occidental fonts, and the distribution on

magnetic tape (13), of the coordinates for both the occidental and

orienta] characters. This was follov/ed in 1978 by the publication

of a subset incorporated in a Technical Note by N.W. Wolcott

entitled "FORTRAN IV Enhanced Character Graphics" (14) . Since

then, the economic advantage of in-laboratory production of camera

ready illustrations for research papers has led to the

Utility Programs... - 2 -
incorporation of the Hershey character fonts as user defined

characters under the Hewlett-Packard Graphics Language (15), and

in a system for use on the Apple II computer system. It is this

latter application which is the subject of this report.

Extensive use of the Hershey characters v;as made in 1981 by

Claude A. Kagan v/ho succeeded in adapting them for a variety of

microcomputer systems, including the Apple II operating under

CPM (I'S). A more recent application of the Hershey character set

has been made by Daniel Macero and associates (17) v/ho have

modified a line printer to provide a resolution of 100

dots-per- inch horizontally and 72 dots-per- inch vertically.

THE CURRENT PROGRAMS

The present report details a technique for using the Hershey

characters with the Apple IT computer system operating under the

Apple Disk Operating System, DOS 3.3 (18). Although the High

Resolution Character Generator Routine supplied as part of the

Applesoft Toolkit (19) provides for the creation and retrieval of

characters and special symbols, these characters are limited to a 7x8 dot matrix format and are designed to be used on the high

resolution graphics screen.

Consequently, we present in this report two programs that

will allow the storage of the Flershey characters in a compact

format as text files (CANDY APPLE) and their subsequent use as

input to the hires graphics screen (CANDY WRAPPER). The first of

these programs is described in some detail since it provides the

means of storing the digitized character coordinates as well as a technique for creation of special characters and symbols. The

second program is included as an appendix to illustrate a particular use of the Hershey characters. A more extensive

program describing their use for digital plotting is currently

being documented.

Although some effort has been expended to faithfully

reproduce the character fonts tabulated by Wolcott and Hilsenrath,

- 3 - C.E. Dick and J. Hilsenrath
we have made some reasonably liberal changes in these fonts to

provide for our particular application.

THE HERSHEY CHARACTERS

As tabulated by Wolcott and Hilsenrath (12-13), the Hershey

characters consist of a series of numbers which indicate the end

points of straight line segments which are used to define

alphanumeric and special symibols. Each succeeding number pair

indicates the coordinates of the next dot to be connected in a connect the dots scheme. For example, the vectors that correspond

to the capital A illustrated in Figure 1, are given in the

following format:

1: -5 5: -5: -4 4:-64 0: -5: 4 4:-64 0:

-2 1: 2 l:-64 -54:

In this representation, the first number is the character

number in the Hershey set, the first pair of numbers indicates the

X coordinates of the limits of the character (-5,5), and the

actual character begins at the next coordinate location

(x=0,y=-5). It should be noted, in this context, that the

coordinates are determined in a system where the x-axis is

increasing from left to right, arid the y-axis increases from top

to bottom in accordance with standard printing notation v;here

vertical deflections increase down the page. This is also the

convention utilized by the Apple II for its graphics displays.

Tlie origin of the coordinate system is located approximately at

the center of the character. Succeeding pairs of coordinates

indicate the next point to be connected to draw the figure. A

coordinate pair of -64 indicates that the next line is not to

be drawn, but the stylus is to be moved to the next location.

Finally, a coordinate pair of -64 -64 completes the figure.

For use on the Apple 11 computer system, we have chosen to

store the characters as strings in a dimensioned array named X?.

In order that the length of any particular string not exceed the

maximum limit of 255 characters alIov>?ed, we have chosen to store

Utility Programs... - 4 -
not the coordinates of the next point, but the offset required to

arrive at that location. In addition, the character numbers have

been deleted. In general, each string consists of a series of

ASCII characters in the format:

W XY ? XY XY XY ? XY XY ? XY

where the first character, W, indicates the width of the

character, the next pair, XY , indicates the offset to the start of

the character, the character, ?, indicates a change of pen status,

etc. In order to obtain the maximum possible flexibility in the

storage of the characters, each character stored is the ASCII

character corresponding to the offset +93 (i.e. an offset of +1 is

stored as CHR$(94)="). In this scheme then, the string

corresponding to the character. A, given by the Hershey vectors

above is stored as:

I ""7YT? ! &? ! t?WZ? !3?!

where the vectors are now stored in a format v/here positive

vertical displacements are in the upward direction. Note that

this technique allows the character to be stored in 22 bytes

whereas the previous representation would require at least 33

bytes even if the foregoing compression scheme v;ere used to

represent pen changes. In addition, the final vectors represent

the offset necessary to advance the pen to the right hand

character limit.

CANDY APPLE

The program for manipulating these Hershey text files is given

in Listing 1 and is written in Applesoft Basic (20). In general,

the program is self-explanatory and menu-driven; it is broken up

into the following sections:

Line numbers Program function

10-199 Main menu and initialization; also

contains the disk assignment routine.

1000-1460 Hershey character input routine using

the tabulated Hershey vectors.

2000-2130 Write font to disk as a text file.

3000-3260 Routines to modify a font.

- 5 - C.E. Dick and J.Hilsenrath
4000-4070

5000-5460

6000-6180

7000-7110

8000-8090

9000-9010

10000-10000

11000-11060

Font hires display index routine.

Font edit routines; also contains cursor

input routines.

Hires routine to display font.

Read font from disk.

Display single character as it is input.

Catalog input disk.

Exit routine.

Hires screen swap routines.

In the following sections, each segment of the program will

be examined in more detail. Although some effort was made to

write the most efficient code, the program was designed to be user

friendly and hopefully to contain as small a number of bugs as

possible. In Listing 2, the variable documentation program of

South Western Data Systems (21) was used to document the usage of

all the variables used in the program. Reference to this listing

will be useful in the following discussions.

Lines 10-999 : THE MAIN MENU AND INITIALIZATION ROUTINES

This section of the program is used to display the main menu

and to determ.ine the disk drives that will be used for both input

and output of the data. Before running the main body of the

program however, the entire program is relocated so that the

computer stores the Applesoft code beginning at memory location

24577 ($6001) using the &LOMEM: utility of Konzen (22) . This

utility shifts the entire Applesoft program and variable space

above the locations that are needed for both pages of the hires

graphics. After this shift, the program initializes the font

array (line 50), pokes a hires shape table into locations 768-777

($0300-$03C9 ) and loads the appropriate hooks to the table on page

0. This shape is used as a cursor for the input of character

vectors in lines 5000-5460. Lines 80-90 input the appropriate

disk drive information and the rest of the section displays the

main menu. The main menu is self-explanatory for the most part,

and contains options that allow the user to CREATE, MODIFY, EDIT,

or DISPLAY a font as well as perform certain disk operations.

Utility Programs... - 6 -
Lines 1000-14^0 : KERSHEY VECTOR INPUT

This section contains the routines to input a character using

the vectors listed by I'^'olcott and Uilsenrath. Initially, hov/ever,

the user is given the choice to input these vectors or to enter

the character using the character edit routines of the 5000

section. The directions given for the Kershey coordinate input

indicate the procedure to follov/ to enter the data. Line 1100 is

used to eliminate the initialization of the character number, L,

if the font is being edited or modified. Line 1120 branches to

the subroutine that draws the hires graphics that illustrates the

character as it is input. The appropriate x- and y-offsets are

entered using the GET command of Applesoft to input a character

string. Inclusion in the string of the left arrov; requires the

re-entry of the entire string. Entering a space for the

horizontal input signals a change of pen position for the

following coordinate move only (the equivalent of :-64 0: in the

Wolcott notation). Entering the symbol, /, for the horizontal

coordinate signals the end of the character (:-64 -64:), and

enters the appropriate vectors to advance the pen to the location

of the right marker. The first two vectors input indicate the

left and right markers respectively, and are used to determine the

character width, w, in line 1350. The previous x and y

coordinates are stored in the variables XT and YT and are used in

line 1370 to determine the current x and y deflections. Line 1400

generates the string by concatenating the current values to the

string X$(L). The rest of this section increments the character

number, L, and continues the input process. These routines are

terminated in one of tv>/o fashions; if the horizontal coordinate is

entered as E, then the current string is set equal to "EOF", and

the user may write the font to the disk or return to the main menu

(lines 1230-1250); if the routine has been called by the EDIT or

MODIFY routines, after the insertion of a single character,

control is returned to the calling routine (line 1160).

- 7 - C.E. Dick and J.Hilsenrath
Lines 2000-2130 : WRITE FONT TO DISK

This section is a standard routine to output the font to the

disk specified by drive number DC. The initial lines of this

routine give the user the option of changing either the filename

or the disk drive number. Ml routines in this program assume

that the disk controller card is inserted in slot #6. After

completion of the write routine, control is returned to the main

menu beginning at line 100.

Lines 3000-3260 : ROUTINES TO MODIFY A FONT

The routines in this section allow the user to modify a font

in a number of ways. The menu for this section (lines 3000-3050)

indicates that the user may APPEND to a font, INSERT a character,

REPLACE a character, REMOVE a character, or EXIT to the display

routine of line 4000. In all modes but EXIT, the font insert

flag, (FI), is set and the font is displayed. if the APPEND mode

is selected, then the character location variable, L, is set to

the end of the font and control is passed to the character input

routine of line 1000- (line 3100). In the INSERT, REPLACE, and

REMOVE modes, the follovv'ing procedures take place;

INSERT (line 3150-) requests the location to insert, LO , moves

all font characters from LO to the end of the font, LMAX, up one

location (line 3170), displays the adjusted font and saves it on

hires page 2 (line 3180) , jumps to the character input routine for

the inputting of one character, displays the new font (line 3220),

and returns to the menu.

REPLACE (line 3230-) requests the character number to replace,

LO, displays the font (line 3210), jumps to the input routine to

input a- character, displays the new font, and returns to the menu.

REMOVE (line 3230-) requests the character number to delete,

LO, moves all characters from LO to the end of the font, LMAX,

down 1 (line 3250), displays the new font (line 3260), and returns

to the menu.

In all of these routines, the current font is saved in the

memory space reserved for the hires page 2 graphics ( $4000-$6000)

by the hires page flip routines of lines 11000-.

Utility Programs...
Lines 4000-4070 : DISPLAY THE FONT DRIVING ROUTINES

The routines of this section are used to display the fonts on

the hires graphics pages. In line 4000, a jump is made to the

disk access routine at 7000 to input the font from the disk if a new filename is used to access the data. The routine of line 4010

displays the font, N$ , character by character, if the memory flag,

MF, is not set. If the memory flag is set, then the font has been

saved on hires page 2, and a call to the memory flip routines at

11000- recalls it for display. Line 4030 returns control to the

calling routine if the font input flag, FI , is set. Otherwise,

the remainder of the routine allows the user to either write the

font to the disk, or return to the main menu.

Lines 5000-5460: THE CHARACTER EDIT ROUTINE

These routines allov*/ the user to edit a character by entering

either the Hershey coordinates or by using a hires cursor input.

Line 5040 displays the entire font and the user is prompted (line

5060), to enter the number of the character to be changed. This

character is then displayed in a magnified version by the routine

of lines 8000-. Figure 2 illustrates this display for the Gothic

letter N. Lines 5070-5120 perform this display by determining the

appropriate x and y coordinates by decoding the string describing

the character. After the character display, line 5125 gives the

user the option of returning to the start of the edit routine if

the wrong character has been selected to edit. Otherwise, the

user has the option of either entering the Hershey coordinates

(lines 1000-) , or redrawing the character using the cursor

control. The cursor control input technique allows the

generation of custom characters by manipulating a high resolution

cursor on the high resolution display. Initially, the user is

requested to enter the limits of the character by defining the

left and right marker locations (lines 5150-5190). The cursor is

then placed on the left marker, and may be moved to the

appropriate location by use of the I, J, K, and M keys of the

keyboard. The current status of the pen is given on the text

display and may be changed at any time by striking the space bar.

- 9 - C.E. Dick and J.Hilsenrath
These cursor moves and the pen position are entered by the GET

input command of line 5250. When the cursor is positioned at the

appropriate position, the return key draws a line (with the

appropriate pen mode) from the previous location to the current

cursor location, enters the values into the character string, and

returns for the next line input (lines 5340-5350). As in the

Hershey input mode, / terminates the character. If the cursor is

not centered at the right marker, vectors are added to the string

to complete this move (lines 5360-5380). After verification of

the validity of the character, the font is displayed and the

routine is terminated if either the font input, FI , or the edit

flag, EF, is set. The remainder of the routine is used to enter

characters under cursor control if the NEW FONT option of the main

menu is being performed. Note also, that the new font is saved by

the page transfer routine of lines .11000-.

Lines 6000-6180 : HIRES FONT DISPLAY ROUTINES

The routines of this section display the members of a font on

hires page 1 depending on their location in the font. Lines

6000-6020 determine the location at which the character is to be

displayed (v;ith 50 characters displayed at a time), line 6030

rem.oves any previously displayed character at that location, and

the remainder of the routine decodes the character string and

draws tlie character. The variables XP and YP are used for the

current cursor location, and DX and DY are used for the offset to

the next location. As always, the penflag, PF, is used to

determine whether the vector is to be plotted with the pen up

(HCOLOR BLACK) or down (HCOLOR WHITE)

.

Lines 7000-7110 : FONT INPUT ROUTINES

The font N$ is inputted from disk drive DI , if it is not

already saved on hires page 2. If the font is to be brought in

from the disk, the mem.ory flag, MF, is reset and the data pointer

is restored. Otherwise, the routine is sta ightf orward and the

file is read until the occurrence of the end of file character

string, EOF. At the completion of the read routine, the file name

is saved in the variable 0$.

Utility Programs... - 10 -
Lines 8000-8090 : FlIRES SINGLE CHARACTER GRAPHICS

These routines drav; the hires single characters that ^re input

either by using the Hershey vectors or the cursor control. Lines

8000-8050 draw the box for the display of the character as

illustrated in Fig. 1. In this representation, each dot

corresponds to one unit in the character. Lines 8060-8090 plot

the figure from the decoded character string values. Line 80^0

sets the magnification, M, to 5, and plots the left and right

boundaries relative to the center of the display ( x=l 40 ,y=80 )

.

Line 8070 sets the next point as the center of the left marker.

Subsequent values of X and Y are then plotted vvith the appropriate

pen control by the remainder of the routine. The current location

is stored in the variables XI and Yl

.

Lines 9000-9010 : CATALOG

This routine lists the catalog of the disk currently specified

as the input disk, DI

.

Line 10 000 : END

This is a standard exit routine.

Lines 11000-11060 : THE HIRES MEMORY FLIP ROUTINE

This routine copies the contents of hires page 1 to hires page

2 or vice versa. The starting address, the ending address, and

the first address of the destination field are read from the data

statement at line 11060. Depending on the state of the memory

flag, J^.F , page 1 is sent to page 2 (MF=0) or vice versa (!^F=1).

The microprocessor's y and x register locations are zeroed by the

POKE statements of line 11030 and the Program Counter is

initialized to point to the Apple Monitor I^iOVE routine ($FE2C)

which is then called by the Apple Monitor GO routine ($FEB5).

- 11 - C.E. Dick and J.Hilsenrath
THE FONTS

The fonts that have currently been converted to the notation

described in this report, are for the most part taken directly

from the tables of Wolcott and Hilsenrath. For convenience, they

are divided up into 32 character segments v;hich v/e have chosen to

name numbers, small, caps, and greek. Figures ? to 8 illustrate

the characters that make up the follov/ing fonts (in each subset,

the characters are numbered from 1 to 32)

:

MATH SYMBOLS... A collection of commonly used symbols in

mathematics taken from the Hershey characters between no.'s 2225

and 2278 (as referenced in the Vs-'olcott and Hilsenrath tables).

CARTO FONT... Numbers ?nci caps are taken fron the Hershey

cartographic symbols from no.'s 1 to 234. Although the Hershey

fonts do not include small letters, these were custom designed and

included as part of this font.

INDEX FONT... The memibers of this font were taken from the complex

index size Hershey characters from no.'s 1001 to 1150.

SIMPLEX FONT... The members of this set were taken from the print

size simplex Hershey characters from no.'s 501 to 551.

COMPLEX FONT... The members of this font were taken from the print

size com^plex Hershey characters from, no.'s 2200 to 2224.

GOTHIC FONT... This set is a mixture of two different Hershey

fonts. The numbers are from the print size gothic Hershey

characters from no.'s 3700 to 3729, while the sm.all letters and

caps are from the Hershey Italian gothic set (no.'s 3901 to 3950)

and the Hershey print size English gothic set (no.'s 3700 to

3750), respectively.

SCRIPT FONT... This font is taken from the print size Hershey

complex script characters from, no.'s 2550 to 2575, 2650 to 2676,

and 2750 to 2776.

Utility Programs... - 12 -
CONCLUSION

Although the fonts that we have stored as text files using

CANDY APPLE are composed mainly of the Hershey characters, it is

possible using this program to custom design graphics symbols. In

the complex caps font illustrated in Fig. 6, the characters

numbered from 28 to 32 are custom designed for logos used at NBS.

This customization can be accomplished either by drawing the

desired figure on graph paper and then calculating the desired

coordinates or by freehand drawing using the cursor input routines

of lines 5000-. The current report illustrates over 700

characters which are stored on disk as text files. Listing 3

gives a catalog of the disk containing the programs CANDY APPLE

and &LOMEI^: as well as the fonts. Reference to this listing shows

that the programs need 36 sectors for storage and the fonts use an

additional 181 sectors leaving more than 270 sectors avaiable for

app] ications programs. Such an application program, CANDY

WRAPPER, is described in Appendix A. Copies of CANDY APPLE,

&LOMEM:, CANDY WRAPPER, and the fonts may be obtained by

contacting the authors at the following mailing address:

C-216, Bldg. 2^5

National Bureau of Standards

Washington, DC 2023 4

- 13 - C.E. Dick and J.Hilsenrath
REFERENCE?

1. A.V. Hershey, "Calligraphy for Computers," NWL Technical

Report No. 2101, August 1967, U.S. Naval Surface Weapons

Center, Dahlgren, VA.

2. A.V. Hershey, "FORTRAN IV Programming for Cartography and

Typography," NWL Technical Report No. TR-2339, Sept..1969,

U.S. Naval Weapons Laboratory, Dahlgren, VA.

3. A.V. Hershey, "Preparation of Reports with the FORTRAN

Typography System," NWL Technical Report No. TN-K/27-70,

September 1970, U.S. Naval Weapons Laboratory, Dahlgren, VA.

4. A.V. Hershey, "Auxiliary Programming for the FORTRAN

Typography System," NWL Technical Report No. TR-2645,

October 1971, U.S. Naval V,^eapons Laboratory, Dahlgren, VA.

5. A.V. Hershey, "A Computer System for Scientific Typography,"

Computer Graphics and Im.age Processing, Vol.1, 373-385

(1972) . 6. A.V. Hershey, "FORTRAN Programming for Surface Wave Trains,"

NWL Technical Report No. TR-2714, September 1972,

U.S. Naval Weapons Laboratory, Dahlgen, VA.

7. A.V. Hershey, "Interpolations of Surface Wave Trains,"

NWL Technical Report No. TR-3064, November 1973,

U.S. Naval Weapons Laboratory, Dahlgren, VA.. S. A.V. Hershey, "Comments on the Lagally Theorem.," NWL

Technical Report No. TR-3133, .May 1974, U.S. Naval Weapons

Laboratory, Dahlgren, V^.

9. A.V. Hershey, "Comments on the Fourier Theorem," NWL

Technical Report No. TR-3145, June 1974, U.S. Naval

Weapons Laboratory, Dahlgren, VA.

]0. A.V. Hershey, "Advanced Computer Typography," Report

NPS012-81-005 , December 1981, U.S. Naval Postgraduate School,

Monterey, CA.

11. P.M. Doyle, "An Adaptation of the Hershey Digitized Character

Set for Use in Computer Graphics and Typesetting,"

Report AD/A-042291, June 1977, U.S. Naval Postgraduate

School, Monterey, CA.

12. N.M. Wolcott and J. Hilsenrath, "A Contribution to Computer

Typesetting Techniques: Tables of Coordinates for Hershey'

s

Repertory of Occidental Type Fonts and Graphics Symbols,"

NBS Special Publication No. 424, National Bureau of

Standards, Washington, DC, 20234.

Utility Programs... - 14 -
13. N.iv!. Wolcott and J. Hilsenrath, "Tables of Coordinates for

Hershey's Repertory of Occidental Type Fonts and Graphic

Symbols," MBS Magnetic Tape 12, January 1977, National

Bureau of Standards, Washington, DC, 20234.

14. N.M. Wolcott, "FORTRAN IV Enhanced Character Graphics," NBS

Special Publication 500-32, April 1978, National Bureau of

Standards, Washington DC, 20234.

15. P.K. Schenk, "Hershey Calligraphy Under the Hewlett-Packard

Graphics Language," a forthcoming NBS report.

16. C.A.E. Kagan, SAr^-76 Technical Note, August 198J , SAM 76 Inc.

Box 257, RRl, Pennington, NJ , 08534

17. D. >iacero, D. Holmes, T. Banks, and L. Burgess, "Graphics II

by Selnar, High Resolution Copy from a DECwriter," BYTE,

Vol .1 , 172-19^ (1982) . 18. DOS 3.3, Copyright 1980, Apple Computer Inc., 10260 Bandley

Drive, Cupertino, CA , 95014. Apple Product #A2LC036.

19. Applesoft Toolkit, Copyright 1980, Apple Computer Inc.,

10260 Bandley Drive, Cupertino, CA, 95014. Apple Product

#A2L0038.

20. Applesoft, Copyright 1978, Apple Computer Inc., 10260 Bandley

Drive, Cupertino, CA, 95014. Apple Product #A2L0006.

21. Apple-doc, Copyright 1979, Roger Wagner, Southwestern Data

Systems, Box 582, Santee, CA, 92071.

22. N. Konzen, "The &LOMEF': Utility," The Apple Orchard, Vol.1,

p. 21 (Far. 1981). Published by The International Apple

Corps., P.O. Box 976, Daly City, CA, 94017. this utility

is 159 bytes in length and is located at locations $0330 to

$03CE. The listing is as follows:

0330- A9 4C 8D F5 03 A 9 40 8D F6 03 A9 3 8D F7 03 60

0340- A9 A 4 20 CO DE 20 67 DD 20 52 E7 A5 67 85 96 A5

0350- BO 85 97 C6 96 38 A5 50 85 94 E5 67 85 50 A 5 51

0360- 85 95 E5 68 85 51 A 5 AF E5 67 A8 A5 BO E5 63 A A

0370- 18 65 95 85 95 C8 DO 01 E8 E8 C8 20 C3 D3 A2 69

0380- 20 CI 03 A2 AF 20 CI 03 A2 67 20 CI 03 A 2 79 20

0390- CI 03 A 5 B9 C9 02 FO 05 A2 B8 2 CI 03 A5 67 A 4

03A0- 65 85 5E 84 5F AO 38 Bl 5E 65 50 91 5E AA C8

03B0- Bl 5E FO CA 65 51 91 5E 86 5E 85 5F 90 E7 4C 6C

03C0- D6 3 8 B5 00 65 50 95 00 B5 01 65 51 95 01 60

•The utility is invoked by the ampersand call SLOMEM: no.

where no. is the first memory location for the relocated

Applesoft program (See Line 20 of Candy Apple).

-15- C.E. Dick and J . Hi 1 sen rath
APPENDIX A

In order to illustrate the use of the character fonts created

by use of the CANDY APPLE program, we have v^ritten a program

named CANDY WRAPPER to place these characters anywhere on the

hires screen. This program is given in Listing 4 and uses some of

the routines developed for CANDY APPLE to decode and plot the

characters. The program is menu driven with the following options

available to the user:

1. Change the disk drives for inputting and outputting

a hires picture.

2. Display the catalog of a selected disk drive.

3. Set the environment for drawing the hires characters.

This option allows the user to select foreground and

background colors from the hires color set.

4. Load a previously saved hires picture from disk.

5. Save a hires picture to disk.

6. Add text to a hires picture.

7. Change from one Hershey font to another.

8. Clear the hires screen.

9. Display the hires screen.

10. Exit the program.

In general, the program is self-explanatory and uses a non-destructive hires cursor to position the start of the Hershey

character on the screen. The program does not clear the hires

screen at initialization so that a previously generated picture

may be left in page 1 for the addition of text. In addition, the

program is relocated to protect the primary hires page. For

convenience, the fonts are read in as 32 character increments

called small, caps, numbers, and greek as stored by the program

CANDY APPLE. Figure 9 illustrates a logo produced by CANDY

WRAPPER as a frontispiece for a listing of CANDY APPLE. This

figure and all others used in this report were produced by a screen dump of the hires graphic page produced by the programs to

a dot-matrix printer.

Utility Programs... - 15 -
Listing 1. Candy Apple program.

10 TEXT : HOME : HTAB (14)1 VTAB (10): PRINT "CANDY APPLE"! REM A HERSHE

Y CHARACTER FILEHANDLER FOR THE APPLE II

20 PRINT CHR$ (4);"ERUN LOMEM:"' S LOMEM: 24576: REM RELOCATES A/S T

START AT $6000 (ABOVE HGR 1 £ 2)

30 BELL$ = CHR$ (7)

40 HOME : HGR : HGR2

50 D$ = CHR$ (4): DIM X$(160): REM SAVE SPACE FOR 5 FONTS OF 32 CHARACTE

RS

60 POKE 763,01: POKE 769,00: POKE 770,04* POKE 771,00! POKE 772,53: POKE

773,36: POKE 774,45: POKE 775.54! POKE 776=07: POKE 777.0! POKE 232,0

O: POKE 233,03: REM LOAD SHAPE TABLE FOR HIRES CURSOR

70 TEXT : HOME ! HTAB (14)! VTAB (10): PRINT "CANDY APPLE": REM START AN

D INIT. DISK DRIVES

80 PRINT BELL$: INPUT "READ FROM DISK DRIVE: "JDi: IF DI C 1 OR DI > 2 THEN

SO

?0 PRINT BELL$: INPUT "WRITE TO DISK DRIVE: "JDO: IF DO C 1 OR DO > 2 THEN

90

100 HOME : REM MAIN MENU

110 PRINT : PRINT "DO YOU WISH TO ": PRINT : PRINT TAB ( 1 )?" 1 . CREATE

A NEW FONT": PRINT : PRINT TAB ( 1 )?" 2 . MODIFY AN EXISTING FONT": PRINT

: PRINT TAB( 10); "3. EDIT FONT CHARACTERS"

120 PRINT : PRINT TAB ( 1 )! "4 . DISPLAY (TRANSFER) A FONT": PRINT : PRINT

TAB( 10); "5. ASSIGN DISK DRIVES": PRINT : PRINT TAB ( 1 )

J " 6 . CATALOG

OF DISK :";di: print : print tae( io)?"7.quit": print bell*: input " WHICH?" ;c

130 IF C < 1 OR C : 7 THEN 100

140 IF C : 4 THEN 180

150 PRINT : PRINT BELL$;: IF N$ < > "" THEN VTAB (23)! PRINT "RETURN US

ES FILENAME! "

', Of

160 VTAB (21): INPUT "FILENAME: ":N$: IF LEN (N$) = THEN N$ = 0$

165 0$ = N$

170 HOME

180 ON C GOTO 999,3000,5000,4000,70,9000,10000

999 HGR2 : TEXT

1000 PRINT "* ROUTINE TO CREATE AN HERSHEY FILE NAME: "JNJ

1010 PRINT BELL$: PRINT "INPUT HERSHEY COOR.'H> OR USE CURSOR CONTROLC

c>?";: GET A$: print a$: if a$ < : "H" and a$ < > "C" then loio

1020 ef = o: IF A$ = "C" then EF = 1 1030 IF EF then 1090

1040 PRINT belli: PRINT "* INPUT THE HERSHEY COORDINATE PAIRS ON THE PROM

PTING BELL " 1050 PRINT : PRINT "* THE CHARACTER READ ROUTINE ASSUMES THAT THE PEN

STARTS IN THE UP POSITION. TO SIGNAL A PEN CHANGE, INSERT A SPACE BE

TWEEN THE COORDINATE PAIRS."

1060 PRINT : PRINT "* TO SIGNAL THE END OF THE CHARACTER INSERT THE DE

LIMITER /"

1070 PRINT : PRINT "# TO SIGNAL THE END OF THE FILE ENTER THE EOF CHARA

CTER <E> .

1080 PRINT : PRINT "* THE FIRST COORDINATE PAIR INDICATES THE WIDTH OF

THE CHARACTER. . .TO ENTER A NULL CHARACTER ENTER 0,0"

1090 PRINT BELL$: PRINT "READY? "J! GET Q$: PRINT Q$: IF Q$ C > "Y" THEN

HOME : GOTO 100

1100 HOME : IF FI THEN 1120

1110 IF C THEN L = 1120 GOSUB 8000: PRINT TAB ( 10 ) J "FILENAME: " J N$ : A$ = "" 1130 PRINT : PRINT TAB ( 1 )

J "CHARACTER STRING NG: " J L! X$ ( L ) = ""!Z = FRE

(0):PF = 1140 IF L = 160 THEN X* = "E": GOTO 1220

17
1 150

1 160

1170

1180

1 1 ?0

1200

1210

1220

12 30

1240

1250

1290

13

1 3 1

1320

13 30

13 40

1350

1360

1370

1330

1390

1400

1410

1420

14 30

14 40

1450

1460

22010

2020

2030

2 4

2050

2060

2070

2030

2090

2100

2110

2120

2130

IF EF THEN Af = "N"t GOSUB 5130' IF EF = THEN Xf = "E"* GCTQ 1220

IF EF AND FI THEN RETURN

IF EF THEN L = L + 1; GQTG 1120

Y 4 — II II » y 4 _ II II FEINT BELLI; TAB ( 5 ) J "HOR . COOR' "

J

FRINT A* It GET Aft IF aI •' > " " AND A* ' : CHR* (13) THEN X* = X

$ + A$: GGTO 1200

IF RIGHTS (X$7l) = CKR$ (3) THEN PRINT BELL$ ' "REINPUT : " : X$ = "": GOTO 1190

IF X$ = "E" THEN XI (L) = "EOF"! PRINT "ND CF FILE..."!: PRINT : LMAX = L

IF XI = "E" THEN PRINT BELLI .? "WRITE TO DISK<W> OR RETURN TO NENU<:n:-

?";? GET Q.I J FRINT Qlt IF 0.1 C > "U" AND Qf -C > "K" THEN 1230

IF Ql = "W" THEN 2 00

IF Ql = "M" THEN TEXT \ GOTO 100

IF XI = "" THEN XI (L) = XKL) + CHRI (127):FF = NOT (PF): PRINT BE

LLi; "PEN CONT.": GOTO 1130

IF XI = ".•''" AND LEN (XI(L)] THEN XI (L) = XI (L) + CHRI (127) + CHRI

CYF - YT + '5''^ + TH^I ^'^'' - VT)' norn id^n

IF XI = "/" AND LEN (XI (D) = THEN FRINT EELLII " ERROR ... REINPUT"

: GOTO 1170

PRINT BELLI5" VERT.COCR:"!

PfTf-IT '^ *

', ! G^T PI* Tp p* ' •_ « " i^TP) p* ' "• ru.vi m "^

'> T'urM v* = v

I + Bi: GOTO 1330

Tp TjTriuT* I'Vt 1 ^ = !^UV* 'O) Turf.i t:i3tmt -pttt.*' "vvTll'or]T • » < y ± - »»> GOTO 132

PRINT

IF LEN (XICD) = THEN XT = 7AL (XI):XF = VAL (YI}:W = ABS ( XF - XT)tYT = O'XI(L) = CHRI (R + 93)1 GOSUB S060t GGTO 1170

XC = VAL (XI)IYC = -• VAL (YD'X = XC - XT: Y = YC - YT; IF ABS (X)

% n'-f op AP-C iv) -V o ••> TUPM rpTMT T5rTT*f "Tn T Atjcr a t> t CPT i/^cMrMT. TMF

UT SMALLER VALUES": GOTO 1170

GOSUB 8030

XT = xc:yt = YC

XKL) = XKL) + CHRI (X -*• 93; ^ CHRI (Y + 93): IF PF = THEN XKL)

= XKL) + CHRI (127):FF = 1 GOTO 1170

PRINT "CHARACTER WIDTH="tW

T3TJTMT pryr*? " ru tv apttp n y ^ » ? » n.-c'^ n*» DprH-r n** jr n* :' -, "V" AMD

Ql <C :• "N" THEN 14 30

IF Ql = "Y" AND FI THEN RETURN

IF Ql = "N" THEN PRINT BELLK "RE- INPUT "t L = L + i: GOTO 1120

TEXT : HOME : PRINT "WRITE TC FILENAME: ";Ni: PRINT "DlSrl DRIVE NO. "' do: PRINT belli: rem put it on DISK DO

PRINT "ARE THESE . K . ^^ "}\ GET Ai: PRINT Ai: IF A* C > "Y" AND Al C

: "N" THEN 2010

IF AI = "Y" THEN 2 50

PRINT belli:; input "filename: ";ni

PRINT belli: : input "WP.ITE to disk DRIVE#"i do: if do 'C 1 OR DO " 2 THEN

2040

PRINT Di:"OPEN ";ni;",d":do

PRINT Dl? "DELETE " ? Nl

PRINT Di: "OPEN "J Nl

PRINT Di: "WRITE "J Nl

FOR I = TO L

PRINT XKI)

NEXT I PRINT Di: "CLOSE "

', Nl

TEXT : GOTO 100

18
3000 TEXT : HOME : PRINT t PRINT "^ROUTINES TO MODIFY A HER5HEY FONT": PRINT

: PRINT TAE( 10 )? "FQNTNAME: " JN$

3010 PRINT : PRINT TAB ( 5);"YQU MAY...": PRINT : PRINT TAB ( 5);"1.APPEN

D TO A FONT"

3020 PRINT : PRINT TAB ( 5)J "2. INSERT IN THE MIDDLE OF A FONT": PRINT : PRINT

TAE( 5) ? "3. REPLACE A CHARACTER"

3030 PRINT : PRINT TAB ( 5)1 "4. REMOVE A CHARACTER": PRINT : PRINT TAB ( 5

^» 11^ FYTT"

3040 PRINT : PRINT EELLJJ TAB ( 5)1 "WHICH"?: INPUT C 3050 IF C : 1 OR C > 5 THEN 3000

3060 IF C = 5 THEN FI = 0:L = LMAX: GOTO 4000

3070 IF FI = THEN FI = i: GOSUB 4000: GOTO 30?0

3030 IF FI AND C > 1 THEN GOSUB 4010

30 90 ON C GOTO 3100,3110,3110,3110

3100 FI = o:c = o:l = lmax: text : home : goto looo

3110 IF MF THEN GOSUB 11000

3120 VTAE (21): PRINT "NOTE ... FIRST CHARACTER IS NO . " 3130 PRINT BELL$J "LOCATION TO "J 3140 ON C - 1 GOTO 3150,3200,3230

3150 PRINT "INSERT"?: INPUT LO: IF LO < OR LO 3 LMAX THEN PRINT EELLt?

"OUT OF RANGE": GOTO 3130

314 LMAX = LMAX + 1 3170 FOR K = LMAX TO LO + 1 STEP - i:X*(K) = X$(K - 1): NEXT K

31S0 FOR L = LO + 1 TO LMAX: GOSUB 6000: NEXT : GOSUB 11000

3190 GOTO 3220

3200 PRINT "REPLACE";: INPUT LO: IF LO C OR LO :> LMAX - 1 THEN PRINT B

ELL4? "OUT OF RANGE": GOTO 3130

3210 GOSUB 11000

3220 L - LO: TEXT : HOME : GOSUB 1010:EF = O: GOSUB iOOO: GOTO 3000

3230 PRINT "DELETE"?: INPUT LQ: IF LO •' OR LQ > LMAX THEN PRINT EELL$:

"OUT OF RANGE": GOTO 3130

3240 LMAX = LMAX - 1 3250 FOR K = LO TO LMAX:X$(P:) = X$(K + 1): NEXT

3260 FOR L = LO TO LMAX: GOSUB 6000: NEXT : GOSUB llOOO: GOTO 3000

4000 GOSUB 7000: REM GET FONT AND DISPLAY IT

4010 HGR : IF MF = THEN FOR L = TO LMAX: HTAB (12): VTAB (24): PRINT

"CHAR.NO. "; L: GOSUB 6000: NEXT L: GOSUB llOOO: GOTO 4030

4020 GOSUB llOOO: IF Hi = Of THEN GOSUB 11000

4 030 IF FI THEN RETURN

4040 VTAB (21): HTAB (10): PRINT N$

4050 PRINT belli; "WRITE TO DISK CVD OR RETURN TO MENU <.:M>"?: GET M \ PRINT

A$: IF A$ C > "W" AND A$ < > "M" THEN 40 5

4060 IF A$ = "W" THEN 2000

4 70 TEXT : HOME : GOTO 100

5000 TEXT : HOME : PRINT : PRINT "^ROUTINE TO EDIT INDIVIDUAL CHARACTERS"

5010 PRINT : PRINT "YOU WILL FIRST BE SHOWN ENTIRE FONT AND THEN ASKE

D TO CHOOSE THE CHARACTER TO EDIT."

5020 PRINT : PRINT "THE CHARACTER WILL BE DRAWN AS IS AND THEN YOU CAN

REDRAW IT BY EITHER INPUT- TING HERSHEY VECTORS OR BY USING THE ED

I TING KEYS.

5030 PRINT BELL$: PRINT "READY?";: GET Af: PRINT A$: IF A$ < > "Y" THEN

5000

5040 FI = i: GOSUB 4000:FI = 5050 VTAB (24)

5060 PRINT belli; "NOTE. . .FIRST CHARACTER IS NO.O": INPUT "CHARACTER NO. T

EDIT?";L; PRINT : IF L

-' OR L > LMAX - 1 THEN PRINT BELLI; "OUT

F RANGE": GOTO 50 6

5070 PRINT : GOSUB SOOO:Xf = "": PRINT TAB( 13); "OLD CHARACTER"

50S0 W = ASC ( LEFT! (X*(L):1)) - 93:XF = W - INT (W / 2 ) : XT = - INT (

19
W / 2): GOSUE so&o

5090 PF = O: FOE J = 2 TQ LEN (X$(L)) STEP 2

5100 X = ASC ( MID$ (X$(L).J, D) - 921 IF X = 34 THEN PF = MOT PF! J = J

-

1 : NEXT

5110 Y = ASC ( MIDf (Xf(L),J + 1,1)) - 93

5120 GOSUE SO so: NEXT J

5125 FEINT "EEADY TO CHANGE"?: INPUT A$: IF A$ 'C > "Y" THEN 5000

5130 FEINT BELL$? "INPUT HEESHEY COQE.CH: OE USE CUESOE'C: ?

" ? t GET Q$: IF

Qf ' > "H" AND Q$ < > "C" THEN 5130

5140 IF Q$ = "H" THEN FI = It GOSUE 1120:FI = O: GOTO 5400

5150 GOSUE SO

5160 PEINT "CUEEENT WIDTH IS " M-n PEINT "LEFT MAEKER AT:"!XT: PEINT "EIGH

T MAEKEE AT: " I XF

5170 PEINT EELL$?"ARE THESE OK-;*":: GET A$: PEINT A*: IF A* C > "Y" AND A

$ C > "N" THEN 5170

5180 IF A$ = "N" THEN PEINT BELL$J: INPUT "LEFT MAEKEE:":XT: PEINT BELLI

;: INPUT "EIGHT maekee: "?xf: R = xf - xt; goto 5160

5190 X$ = CHE$ (W + 93): GOSUE 8060

5200 POKE 33,5: POKE 32.34: PRINT : PEINT " PEN": PEINT "NODE: ": POKE 33

,33: POKE 32,0:PF = 5210 SCALE= i: EOT= 0:X = XI :Y = Yi: DEAW 1 AT X, Y: PEINT : PEINT "I,J,K,

n KEYS MOVE CUESOE U.E:L,D"

5220 PEINT "RETURN ENDS MOVE, / ENDS CHAE."

5230 PEINT "SPACE FLIPS PEN. E ENDS FONT"?: HTAE (37); PEINT CHE* (85 - 17 # PF);

5240 DX = 0:DY = 5250 GET A$: PEINT EELL$;: IF ASC (A$) C 73 OE ASC (Af) > 77 THEN 5320

5260 XDEAR 1 AT X.Y: ON ASC (A*) - 73 GOTO 5230.5290,5300,5300

5270 DY = DY - 1:Y = Y - 5: GOTO 5310

5280 DX = DX - i:X = X - 5: GOTO 5310

5290 DX = DX + i:X = X + 5: GOTO 5310

5300 DY = DY + 1:Y = Y !• 5 5310 DEAW I AT X,Y: GOTO 5250

5320 IF A$ -: > "E" AND A* < > "/" AND A* ,C > " " AND ASC (A$) < > 13

THEN 5 25

5330 IF A$ = " " THEN PF = NOT PF: X$ = X$ + CHRf (127): HTAE (37): PRINT

CHEf (95 - 17 ^f PF): GOTO 5250

5340 IF ASC (A$) = 13 THEN X$ = X$ + CHE* (DX + 93) h- CHE$ (93 - DY): IF

PF THEN HPLOT XI, Yl TO X, Y

5350 IF ASC (A$) = 13 THEN XI = X;Y1 = Y: GOTO 5210

5360 IF A* = "/" THEN X?(L) = X$: IF PF = 1 AMD XI C > 140 + M * XF AND

Yl •: > 80 THEN Xf(L) = X$(L) + CHE$ (127) + CHE$ (XF + (140 - XI) /

5 + 93) + CHR$ ((Yl - SO) / 5+93)

5370 IF A$ = "/" AND LEN (XKD) = 1 THEN X*(L) = X$(L) + CHE$ (127) + CHR$ (93) + CHEI (93)

5380 IF A$ = "/" THEN PEINT EELL$: PEINT "CHAEACTEE O.K.?";: GET Q$: PEINT

Q$: IF Q$ < y "Y" AND Q$ < > "N" THEN 5 3S0

5390 IF Q$ = "N" THEN 5150

5400 POKE 33, 40: GOSUE llOOO: GOSUE 6000: GOSUE 11000

5410 IF M = "/" AND (FI OR EF ) THEN RETURN

5 4 20 IF A$ = "E" AND EF THEN EF = O: RETURN

5430 PRINT EELL*? "FINISHED EDITING?"?; GET A?: PRINT A$: IF A$ < > "Y" AND

A$ < :• "N" THEN 5 4 30

5440 IF A$ = "N" AND FI THEM FI = O: GOTO 5060

5450 IF A$ = "N" THEN FI = i: GOSUE 40 10* FI = O: GOTO 5060

5460 L = LMAX:X$ = "E": PRINT " E"?: GOTO 1220

6000 HCOLOE= 01 Z = L - 50 * INT (L / 50): IF (Z / 50) = INT (Z / 50) AND

(L y 0) THEN PEINT BELL$ ? " STEIKE ANY KEY TO CONTINUE..."?: GET Q«: HGR

; EEM DISPLAY ROUTINE ' 6010 IF LEN (X$(L)) = THEN RETURN

20
6020 XF = 2S0 ^^ (Z / 10 - INT C / 10));YP ^ 32 * IMT (Z / 10) + 16

4030 FOE I = 1 TO 14; SCALE= i: DRAW 1 AT XP + 14, YF! NEXT : HCOLOE= 3

604 W = ASC ( MIDf (X$(L):1,1}) - ?3

6050 XP = XF + INT ( ( 2S - W) / 2)

6 60 IF W = THEN HCOLOR= 6:XP = XP - 5tDX = 10

6070 IF W = THEN HFLQT XP , YP TO XP + DX, YP

60S0 HCOLOR= 3* PF = 6090 FOE J = 2 TO LEN {Xf(L)) STEP 2 6100 DX = ASC ( MIDf ( X$ ( L) , J, 1 )

)

6110 DY = ASC ( MIDI (X$(L),J + 1,1))

6120 IF DX = 127 THEN PF = NOT (PF):j = J - It NEXT J 6130 DX = (DX - 93):DY = (DY - 93)

6140 IF LEN (X$(L)) C 5 THEN HCOLOE= 5 6150 IF PF THEN HPLOT XP.-YP TO XP + DX,YP - DY

6 160 XP = XP + dx:yp = YP - dy: next J 6170 HOME I VTAB 21

6130 RETURN

7000 HOME : IF N$ = 0$ AND MF = 1 THEN RETURN : REM READ FROM DISK DI

7010 PRINT "NOR READING FILE FROM DISK #"?DI

7020 IF FI THEN PRINT ! PRINT "ENTIRE FONT WILL EE DISPLAYED"

7030 MF = O: RESTORE

7040 PRINT D$J"OPEN "JN$;",D"?D1

7050 PRINT D$;"READ ";N$

7060 1=0

7070 INPUT X$(I)

7080 IF X$(I) = "EOF" THEN 7100

7090 I = I + i: GOTO 7070

7100 PRINT Df; "CLOSE "JN$

7110 LMAX = i:0$ = N$: RETURN

8000 HGR t HCOLQR= 5: HFLOT 65,5 TO 215,5 TO 215,155 TO 65,155 TO 65,5: REM

EDIT GRAPHICS ROUTINES

SOlO HCOLOR= 6: HPLOT 140,5 TO 140,15! HPLOT 140,145 TO 140,155: HPLOT 65

,30 TO 75, so: HPLOT 20 5,80 TO 215,30

8020 HCOLOR= 3: FOR J = 10 TO 150 STEP 5: FOR K = 70 TO 210 STEP 5! HPLOT

K, J: NEXT : NEXT

8030 HPLOT 140,73 TO 140,32: HPLOT 138,30 TO 142,30

80 4 VTAB (24)

8 50 RETURN

8060 M = 5: HCOLOR= 3: HPLOT 140 + M # XT, 75 TO 140 + M * XT, 35: HPLOT 140

+ XF # M, 75 TO 140 + XF ^ M, 35

3070 XI = 140 + M # XT:Y1 = SO: RETURN

8080 if pf then hplot xi, yl to xi + m » x,y1 - m # y

3090 xi=xi+m*x:yi=yi-m*y: return

9000 text : home : print d$ j "catalog, d

" j di

9010 print : print belli ?" strike any key to continue"?: get a*: goto 100

10000 home : print eell$j"nice working with you": end

11000 read f%,l%,d%: rem memory locations for move

11010 fh% = f% / 256: fl% = f% - 256 * fh%: lh% = l% / 256: ll% = l% - 256 * LH%:DH% = D% / 256: DL% = J}% - 256 * DH%

11020 POKE 60,FL%: POKE ':,lrFU%: POKE 62,LL%: POKE 63,LH%: POKE 66,DL%: POKE

67,DH%

11030 POKE 70, O: POKE 71, O: POKE 53,44: POKE 59,254: REM SETUP YREG, XREG

P^L P'^H

11040 CALL - 327: MF = NOT MF: IF MF = THEN RESTORE

11050 RETURN

11060 DATA 3192,16383,16334,16334,24575,3192

3

21
Listing 2. Candy Apple variable listing

^ CANDY APPLE *

* --MABLE OF VAEIAELES'-- *

* ?;-

A« - ANSWER STRING- -ALSO USED TO ENTER HEESHEY X COORDINATE

1010 1010 1010 1010 1020 1120 1150 1200 1200 1200 1200 1200 2010

2010 2010 2010 2020 4050 4050 4050 4050 4060 5030 5030 5030 5125

5125 5170 5170 5170 5170 51S0 5250 5250 5250 5260 5320 5320 5320

5320 5330 5340 5350 5360 5370 53S0 5410 5420 5430 5430 5430 5430

5440 5450 9010

Ef - STRING USED TO ENTER HERSHEY Y COORDINATE

1330 1330 1330 1330 1330

BELL$ - CHR$(7) SOUNDS SPEAICER

30 SO 90 120 150 1010 1040 1090 1190 1210 1230 1290 1310 1320

134 137 14 30 14 50 20 20 30 20 4 30 4 3130 3150 32 00 323 4 050

5030 5060 5060 5130 5170 5130 5180 5250 5330 5430 6000 9010

10

C - NUMERICAL CHOICE INPUT

120 130 130 140 ISO 1110 3040 3050 3050 3060 3030 3090 3100

3140

D$ - CHR$(4) DOS CONTROL

50 2050 2060 2070 2030 2120 7040 7050 7100 9000

D% - DESTINATION ADDRESS FOR MEMORY MOVE

11000 11010 11010

DH% - DESTINATION HIGH BYTE

11010 11010 11020

DI - DISK DRIVE FOR INPUT

30 30 SO 120 70 10 7040 9000

DL% - DESTINATION LOW BYTE

11010 11020

DO - DISK DRIVE FOR OUTPUT

90 90 90 2000 2040 2040 2040 2050

DX - INCREMENTAL X

5240 5280 5280 5290 5290 5340 6060 6070 6100 6120 6130 6130 6150

6 1 6 DY - INCREMENTAL Y

5240 5270 5270 5300 5300 5340 6110 6130 6130 6150 6160

EF - EDIT FLAG 0= NO EDIT 1=EDIT UNDERWAY

22
1020 1020 1030 1150 1150 lliO 1170 3220 5410 5420 5420

F% - STARTING ADDRESS FOR MEMORY MOVE ROUTINE

11000 11010 11010

FH% - STARTING ADDRESS HIGH BYTE

11010 11010 110 2

FI - GENERAL PURPOSE FONT INPUT FLAG

1100 1160 1440 3060 3070 3070 3080 3100 4030 5040 5040 5140 5140

5410 5440 5440 5450 5450 7020

TL% - STARTING ADDRESS LOW BYTE

11010 110 2

I - GENERAL INDEX

2090 2100 2110 6030 6030 7060 7070 7030 7090 7090 7110

J - GENERAL INDEX

5090 5100 5100 5100 5110 5120 6090 6100 6110 6120 6120 6120 6160

3020 3020

K - GENERAL INDEX

3170 3170 3170 3170 3250 3250 3250 S020 S020

L - INDEX FOR LOCATION IN FONT

1110 1130 1130 1140 1170 1170 1220 1220 1290 1290 1300 1300 1300

1310 1360 1360 1400 1400 1400 1400 1460 1460 2090 3060 3100 31S0

3220 3260 4010 4010 4010 5060 5060 5060 5030 5090 5100 5110 5360

5360 5360 5370 5370 5370 5460 6000 6000 6000 60 10 6040 6090 6100

6110 614

L% - ENDING ADDRESS FOR MEMORY MOVE ROUTINE

11000 11010 11010

LH% - ENDING ADDRESS HIGH BYTE

11010 11010 11020

LL% - ENDING ADDRESS LOW BYTE

11010 11020

LMAX - LOCATION OF EOF CHARACTER--MAXIMUM CHARACTER IN FONT

1220 3060 3100 3150 3160 3160 3170 31S0 3200 3230 3240 3240 3250

3260 4010 5060 5460 7110

LO - LOCATION TO INSERT, REPLACE, ETC

.

3150 3150 3150 3170 3180 3200 3200 3200 3220 3230 3230 3230 3250

3260

M - MAGNIFICATION FOR HIGH RES ROUTINES

5360 8060 3060 3060 3060 3060 3070 3030 SOSO 3090 3090

MF - MOVE FLAG 0=XFER FROM PI TO P2 1=XFER FROM P2 TO PI

3110 4010 7000 7030 11040 11040 11040

N$ - FONT NAME (CURRENT)

150 160 160 160 165 1000 1120 2000 2030 2050 2060 2070 2030

2120 3 00 4 20 4 4 700 70 4 7 50 710 7110

0$ - FONT NAME (PREVIOUS)

23
150 160 U5 4020 7000 7110

PF - PEN FLAG 0=PEN UP 1=PEN DOWN

1130 1290 1290 1400 1400 5090 5100 5100 5200 5230 5330 5330 5330

5340 5360 6OS0 6120 6120 6150 S080

Q$ - STRING FOR QUESTION ANSWERS

1090 1090 1090 1230 1230 1230 1230 1240 1250 1430 1430 1430 1430

1440 1450 5130 5130 5130 5140 53S0 5330 53-30 53S0 5390 6000

W - LENGTH (WIDTH) OF CHARACTER IN FONT

1360 1360 1420 50S0 5080 50S0 50S0 5160 5180 5190 6040 6050 6060

6 070

X - X LOCATION IN CHARACTER COORDINATE SPACE

1370 1370 1400 5100 5100 5210 5210 5260 5280 5280 5290 5290 5310

5340 5350 3080 8090

X$ - STRING CONTAINING CURRENT CHARACTER

1140 1150 1180 1200 1200 1210 1210 1220 1230 1290 1300 1310 1360

1370 5070 5190 5330 5330 5340 5340 5360 5460

X$(*) - STRING ARAY FOR FONT

50 1130 1220 1290 1290 1300 1300 1300 1310 1360 1360 1400 1400

1400 14 00 2100 3170 3170 3250 3250 5080 5090 5100 5 110 5360 5360

5360 5370 5370 5370 6010 6040 6090 6100 6110 6140 7070 7080

XI - HIRES X LOCATION

5210 5340 5350 5360 5360 3070 8080 8080 8090 8090

XC - CURRENT X COORDINATE VALUE

1370 137 139

XF - FINAL X COORDINATE OF CHARACTER

1300 1360 1360 5080 5160 5180 5180 5360 5360 3060 8060

XP - HIRES X POSITION

6020 6030 6050 6050 6060 6060 6070 6070 6150 6150 6160 6160

XT - TEMPORARY X COORDINATE

130 136 136 1370 139 50 8 5160 5130 5180 80 6 30 6 8 70

Y - Y LOCATION IN CHARACTER COORDINATE SPACE

1370 1370 1400 5110 5210 5210 5260 5270 5270 5300 5300 5310 5340

5350 3030 3090

Y$ - CURRENT Y COORDINATE STRING FOR INPUT

1180 13 3 13 3 13 40 13 4 13 6 1370

Yl - HIRES Y COORDINATE

5210 5340 5350 5360 5360 8070 8080 SOSO 8090 8090

YC - CURRENT Y COORDINATE

1370 13 70 139

YP - HIRES Y POSITION

6020 6030 6070 6070 6150 6150 6160 6160

YT - TEMPORARY Y COORDINATE

1300 1360 1370 1390

24
1 - CHAHACTER INDEX FOE DISPLAY RQU7IN]

1130 iOOO 6000 dOOO i020 6020 6 020

EHD OF VAE. LIST

25
Listing 3. Catalog of Candy Apple disk

DISK VOLUME 254

^A 033 CANDY APPLE

<-E 00 3 LQf'IEIi:

^T 00^ MATH SYMBOLS

*T 00 4 CAETQ NUMBERS

^T 005 CARTO SHALL

s^T 005 CARTO CAPS

*T 007 INDEX NUMBERS

*T 00? INDEX SMALL

ST 03 INDEX CAPS

<^T 0? INDEX GREEK

#T 005 SIMPLEX NUMBERS

*T 006 SIMPLEX SMALL

*T 005 SIMPLEX CAPS

«-T 00 6 SIMPLEX GREEK

:^T 007 COMPLEX NUMBERS

*T 00? COMPLEX SMALL

»T 00? COMPLEX CAPS

*T 010 COMPLEX GREEK

*T 003 SCRIPT NUMBERS

*T 00? SCRIPT SMALL

*T 012 SCRIPT CAPS

*T 010 GOTHIC NUMBERS

*T Oil GOTHIC SMALL

i^T 020 GOTHIC CAPS

A 3 5 C A 2

*T 007 CANDY APPLE VFILE

26
Listing 4. Candy Wrapper program.

10 TEXT : HOME : HTAB (14)* VTAE (OS) I PRINT "CANDY WRAPPER"

20 PRINT CHE« ('^)r"BRUN LOMENt"* 2. LQMEM: 1.63S4: REM RELOCATES A/S TO

START AT $4000 (ABOVE HGR 1)

30 EELL$ = CHR$ (7)

40 Dl = CHRf (4): DIM X*(160): REM SAVE SPACE FOR 5 FONTS OF 32 CHARACTE

RS

50 DEF FN A(A) = SI 92 + 4 * INT (A / 6 4) •^ 123 * INT ((A - 64 * INT

(A / 64)) / S) + 10 24 ^^ (A - S * INT (A / S))

60 POKE 76S,0i: POKE 76'?, OO: POKE 770,04: POKE 771,- OO: POKE 772,53! POKE

773.36: POKE 774,45: POKE 775,54: POKE 776,07: POKE 777, O: POKE 232,0

O: POKE 233,03: REM LOAD SHAPE TABLE FOR HIRES CURSOR

7 ONERR GOTO 12000

30 X = 139: Y = ?5:ff = 90 TEXT : HOME : HTAE (14): VTAE (OS): PRINT "CHARACTER PLOT"

100 PRINT BELL*: INPUT "READ FROM DISK DRIVE: "JDI; IF DI :: 1 OR DI ; 2 THEN

100

110 PRINT belli: INPUT "WRITE TO DISK DRIVE: "J DO: IF DO C 1 OR DO > 2 THEN

110

120 PRINT belli: INPUT "FONTS FROM DISK DRIVE: "JDF: IF DF : 1 OR DP : 2 THEN

120

130 TEXT : HOME : HTAB (10): VTAE (06): PRINT "OPTIONS..."

140 PRINT : PRINT "1. CHANGE DISK DRIVES": FEINT "2. CATALOG DISK": FEINT

"3. SET ENVIRONMENT"

150 PRINT "4. LOAD HIRES PIX": PRINT "5. SAVE HIRES FIX": PRINT "6. ADD T

EXT TO FIX": PRINT "7. CHANGE FONT": PRINT "S. CLEAR HIRES SCREEN": FEINT

"9. DISPLAY CURRENT PICTURE": PRINT "10. QUIT"

160 PRINT belli: INPUT "WHICH--: "?C: IF C : 1 OR C y 10 THEN 160

170 ON C GOTO 90,1000,3000,2000,2000,3000,4000,5000,6000,7000

1000 TEXT : HOME

1010 PRINT "WHICH DRIVE ",»: INPUT D

1030 PRINT DI5 "CATALOG, D"J D 1040 PRINT : PRINT BELLI ,'" STRIKE ANY KEY TO CONTINUE"?: GET A$: GOTO 130

2000 HOME : HTAB (5): VTAB (10): INPUT "FILENAME OF P ICTUEE-- >" ? Nl

2010 ON C - 3 GOTO 2020,2030

2020 HGR : POKE - 16302, 0:X = 139:Y - 95: PRINT D$:"ELOAD " J N$ ,* ", D " : DI : FOE

I = 1 TO 2000: NEXT : GOTO 130

2030 PRINT Di:"BSAVE ";NI;",A$20 , LI 2000

,

D " J DO

2040 PRINT DI,'"LOCK "JNi: GOTO 130

3000 IF FF = THEN PRINT "NEED FONTS TO CONTINUE...": FOR I = 1 TO 1000

: NEXT : GOTO 400

3010 TEXT : HOME : PRINT "PROCEDURE TO ADD TEXT TO PICTURE"

3020 PRINT : PRINT "1. INPUT TEXT TO ADD": PRINT "2. POSITION CURSOR USIN

G I,J,K,M KEYS": PRINT "NOTE: KEY MAY BE PRECEEDED EY A NUMBER, E.G.

501 MOVES 50 SPACES EIGHT."

3030 print' "3. STRIKE CTRL-P TO PRINT TEXT": PRINT "4. CESCy TO RETURN TO

MENU, 'SPACE> TO CHANGE TEXT."

3040 PRINT : PRINT "STRIKE ANY KEY TO START-->",': GET A$: IF ASC (AD = 27 THEN 130

3050 GOSUE 20000

3060 SCALE= i: EOT= O: HCOLOR^ 7: POKE - 16304, O: POKE - 16297, O: POKE

- 16302,0

3070 z = o:zi = "0": gosue 25000: draw 1 at x,y

30S0 GET Ai: PRINT BELLI: IF (Al : ",") AND ( Al < > ".") AND (Al C ":") THEN

zi = zi + A$:z = VAL (zd: goto 3080

3090 IF ASC (Al) k 73 OR ASC (Al) > 77 THEN 3190

3100 GOSUB 30 00 0: FOR I = TO Z: IF (X > 10) AND (X ' 270) AND (Y > 10) AND

(Y < 132) THEN ON ASC (A$) - 72 GOTO 3110,3130,3150,3150,3170

3110 Y = Y - i: IF Y = 10 THEN Y = 11

27
?120

3130

3140

3150

3160

3170

3180

3190

3200

3210

3220

4000

4010

4020

4030

4040

4050

4060

4070

4030

4090

4100

4110

4120

4130

4140

4150

4160

4170

4130

4190

4200

4210

4220

4230

4240

4250

4260

4270

4230

4290

4300

4310

4320

4330

4340

5000

6000

7000

NEXT

X = X

NEXT

X = X

NEXT

Y = Y

NEXT

IF (

i:+

i:+

i:

THEN X = 11

THEN X = 269

= 131

i: GOTO 3070

- i: IF X = 10

GOTO 3070

i: IF X = 270

GOTO 3070

i: IF Y = 132 THEN

GOTO 3070

ASC (A$) C y 16) AND ( ASC (A$)

7) THEN 3070

IF ASC (A$) = 27 THEN 130

IF ASC (A$) = 32 THEN 3000

GOSUB 30000: GOSUE 22000: GOTO 3000

REM LETTER FONTS

HOME

PRINT TAE( 10);:

: PRINT TAB( 11)

PRINT TAE( 10);"

TAE( 10)? "<3:

TAE( 10); "<5:

) AND ( ASC (A$)

PRINT :

: NORMAL

PRINT :

: PRINT

: PRINT

: PRINT

I = 1 N$ = " NUMBERS": PRINT : INPUT "NUMBER

N < 1 OR N > 6 THEN PRINT "EEINFUT

GOSUE 4140:

m = " CAPS": PRINT

N ': 1 OR N > 6 THEN

INVERSE : PRINT "INPUT LETTER FONTS": PRINT

"FONTS available: " 1> INDEX": PRINT TAE( 10)?"C2> SIMPLEX"

COMPLEX": PRINT TAB ( 10); "^4> CARTOGRAPHIC"

SCRIPT": PRINT TAB( 10);"<:6:> GOTHIC": PRINT

FONT

" ' nnrt

<1-6M

4 50

";n:n = INT (N): if

INPUT "UPPER CASE FONT <l-6:

POKE "EEINPUT "?: GOTO 4070

"!m:n = INT (n: IF

GOSUB

N* =

" IF N < GOSUE

N$ =

"

< 1 OR

GOSUE

PRINT

4210

4140

SMALL":

1 OR N

4140

GREEK":

N >

PRINT INPUT "LOWER CASE FONT a-6::";N:N = INT (N)

6 THEN PRINT "EEINPUT GOTO 4 90

PRINT : INPUT "GREEK FONT C1-3>:";n:N = THEN PRINT "REIKPUT ";: GOTO 4 110INT (N): IF N

4140

:N$(5) = "MATH SYMBOLS": PRINT N$(5);" ALSO BEING LOADED"-: GOTO

N

N

N

N

N

N

IF

IF

IF

IF

IF

IF

N$(I)

PRINT

FOR I FOR I OLS"

N = o: PRINT

PRINT

= 1 THEM

THEN

THEN

THEN

THEN

THEN

N$(I) + FLASH

1 TO 2 3 TO 4

N$il) = "INDEX"

N$(I) = "SIMPLEX"

N$(I) = "COMPLEX"

N$(I) = "CARTO"

N$(I) = "SCRIPT"

N$(I) = "GOTHIC"

N$: I = I + i: RETURN

: PRINT "NOW LOADING FONTS":

: PRINT N$(i ); " "; : next

: PRINT N$(i); " "; : next

NORMAL

i: PRINT

i: PRINT PRINT "MATH SYME

FOR

D$;

D$;

I = 1 TO 5

OPEN ";N$(I)

READ ";N$(I)

FOR JJ = 1 TO 32

INPUT X$(N)

N = N + 1 NEXT JJ

PRINT D$; "CLOSE

D " ; DF

";n$(I)

NEXT

HOME

GOTO

HGR ; POKE

HOME

i:ff = 1

130

GOTO 130

- 16304, O: POKE - 16302, O: GET A$: GOTO 130

: PRINT BELLI? "NICE WORKING WITH YOU"? END

28
<^<^f)0 TEXT : HOME : PRINT "SET DRAWING ENVIRONMENT '"J BF = O'DP = 8010 PRINT : PRINT "COLORS AVAILABLE..."

8020 PRINT "0. ELACKl": PRINT "1 . GREEN"! PRINT "2. VIOLET": PRINT "3. W

HITEl": PRINT "4. BLACK2": PRINT "5. ORANGE"t PRINT "6. BLUE": PRINT

"7. WHITE2"

8025 PRINT "8. NONE -- BACKGROUND ONLY"

8030 PRINT : INPUT "BACKGROUND COLOR; "fBC: IF BC < OR BC > 7 THEN BF = i:bc = 8040 PRINT : INPUT "FOREGROUND COLOR: "JFC: IF FC < OR PC > 7 THEN 8040

8045 PRINT : INPUT "SINGLE<1> OR D0UBLE<2> PREC ISION! " J N: IF N ^C 1 OR N >

2 THEN 8045

8048 IF N = 1 THEN 8060

8050 DP = i: PRINT : INPUT "CONTAST COLOR:" J CC: IF CC < OR CC > 7 THEN 8

050

8060 GOTO 130

11000 READ F%,L%,D%: REM MEMORY LOCATIONS FOR MOVE

11010 FH% = F% / 256:FL% = F% - 256 * FH%:LH% = L% / 256:LL% = L% - 256 * LH%:DH% = D% / 256: DL% = D% - 256 # DH%

11020 POKE 60.FL%: POKE 61,FH%: POKE 62,LL%: POKE 63, LH%: POKE 66,DL%: POKE

67,DH%

11030 POKE 70, O: POKE 71, O: POKE 53,44: POKE 59,254: REM SETUP YREG, XREG

,PCL,PCH

11040 CALL - 327: MF = NOT MF: IF MP = THEN RESTORE

11050 RETURN

11060 DATA 8192,16383,16384,16384,24575,8192

12000 REM ERROR HANDLING ROUTINES

12010 GOOF = PEEK (222)

12020 PRINT : PRINT BELL$; "ERROR NO. "J GOOF?" ENCOUNTERED": PRINT "ERROR H

ANDLER ACTIVE. .. "J BELL$: FOR Z = 1 TO lOOO: NEXT

12030 IF GOOF = 53 THEN PRINT : PRINT BELL$;"NEED FONTS TO CONTINUE" J BEL

L$: FOR Z2 = 1 TO lOOO: NEXT ZZ:B$(J + 6) = E$(J): HOME :e$(J) = "F":

GOSUB 3000: RESUME

12040 IF (GOOF = 5) OR (GOOF = 6) THEN PRINT "FILE NOT FOUND": FOR ZZ =

1 TO 2000: NEXT : GOTO 130

12060 IF GOOF = 9 THEN PRINT BELL$?"DISK FULL, INSERT NEW DISKETTE" J BELL$

12070 IF GOOF = 10 THEN PRINT BELL$ ?" WARNING !! , ";N$J" IS LOCKED": PRINT

"DO YOU WISH TO DESTROY OLD FILE"?: INPUT A$: IF LEFTS (A$.l) = "N" THEN

GOTO 130

12080 IF LEFT$ (A$,l) = "Y" THEN PRINT D$: "UNLOCK "JN$

12090 IF GOOF = 255 THEN STOP

12100 RESUME

20000 REM #** TEXT GENERATOR *** 20020 PRINT : PRINT "CHARACTER STRING: "MLC = 0:SC = 0:R$ = "" 20050 PRINT BELL*;: GET T$: IF T* = CHR$ (13) THEN LC = O: NORMAL : GOTO

20110

20060 IF T$ = CHR$ (7) OR Tf = CHE$ (19) THEN FLASH : R$ = R$ + T$:SC =

i: GOTO 20050

20070 IF T* = CHR$ (27) THEN LC = NOT (LO: GOTO 20050

20080 IF NOT ( LC ) AND NOT (SO THEN INVERSE

20090 IF LC AND NOT (SO AND ASC (T$) > 63 THEN NORMAL : T$ = CHR$ ( ASC

(T$) + 128)

20100 PRINT T$;:R* = R$ + CHR$ ( ASC (T$)):SC = O: GOTO 20050

20110 PRINT : PRINT BELL?: INPUT "SIZE :";iw:iw = INT (iw): IF iw : 1 OR

IW J 10 THEN PRINT BELL$ J "REINPUT :":: GOTO 20110

20130 PRINT BELL$: INPUT "HORIZ.CH> OR VERT.<V> CHARACTERS ?":L$: IF Lf C

> "H" AND L$ < > "V" THEN PRIN'

20140 IV = O: IF L$ = "V" THEN IV = 06

29
20130

20190

22000

22010

22020

220 3 22040

2 2050

22060

22070

22030

22090

22100

22110

22120

22130

22140

22150

22160

22170

22130

22190

2 22

22210

22215

'?'?220

22240

22250

23000

23010

23020

2 3 30

23032

ERROR -RE INPUT Ri =

IF LEN (R$) = THEN PRINT EELL$ ! "ERROR-REINPUT!

RETURN

REM TEXT STRING DECODER

HCOLOR^ Bc: SIZE = o: W = PRINT I PRINT : FOR IC = 1 TO LEN (R$)

p* = MiDf (R$,ic,i):p = Asc (Pf): if P ^ 7 QR P = 1:P$ = MID$ (R$; IC, 1)

REM *** MAKE HERSHEY VECTORS

IF P$ = "" THEN PRINT EELLf?

L = ASC (P$) - 32

IF(P=70RP=i9) AND (L > IF P = 7 THEN L = L + 64

IF P = 19 THEN L = L + 96

IF L > 159 THEN L = L - 96

Xi = X$ (L)

IF SIZE = THEN 23000

PF = O: HCOLOR= FC

FOR G = 2 TO LEN (X$(L)) STEP 2 DX = ASC ( MID$ (X$(L),G, 1 ) ) - 9 DY = ASC ( MID$ (X$(L), G + 1,1))

IF DX = 34 AND LEN ^ y« / t m ^ IF DX = 34 THEN G =

GOTO 20030

19 THEN IC = IC +

GOTO 20030

95) THEN L = L - 123

(Xf (L) ) > 4 G - i: NEXT

^ THEN PF = NOT (PF)

DX = DX * IW:DY = - DY * IW

IV > THEN TEMP = DXIDX = DYtDY

PF THEN HPLOT X, Y TO X + DX, Y + PF AND DP THEN HCOLOR= CCIX = X - 1 Y = Y + DY

X

IF

IF

IF

X = X = NEXT G

NEXT IC

FOR I = 1 TO 200 0: NEXT t RETURN

W = W + ( ASC ( LEFTS (XI, D) - 93) * IF IV = AND X + W :> 273 THEN 23040

IF IV > AND Y - M <: 2 THEN 230 40

NEXT ICtSIZE = i: IF EF THEN 22020

FOR I = - 15 TO 15:

* IW: NEXT

DY

+ 1

TEMP

HPLOT X, Y TO X + DX. Y + DY

X + DX!

IF IV = THEN

+ W # I W , Y + I 23034 IF IV > THEN FOR I

== 15 TO 15: HPLOT X ^ I *

]: * iw,Y - 2 - W * IW: NEXT

23036 GOTO 22 020

230 4 TEXT : HOME : PRINT "TEXT TOO LONG.. "JEELL$?BELL$:

25000 YU = FN A(Y - 1 ) : YM = FN A ( Y ) : YL = FN A ( Y + 1 ) 25010 XC = INT (X / 7) - 1 25020 FOR I = TO 2 25030 U(I) = PEEK (YU + XC + I)

25040 M(I) = PEEK (YM + XC + I)

25050 L(I) = PEEK (YL + XC + I)

25060 NEXT I 25070 RETURN

30000 FOR I = TO 2 30010 POKE YU + XC + I , U ( I ) 30020 POKE YM + XC + I,M(I)

30030 POKE YL + XC + I, L(I ) 30040 NEXT I 30050 RETURN

IW

HPLOT X - 2, Y + I * IW TO X +

IW, Y + 2 TO X +

GOTO 3020

30
t""

r

Character Matri:

13,-:

±: Csrto A Hershey Char No . 1

Fig.l. Cartographic letter A showing coordinate system,

31
i.i.: Gothic N Herjhey Char. No. 35 14

Fig. 2. Hires display of English gothic N,

32
±^x -t-

^ = <><

^ +

Math Symbols

. - . / 1 2 3

4 6 6 7 6 9: ; <

> ?

Carto Humbert

ahcdefgh

fn n p q

r st u u lu ii y 3

Csrto Small

^ABCDEFGH I JKLMN0PQR5

TUVWXY2^Hr±

Carto Caps

Fig. 3. Math symbols and Carto fonts.

33
*+,-./0i23

456789: ;<-

> ?

Index Number:!

""abcdefghi

j klmnopqr s

tuvwxyz tl \

Index Small

@ABCDEFGHI

JKLMNOPQRS

TUVWXYZ a 13 ±

f ^

Inde:-: Caps

K X fi V ^ Q rr p (J T

i; 9? X

i// 0) S n A A r

(w| ^

Indis;; Greek

Fig. 4. Index font.

34
456789: ;< =

Simplex Humbers

Oabcdefgh I

j k imnopqrs

tu vwxyz^O

Simplex Small

@ ABCDE FGH I JKLMNOPQRS

TUVWXYZ ^ ^ ±

/

DO

Simplex Caps

Q a ^ y 6 z ^ Tj-d- L

tcl\ fjLV f OTvpar

V (f xi^ cj I n A T r

OX

Simplex Greek

Fig. 5. Simplex font.

35
456789 : ; < =

>?

C rn pie x M u rn b e r s

° abode fghi

j k Imn o p q r s

tuvwxyz t$ \

H

Complex Small

ABCDEFGHI

JKLMNOPQRS

TUVWXYZcR.sB.<^

Complex Caps

Qa p y 6 £ ^

rfd- t

fc XjJiv f rrp u r

V (p ^(^'^wSnAS r

0X'

Complex Greek

Fig. 6. Complex font.

36
•- 1 "#$%^ ' ( )

450759 : ; < =

>?

Gothic Humbsrs

jklmnopqrs

! u u lu X y 3 I

Gothic Small

I

ithic Cap

Fig. 7. Gothic font.

37
- / "#$%Sc' ( )

"" + ,-. /01 23

45 67 89 : ;

<=

>?

Script Number

i LU Lh W- IXj

Script Small

f

Fig. 8. Script font.
(Gandif Apple

Sc

Hershey Characters

for the Apple II

Fig. 9. Candy Apple logo produced by Candy Wrapper

39

NBS-n4A (REV. 2.BC) U.S. DEPT. OF COMM. BIBLIOGRAPHIC DATA

SHEET (See instructions)

1. PUBLICATION OR

REPORT NO.

NBS TN 1176

2. Performing Organ. Report No 3. Publication Date

June 1983

4. TITLE AND SUBTITLE

Utility Programs for Generating the Hershey Character Fonts on Microcomputers and Laboratory Plotters

5. AUTHOR(S)

C. E. Dick and J. Hilsenrath

6. PERFORMING ORGANIZATION (If joint or other than NBS. see instructions)

NATIONAL BUREAU OF STANDARDS

DEPARTMENT OF COMMERCE

WASHINGTON, D.C. 20234

7. Contract/Grant No.

8. Type of Report & Period Covered

Final

9. SPONSORING ORGANIZATION NAME AND COMPLETE ADDRESS (Street. City. State. ZIP)

Same as in item 5 above,

10. SUPPLEMENTARY NOTES

I I Document describes a computer program; SF-185, FlPS Software Summary, js attached.

11. ABSTRACT (A 200-word or less factual summary of most significant information. If document includes a significant

bibliography or literature survey, mention it here)

Two programs are described that allow for the storage and manipulation of digitized fonts of graphic arts symbols and characters on

the Apple II computer system. These fonts are based on the work of

A. V. Hershey and provide the user with a repertory of digitized

characters suitable for use in the preparation of camera-ready

illustration in the laboratory environment. The programs described

contain routines for reading files of the Hershey coordinates,

storing them as text files, displaying them as individual characters or combined text on the high resolution display, and two

methods for editing them or creating special symbols and graphics.

12. KEY WORDS (Six to twelve entries; alphabetical order; capitalize only proper names; and separate key words by semicolons)

Applesoft basic programs; camera- ready illustrations; digitized graphic symbols;

Hershey character fonts; microcomputers.

13. AVAILABILITY

fXl Unlimited

I I For Official Distribution. Do Not Release to NTIS

fXl Order From Superintendent of Documents, U.S. Government Printing Office, Washington, D.C. 20402.

[^^ Order From National Technical Information Service (NTIS), Springfield, VA. 22161

14. NO. OF

PRINTED PAGES

45

15. Price

$3.75

USCOMM-DC 6043-P80

* U. S. GOVERNMENT PRINTING OFFICE : 1983—380-997/5059

NBS TECHNICAL PUBLICATIONS

PERIODICALS

JOURNAL OF RESEARCH—The Journal of Research of the National Bureau of Standards reports NBS research and develop- ment in those disciplines of the physical and engineering sciences in which the Bureau is active. These include physics, chemistry,

engineering, mathematics, and computer sciences. Papers cover a broad range of subjects, with major emphasis on measurement

methodology and the basic technology underlying standardization. Also included from time to time are survey articles on topics

closely related to the Bureau's technical and scientific programs. As a special service to subscribers each issue contains complete

citations to all recent Bureau publications in both NBS and non- NBS media. Issued six times a year. Annual subscription: domestic

$18; foreign $22.50. Single copy, $5.50 domestic; $6.90 foreign.

NONPERIODICALS

Monographs—Major contributions to the technical literature on

various subjects related to the Bureau's scienlinc and technical activities. Handbooks—Recommended codes of engineering and industrial practice (including safely codes) developed in cooperation with in- terested industries, professional organizations, and regulatory

bodies. Special Publications—Include proceedings of conferences sponsored by NBS, NBS annual reports, and other special publications

appropriate to this grouping such as wall charts, pocket cards, and

bibliographies. Applied Mathematics Series—Mathematical tables, manuals, and

studies of special interest to physicists, engineers, chemists,

biologists, mathematicians, computer programmers, and others engaged in scientific and technical work.

National Standard Reference Data Series—Provides quantitative data on the physical and chemical properties of materials, compiled from the world's literature and critically evaluated. Developed under a worldwide program coordinated by NBS under

the authority of the National Standard Data Act (Public Law

90-396).

NOTE: The principal publication outlet for the foregoing data is the Journal of Physical and Chemical Reference Data (JPCRD)

published quarterly for NBS by the American Chemical Society

(ACS) and the American Institute of Physics (AlP). Subscriptions,

reprints, and supplements available from ACS. 1 155 Sixteenth St., NW, Washington, DC 20056.

Building Science Series—Disseminates technical i''''ormation developed at the Bureau on building materials, components,

systems, and whole structures. The series presents research results,

test methods, and performance criteria related to the structural and

environmental functions and the durability and safety characteristics of building elements and systems.

Technical Notes—Studies or reports which are complete in themselves but restrictive in their treatment of a subject. Analogous to monographs but not so comprehensive in scope or definitive in treatment of the subject area. Often serve as a vehicle for final reports of work performed at N BS under the sponsorship of other government agencies.

Voluntary Product Standards—Developed under procedures

published by the Department of Commerce in Part 10, Title 15, of

the Code of Federal Regulations. The standards establish nationally recognized requirements for products, and provide all concerned interests with a basis for common understanding of the

characteristics of the products. NBS administers this program as a supplement to the activities of the private sector standardizing

organizations. Consumer Information Series—Practical information, based on NBS research and experience, covering areas of interest to the con- sumer. Easily understandable language and illustrations provide

useful background knowledge for shopping in today's technological marketplace. Order the above NBS publications from: Superintendent of Documents, Government Printing Office. Washington, DC 20402. Order the following NBS publications—FlPS and NBSIR's—from

the National Technical Information Service , Springfield. VA 22161

.

Federal Information Processing Standards Publications (FIPS

PUB)—Publications in this series collectively constitute the Federal Information Processing Standards Register. The Register

serves as the official source of information in the Federal Govern- ment regarding standards issued by NBS pursuant to the Federal Property and Administrative Services Act of 1949 as amended.

Public Law 89-306 (79 Stat. 1127), and as implemented by Executive Order 11717(38 FR 12315, dated May II. 1973) and Part 6

of Title 15 CFR (Code of Federal Regulations).

NBS Interagency Reports (NBSIR)—A special series of interim or

final reports on work performed by NBS for outside sponsors

(both government and non-government). In general, initial dis- tribution is handled by the sponsor: public distribution is by the National Technical Information Service , Springfield, VA 22161,

in paper copy or microfiche form.
U.S. Department of Commerce

National Bureau of Standards

Washington, D.C. 20234

Official Business

Penalty for Private Use $300

POSTAGE AND FEES PAID

U S DEPARTMENT OF COMMERCE

COM-215

THIRD CLASS BULK RATE