home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / apple2 / 18155 < prev    next >
Encoding:
Internet Message Format  |  1992-07-31  |  3.4 KB

  1. Path: sparky!uunet!olivea!hal.com!decwrl!sun-barr!cs.utexas.edu!oakhill!jasonp
  2. From: jasonp@oakhill.sps.mot.com (Jason Perez)
  3. Newsgroups: comp.sys.apple2
  4. Subject: how to create styled fonts, how to make it the menubar font?
  5. Message-ID: <1992Jul31.143803.17599@oakhill.sps.mot.com>
  6. Date: 31 Jul 92 14:38:03 GMT
  7. Reply-To: jasonp@ishmael.UUCP (Jason Perez)
  8. Organization: Motorola Inc., Austin, Texas
  9. Lines: 55
  10.  
  11.  
  12.   not sure if this made it out, so i'll repost it:
  13.  
  14.  
  15.    i've been struggling with the toolbox to generate fonts and i'm up against
  16. a brick wall!  how does one go about generating fonts to memory that aren't in
  17. the */system/fonts folder.  i've tried using InstallFont, and have successfully
  18. generated different *point* sizes (with the help of Pointless), but i've not been
  19. able to generate fonts with different styles, like bold+italic.  the following code
  20. segment shows how i'm trying to do it (orca/c 1.3):
  21.  
  22.     FontID menuFont;
  23.     FontHndl fonthandlex; /* handle required for AddFontVar*/
  24.  
  25.     menuFont.fidRec.famNum = GetFamNum("\pCourier");
  26.     menuFont.fidRec.fontStyle = 0x0003; /* bold+italic*/
  27.     menuFont.fidRec.fontSize = 0x000c; /* 12 point*/
  28.     
  29.     InstallFont(menuFont.fidRec,0x0000);      
  30.     (*fonthandlex)->style  = menuFont.fidRec.fontStyle;  /* set up handle for*/
  31.     (*fonthandlex)->family = menuFont.fidRec.fontStyle;  /* AddFontVar */
  32.     (*fonthandlex)->size   = menuFont.fidRec.fontStyle;
  33.     AddFontVar(fonthandlex,0x0002);
  34.     FMSetSysFont(menuFont.fidRec);
  35.  
  36.  
  37.   that's it.  incidentally, i had to modify the control.h file because it #define(d) 
  38. family, which also happens to be a variable name, so i could get the code to compile
  39. correctly.  i've assigned the font handle info to be the same as the fontID info.  what
  40. happens is that InstallFont will seemingly do nothing, as it can't find a bold+italic
  41. Courier font (if it's only bold, a 12 point font will be generated,as Courier Bold is in
  42. the */system/fonts folder).  AddFontVar gives me error $1b04-family not found.  i still
  43. get this error if i give it a font that *is* already in the fonts folder.  FMSetSysFont give
  44. me an error-Font not found, obviously, since it wasn't installed.  
  45.   what is the proper procedure to generate new font styles that aren't in the fonts folder?
  46.   and once it's generated, how do i get this font to be the font in the system menu bar?  
  47. FMSetSysFont doesn't change the menubar font as far as i can tell.  i'm calling this function
  48. before i set up the menus, but orca's startdesk(640) function has already drawn the menubar
  49. frame, so do i need to call FMSetSysFont before startdesk calls DrawMenuBar?
  50.  
  51. _____________
  52.   now for some more weirdness.  since i have a truetype "courier-bold" in my fonts folder,
  53. InstallFont is able to generate a 12 point Courier bold-only font.  when the app is
  54. launced, pointless fires up and generates the font.  all is good.  now i quit, re-launch it
  55. and pointless does not fire up ( i assume because the font is still in memory).  but
  56. FMSetSysFont cannot find the font now, even though InstallFont returned no error.  why does
  57. the font appear the first time, but not the second?  Incidentally, if i run EGOed in between
  58. launches, all is fine (it's like EGOed makes some kind of call to the FontManager that
  59. resets it).
  60.  
  61. -- 
  62. Jason Perez                             | 
  63. jasonp@ishmael.sps.mot.com              | "Gig 'em!"     "Frodo lives!"
  64. j0p7771@sigma.tamu.edu                  | "Don't have a cow man!"
  65. ________________________________________|______________________________________
  66.