home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 640a.lha / FontConverter / Source.LZH / Source / Example1.c next >
C/C++ Source or Header  |  1992-04-26  |  2KB  |  89 lines

  1. /************************************************************************/
  2. /*                                                                      */
  3. /*                            Compiler: DICE                            */
  4. /*                                                                      */
  5. /*                            Compilerusage:                            */
  6. /*                                                                      */
  7. /*               DCC -oExample1 Example1.c Font.c Font1.c               */
  8. /*                                                                      */
  9. /************************************************************************/
  10.  
  11.  
  12. #include <intuition/intuition.h>
  13.  
  14. extern struct IntuitionBase *IntuitionBase;
  15. extern struct GfxBase *GfxBase;
  16.  
  17. extern struct TextFont Ruby12Font;
  18. extern struct TextFont Garnet9Font;
  19.  
  20. struct Window *win;
  21. struct RastPort *rp;
  22. struct IntuiMessage *mes;
  23.  
  24. struct TextAttr attr_Ruby12,attr_Garnet9;
  25.  
  26. struct NewWindow nwin =
  27.   {
  28.     30,15,265,52,0,1,CLOSEWINDOW,ACTIVATE|WINDOWCLOSE|RMBTRAP,
  29.     NULL,NULL,"<- Click to close",NULL,NULL,0,0,0,0,WBENCHSCREEN
  30.   };
  31.  
  32. struct IntuiText text1 =
  33.   {
  34.     1,0,JAM1,20,17,&attr_Ruby12,"This is an exampletext.",NULL
  35.   };
  36.  
  37. struct IntuiText text2 =
  38.   {
  39.     1,0,JAM1,20,35,&attr_Garnet9,"Output with PrintIText().",&text1
  40.   };
  41.  
  42. ULONG mesclass;
  43.  
  44. dummy()
  45.   {
  46.     _waitwbmsg();
  47.   }
  48.  
  49. _main()
  50.   {
  51.     win=(struct Window *)OpenWindow(&nwin);
  52.  
  53.     rp=win->RPort;
  54.  
  55.     FontInit_Ruby12();
  56.     SetFont(rp,&Ruby12Font);
  57.     AddFont(&Ruby12Font);
  58.     AskFont(rp,&attr_Ruby12);
  59.  
  60.     FontInit_Garnet9();
  61.     SetFont(rp,&Garnet9Font);
  62.     AddFont(&Garnet9Font);
  63.     AskFont(rp,&attr_Garnet9);
  64.  
  65.     PrintIText(rp,&text2,0,0);
  66.  
  67.     for(;;)
  68.       {
  69.         if(mes=(struct IntuiMessage *)GetMsg(win->UserPort))
  70.           {
  71.             mesclass=mes->Class;
  72.             ReplyMsg(mes);
  73.             if(mesclass==CLOSEWINDOW)
  74.               {
  75.                 close_all();
  76.                 exit(0);
  77.               }
  78.           }
  79.       }
  80.   }
  81.  
  82. close_all()
  83.   {
  84.     RemFont(&Ruby12Font);
  85.     RemFont(&Garnet9Font);
  86.     CloseWindow(win);
  87.   }
  88.  
  89.