[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

3787.0. "Problems with OpenDiskFont()" by GIDDAY::MORAN (I'm not bad-I'm just drawn that way!) Wed May 16 1990 23:13

    I Was wondering if any other programmers out there could help me ...
    
    I trying to attach a custom font to my on custom screen through
    intuition. To do this I have to give a pointer to a font in the
    NewScreen Structure. The problem is getting the pointer.
    
    The font I want to use is in the FONTS: directory. As far as I could
    work out from the Manual's this is a fragment of the code to get this
    pointer:
    
    OpenDiskFont	=-30
    
    ;Open the Diskfont.library and save d0->diskbase
    
    	move.l	diskbase,a6
    	move.l	TextAttr,a0
    	jsr	OpenDiskfont(a6)
    	move.l	d0,fontbase
    
    ;Close the Diskfont.library
    
    	rts
    
    TextAttr:
    
    	dc.l	fontname
    	dc.w	8
    	dc.b	0
    	dc.b	0
    
    fontname:	dc.b	'sample.font',0
    		even
    
    	END
    
    After assembling this and executing it through a Debugger I find that
    when it executes the jsr OpenDiskfont call it takes approx. 40 secs
    with NO disk access. At the end of this time I get 0 back in D0 which
    according to intuition means that it could'nt find the font.
    
    Has anyone else managed to get this to work ???? I went through the C
    source code to SetFont but as far as I can see I've everything correct.
    
    Thanks in advice for the help.
    
T.RTitleUserPersonal
Name
DateLines
3787.1try thisDEMOAX::MCKENDRYNasty, Brutish, and ShortMon May 21 1990 13:5414
 This is a guess, but I'd suggest changing
    	"move.l	TextAttr,a0"
to
	"lea	TextAttr,a0"  .

 I think you'll find that after "move.l TextAttr,a0", a0 contains
the address of your string "fontname," not the address of your
TextAttr structure. And I suspect the OpenDiskfont routine would
rather have the structure. "lea" will load a0 with the structure
address.

 Of course, I could be wrong.

-John
3787.2Boy, am I Stupid!!GIDDAY::MORANI'm not bad-I'm just drawn that way!Tue May 22 1990 22:4910
    You are totally 100% right!!
    
    Silly me, would you believe that I really meant lea??
    
    Now for the next challange - Alt Keymaps in a string gadget.
    
    Thanks for the help.
    
    Shaun.