[comp.sys.apple] how to find a IIgs font in memory

AWCTTYPA@UIAMVS.BITNET ("David A. Lyons") (04/06/88)

>Date:         Mon, 4 Apr 88 22:47:03 GMT
>From:         Donald J Aehl <aehl@csd4.milw.wisc.EDU>
>Subject:      APPLE IIGS SYSTEM FONT
>Comments: To: info-apple@BRL.ARPA

>I have been unable to locate the System Font's location within memory.
>I have checked various RAM & ROM maps for the Apple IIgs, but I have been
>unable to locate it.

You won't find it in a ROM map for the IIgs because Apple doesn't guarantee
that it will be anyplace in particular--and it won't (it will move with ROM
revisions).  You're attacking the problem from the hard end--see below.

>I even used the search routines in Banks $E0 and $E1
>and $FE and $FF to find the word "shaston" yet nothing turned up.

The FONT is in ROM, but the *name* isn't.  (The Font Manager [not currently
in ROM] knows the name, though.)

>I am assuming that the system font resides in ROM (either banks $FE or $FF).

That is currently correct (as of ROM 01 [same as "ROM 2.0"]).

>Can anyone out there give me directions to the system font?

You bet.  Turn on your machine and get into BASIC; then type CALL-151 to
get into the monitor ("*" prompt).  Type "#" to install a "Visit Monitor"
desk accessory that is hidden in your ROM.  [Note--this assumes you have
ROM 01 (the "new" ROM).  If you don't, I leave it up to you how to get
into the monitor later after QuickDraw is started up.]

Now boot up some program that starts QuickDraw II.  Either the Finder or
the Launcher on System Disk 3.1 (but NOT the "Desktop" on System disk 1.1)
will do nicely.

Type Apple-Ctrl-ESC to get to the CDA menu, and choose "visit monitor."
Now you are in the monitor WITH QUICKDRAW TURNED ON.  Now we will do a
"GetFont" call to QuickDraw, as documented in Volume II of the Toolbox
Reference.  This will give us a handle to the current font, which will
be Shaston 8 (the system font).  Here's how to do it:

  \4 4 0 0 0 0 95 4\U

(This means:  push 4 bytes on the stack before the tool call, and pull
4 bytes from the stack after the tool call.  The four bytes are all 0,
and the tool we're calling is $95 in toolset 4 (QuickDraw).  The "\"
are required around all that stuff, and the "U" means "Utility" call
(for no really good reason--T was already used).)

You will see 4 bytes printed on the screen.  Something like

E0 77 FE 00

This means that $00FE77E0 is a "handle" to the font.  In other words, it's
a pointer to a pointer to the font.

So you type FE/77E0.77E3 and see something like

FE/77E0:E6 77 FE 00

meaning that $00FE77E6 is a pointer to (in other words, "the address of")
the font.  So at $FE77E6 I found the system font in my machine.

So what do you do with it?  Well, you probably won't be able to get much
use out of it unless you have Volume II of the Toolbox Reference.  The
QuickDraw II chapter explains the format of a font, and it's pretty
weird.

>ARPA: aehl@csd4.milw.wisc.edu        USMAIL: Donald Aehl
>                                             Box #204
>                                             3400 N. Maryland Ave.
>                                             Milwaukee, WI 53201
>UUCP: ihnp4!uwmcsd1!uwm-evax!aehl    ICBM:   43 4 58 N / 87 55 52 W

--David A. Lyons  a.k.a.  DAL Systems
  PO Box 287 | North Liberty, IA 52317
  BITNET: AWCTTYPA@UIAMVS
  CompuServe: 72177,3233
  GEnie mail: D.LYONS2

aehl@csd4.milw.wisc.edu (Donald J Aehl) (04/10/88)

In article <8804050214.aa00793@SMOKE.BRL.ARPA> AWCTTYPA@UIAMVS.BITNET ("David A. Lyons") writes:
>>I have been unable to locate the System Font's location within memory.
>>I have checked various RAM & ROM maps for the Apple IIgs, but I have been
>>unable to locate it.
>
>You won't find it in a ROM map for the IIgs because Apple doesn't guarantee
>that it will be anyplace in particular--and it won't (it will move with ROM
>revisions).  You're attacking the problem from the hard end--see below.
>The FONT is in ROM, but the *name* isn't.  (The Font Manager [not currently
>in ROM] knows the name, though.)
>
>So at $FE77E6 I found the system font in my machine.
>
>So what do you do with it?  Well, you probably won't be able to get much
>use out of it unless you have Volume II of the Toolbox Reference.  The
>QuickDraw II chapter explains the format of a font, and it's pretty
>weird.
>
>--David A. Lyons  a.k.a.  DAL Systems
>  PO Box 287 | North Liberty, IA 52317
>  BITNET: AWCTTYPA@UIAMVS
>  CompuServe: 72177,3233
>  GEnie mail: D.LYONS2

Thanks alot for this info.  It will really help.  I am really new to toolbox
programming and am stumbling around in it.  I have the Apple IIgs Tech Ref.
It is a good reference and is readable but lacks a lot of examples.

As for the Font format, it really is very simple.  I figured that out quite 
a while ago and have successfully edited a number of fonts manually. I'm
trying to write a font editor myself but it really reguires more machine
language experience than I currently have.  This biggest problem is being
able to constantly manipulate the FontStrike Image.  It's all bitmapped
and inserting wider characters and such is a real pain to work out.

I would be really interested to know about anyone who is currently working
on a font editor.  I saw one published in CALL -APPLE using GS BASIC.
However, it skirted the whole issue by allowing you only to edit Monaco
size fonts (similar in size to the old DOS ToolKit Fonts for HGR) and 
dissallowed any proportional/odd sized characters in the FontStrike.
In short, all characters had to be 5x7.  Oh well, I think I'll type it
in and try it uning TML BASIC.

Thanks again for your help.

==============================================================================
ARPA: aehl@csd4.milw.wisc.edu        USMAIL: Donald Aehl            
                                             Box #204
                                             3400 N. Maryland Ave.
					     Milwaukee, WI 53201
UUCP: ihnp4!uwmcsd1!uwm-evax!aehl    ICBM:   43 4 58 N / 87 55 52 W
==============================================================================