From: jasonp@oakhill.sps.mot.com (Jason Perez)
Newsgroups: comp.sys.apple2
Subject: how to create styled fonts, how to make it the menubar font?
Date: 31 Jul 92 14:38:03 GMT
Reply-To: jasonp@ishmael.UUCP (Jason Perez)
Organization: Motorola Inc., Austin, Texas


  not sure if this made it out, so i'll repost it:


   i've been struggling with the toolbox to generate fonts and i'm up against
a brick wall!  how does one go about generating fonts to memory that aren't in
the */system/fonts folder.  i've tried using InstallFont, and have successfully
generated different *point* sizes (with the help of Pointless), but i've not been
able to generate fonts with different styles, like bold+italic.  the following code
segment shows how i'm trying to do it (orca/c 1.3):

	FontID menuFont;
	FontHndl fonthandlex; /* handle required for AddFontVar*/

	menuFont.fidRec.famNum = GetFamNum("\pCourier");
	menuFont.fidRec.fontStyle = 0x0003; /* bold+italic*/
	menuFont.fidRec.fontSize = 0x000c; /* 12 point*/
	
	InstallFont(menuFont.fidRec,0x0000);  	
	(*fonthandlex)->style  = menuFont.fidRec.fontStyle;  /* set up handle for*/
	(*fonthandlex)->family = menuFont.fidRec.fontStyle;  /* AddFontVar */
	(*fonthandlex)->size   = menuFont.fidRec.fontStyle;
	AddFontVar(fonthandlex,0x0002);
	FMSetSysFont(menuFont.fidRec);


  that's it.  incidentally, i had to modify the control.h file because it #define(d) 
family, which also happens to be a variable name, so i could get the code to compile
correctly.  i've assigned the font handle info to be the same as the fontID info.  what
happens is that InstallFont will seemingly do nothing, as it can't find a bold+italic
Courier font (if it's only bold, a 12 point font will be generated,as Courier Bold is in
the */system/fonts folder).  AddFontVar gives me error $1b04-family not found.  i still
get this error if i give it a font that *is* already in the fonts folder.  FMSetSysFont give
me an error-Font not found, obviously, since it wasn't installed.  
  what is the proper procedure to generate new font styles that aren't in the fonts folder?
  and once it's generated, how do i get this font to be the font in the system menu bar?  
FMSetSysFont doesn't change the menubar font as far as i can tell.  i'm calling this function
before i set up the menus, but orca's startdesk(640) function has already drawn the menubar
frame, so do i need to call FMSetSysFont before startdesk calls DrawMenuBar?

_____________
  now for some more weirdness.  since i have a truetype "courier-bold" in my fonts folder,
InstallFont is able to generate a 12 point Courier bold-only font.  when the app is
launced, pointless fires up and generates the font.  all is good.  now i quit, re-launch it
and pointless does not fire up ( i assume because the font is still in memory).  but
FMSetSysFont cannot find the font now, even though InstallFont returned no error.  why does
the font appear the first time, but not the second?  Incidentally, if i run EGOed in between
launches, all is fine (it's like EGOed makes some kind of call to the FontManager that
resets it).

-- 
Jason Perez                             | 
jasonp@ishmael.sps.mot.com              | "Gig 'em!"     "Frodo lives!"
j0p7771@sigma.tamu.edu                  | "Don't have a cow man!"
________________________________________|______________________________________