I found another program that will render shape table fonts which is Executive Briefing System. It's actually pretty clever in that it "hides" the character width information in the shape table itself. The first two bytes I think are the height and the baseline, then it's a normal shape table, so we can just go a:sub(3) to skip past the first two characters of the a string.

The shape table has a byte to tell you the number of shapes, and the unused next byte is used to point to the offset of the width information.

[Linked Image from i.imgur.com][Linked Image from i.imgur.com]

According to the applesoft disassembly at http://www.txbobsc.com/scsc/scdocumentor/F5BA.html, F605- AA 1650 DRAW1 is the entry point, so putting a breakpoint at F605 told me that it was surely an applesoft shape table.



And now we can generate font samples automatically. Just get a filelist, iterate through the filelist, draw a sample, then wait 2/60 of a second and ask the debugger to take a snapshot.

Since we've got to use emu.wait this must be done with coroutines.

Code

function getebswidth(a,shapenum) return a:sub(1):byte(a:sub(1):byte(2)+shapenum+1) end

function drawshapetextebs(a,thisstr,x,y,spacing,xclip,height) for i=1,#thisstr do if thisstr:byte(i)==string.byte("\n") then if x~=0 then x,y=0,y+height end else
local c=thisstr:byte(i)  if c>=32 and c<=95 then c=c elseif c<32 then c=32 elseif c>=97 and c<=127 then c=c-97+1 else c=32 end 
 drawshapetable(a,c,x,y) x=x+getebswidth(a,c) if x>xclip then x,y=0,y+height end end end return x,y end

function getfilenamepart(s)
local curpos=1
repeat
local newpos=s:find("/",curpos,true)
if newpos then curpos = newpos+1 end  -- if you don't add the +1, keeps getting same match over and over for an infinite loop
until newpos == nil
return s:sub(curpos)
end

function trim2(s) return s:match "^%s*(.-)%s*$" end  -- from lua users wiki

disknamelist={""../../EXEC_BRIEF_SYS_hr.dsk","../../EXEC_BRIEF_SYS_FONTS_hr.dsk")

loaddisk("../../EXEC_BRIEF_SYS_hr.dsk") monospacefont=getfile("MONOSPACE.FONT")

co1=coroutine.create( function()
disknamelist={"../../EXEC_BRIEF_SYS_hr.dsk","../../EXEC_BRIEF_SYS_FONTS_hr.dsk"}
for d=1,#disknamelist do diskname=disknamelist[d] loaddisk(diskname)
filelist=cat()
for i=1,#filelist do print(filelist[i]) 
  if filelist[i]:find(".FONT",1,true) then 
  print("IT'S A FONT so let's render a sample!") 
  a=getfile(filelist[i])
  hgr() hgrfull() hgrclr() xpos=0 ypos=10 for i=1,95 do drawshapetable(a:sub(3),i,xpos,ypos) xpos=xpos+a:sub(3):byte(a:sub(3):byte(2)+i+1) print("width="..a:sub(3):byte(0xc2+i-1))  if xpos>250 or (((i+1) % 16) == 0) then xpos=0 ypos=ypos+20 end end
  drawshapetextebs(monospacefont:sub(3),getfilenamepart(diskname).."\n"..filelist[i],0,170,1,250,10)
  emu.wait(1/60+.01) 
  manager:machine():debugger():command("snap \"" .. sanefilename(getfilenamepart(diskname).."_"..trim2(filelist[i]))..".png\"")
end end end end) 
ok,error=coroutine.resume(co1)
print(ok,error)



[Linked Image from i.imgur.com][Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]


coming soon: drawing Print Shop and Fontrix fonts