* * DISCLAIMER: * * This program is provided as a service to the programmer * community to demonstrate one or more features of the Amiga * personal computer. These code samples may be freely used * for commercial or noncommercial purposes. * * Commodore Electronics, Ltd ("Commodore") makes no * warranties, either expressed or implied, with respect * to the program described herein, its quality, performance, * merchantability, or fitness for any particular purpose. * This program is provided "as is" and the entire risk * as to its quality and performance is with the user. * Should the program prove defective following its * purchase, the user (and not the creator of the program, * Commodore, their distributors or their retailers) * assumes the entire cost of all necessary damages. In * no event will Commodore be liable for direct, indirect, * incidental or consequential damages resulting from any * defect in the program even if it has been advised of the * possibility of such damages. Some laws do not allow * the exclusion or limitation of implied warranties or * liabilities for incidental or consequential damages, * so the above limitation or exclusion may not apply. * * samplefont.asm * * * * A complete sample font. To test this font, the following must be done: * * 1. In the AmigaDOS SYS:fonts directory, install a file by the name of * test.font, containing 264 bytes. * * The first two bytes must contain the value hex 0f00, the * identifier for a font header. * * The next word (2 bytes), should contain the value 0001, * which is the number of FontContents elements. There is * only going to be one font in the directory that this * font description covers. * * Follow this header material with the ascii value for * 'test/8'; the next 250 bytes should be set to zero. * This represents the pathname for AmigaDOS to follow * from the directory SYS:fonts in order to reach this test font. * 'test' is the directory it should go to and '8' is the font * file itself, as assembled and linked below. * * The next two bytes (as one word) contain the font YSize, in * this case 0008. * * The next byte contains the font Flags, in this case 00. * * The last byte contains the font characteristics, in this * case hex 60, this says it is a disk-based font (bit 1 set) * and the font has been removed (bit 7 set) saying that the * font is not currently resident. * * Summary (all in hex) of test.font file: * * 0f00 0001 test/8 ........ 0008 00 60 * word word 256-bytes...... word byte byte * * 2. Create a directory named 'test' in SYS:fonts. * * Copy the file created by assembling and linking the test font * below into a file named '8' in subdirectory SYS:fonts/test. * * Use the font under the Notepad program or any other. It * defines ascii characters 'a' 'b' 'c' and 'd' only. All * other characters print an "unknown character", a rectangle. * * author: Rob Peck 12/1/85 * * This code may be freely utilized to create programs for the Amiga * *------ Included Files ----------------------------------------------- INCLUDE "exec/types.i" INCLUDE "exec/nodes.i" INCLUDE "libraries/diskfont.i" MOVEQ #0,D0 ;provide an easy exit in case somebody ;tries to RUN this file instead of loading it. RTS DC.L 0 ; ln_Succ DC.L 0 ; ln_Pred DC.B NT_FONT ; ln_Type DC.B 0 ; ln_Pri DC.L fontName ; ln_Name DC.W DFH_ID ; FileID DC.W 1 ; Revision DC.L 0 ; Segment fontName: DS.B MAXFONTNAME ; Name font: DC.L 0 ; ln_Succ DC.L 0 ; ln_Pred DC.B NT_FONT ; ln_Type DC.B 0 ; ln_Pri DC.L fontName ; ln_Name DC.L 0 ; mn_ReplyPort DC.W fontEnd-font ; mn_Length DC.W 8 ; tf_YSize DC.B 0 ; tf_Style DC.B FPF_DESIGNED+FPF_PROPORTIONAL ; tf_Flags DC.W 14 ; tf_XSize DC.W 6 ; tf_Baseline * baseline must be no greater a value than YSize-1, otherwise algorithmically * generated style (italic particularly) can corrupt system memory. DC.W 1 ; tf_BoldSmear DC.W 0 ; tf_Accessors DC.B 97 ; tf_LoChar DC.B 100 ; tf_HiChar DC.L fontData ; tf_CharData DC.W 8 ; tf_Modulo, no of bytes to add to ; data pointer to go from one row of ; a character to the next row of it. DC.L fontLoc ; tf_CharLoc, bit position in the ; font data at which the character ; begins. DC.L fontSpace ; tf_CharSpace DC.L fontKern ; tf_CharKern ******************************************************************* * These are the suits-characters that this font data defines. * ascii lower case a,b,c,d. The font descriptor says that there * are 4 characters described here. The fifth character in the * table is the character that is to be output when there is * no character in this character set that matches the ascii * value requested. * * 97 98 99 100 256 *< >< >< >< >< > * @@@ @@@ @ @ @@@ @@@@@@@@@@@@ * @@@@@ @@@@@ @@@@@ @@@ @@@@@ @@ @@ * @@@@@@@@@ @@@@@@@@@ @@@@@ @@ @ @@ @@ @@ * @@@@@@@ @@@@@@@@@@@ @@@@@@@ @@@@@@@@@@@ @@ @@ * @@@@@ @@@ @ @@@ @@@@@ @@ @ @@ @@ @@ * @@@ @ @@@ @ @@ @@ * @ @@@@@ @ @@@@@ @@@@@@@@@@@@ * ******************************************************************* fontData: DC.W $071C0,$08040,$070FF,$0F000 DC.W $0FBE3,$0E0E0,$0F8C0,$03000 DC.W $07FCF,$0F9F3,$026C0,$03000 DC.W $03F9F,$0FFFF,$0FFC0,$03000 DC.W $01F0E,$0B9F3,$026C0,$03000 DC.W $00E00,$080E0,$020C0,$03000 DC.W $00403,$0E040,$0F8FF,$0F000 DC.W $00000,$00000,$00000,$00000 DC.W $00000,$00000,$00000,$00000 * font data is bit-packed edge to edge to save space; thats what the * fontLoc is all about. fontLoc: DC.L $00000000B,$0000B000B,$000160007,$0001D000B DC.L $00028000C * Each pair of words specifies how the characters are bit-packed. For * example, the first character starts at bit position 0000, and is 000B * (11) bits wide. The second character starts at bit position 000B and * is 000B bits wide, and so on. Tells font handler how to unpack the * bits from the array. fontSpace: DC.W 000012,000012,000008,000012,000013 * fontSpace array: Use a space that is this-wide to contain this character * when it is printed. fontKern: DC.W 000001,000001,000001,000001,000001 fontEnd: END