home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15059 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.7 KB  |  70 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!wupost!gumby!destroyer!news.iastate.edu!niko
  3. From: niko@iastate.edu (Nikolaus E Schuessler)
  4. Subject: Simple (?) Resource Manager program?
  5. Message-ID: <1992Sep6.230145.18127@news.iastate.edu>
  6. Sender: news@news.iastate.edu (USENET News System)
  7. Organization: Iowa State University, Ames, IA
  8. Date: Sun, 6 Sep 1992 23:01:45 GMT
  9. Lines: 59
  10.  
  11. I recently thought I'd write a simple getResource program to read
  12. in a font and dump it out in bitmap form (array declarations in C)
  13. to be compiled with a program. I however get really weird numbers..
  14. i.e. fontwidth of > 1000 or height > 100? That's outrageous...
  15. (plus no matter what id I get, the numbers are always the same).
  16. I think I'm missing something basic.
  17.  
  18. Here is the program...
  19.  
  20. void main(void)
  21. {
  22.    Handle ahand;
  23.    FontRec  *fontptr;
  24.    char s[80];
  25.    short fontid;
  26.    short error;
  27.    
  28.    printf("Enter font id: ");
  29.    gets(s);
  30.    fontid = atoi(s);
  31.       
  32.    printf("Getting 'FONT' id %d\n",fontid);
  33.    
  34.    ahand = GetResource('FONT',0);
  35.    
  36.    if (ahand == NULL)  {
  37.       printf("Got null handle... exiting (1).\n");
  38.       exit(1);
  39.    }
  40.  
  41.    error = ResError();
  42.    if (error) {
  43.       printf("Got reserror %d (1)\n",error);
  44.       exit(1);
  45.    }
  46.    
  47.    LoadResource(ahand);
  48.    
  49.    error = ResError();
  50.    if (error) {
  51.       printf("Got reserror %d (2)\n",error);
  52.       exit(1);
  53.    }
  54.       
  55.    HLock(ahand);
  56.    fontptr = (FontRec *) (*ahand);
  57.    
  58.    fontptr-> xxx  /* this should be the fontrec data right ? */
  59.  
  60.    [...]
  61.  
  62. }
  63.  
  64. Thanks anyone who can help...
  65. -- 
  66. Niko Schuessler               
  67. Project Vincent Systems Manager              email: niko@iastate.edu
  68. Iowa State University Computation Center     voice: (515) 294-1672
  69. Ames IA 50010                                snail: 272 Durham 
  70.