#include <intuition/intuition.h>
#include <stdio.h>

struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;

/* Externe Structuren der Fonts */

extern struct TextFont LongislandFont;
extern struct TextFont BoldtypeFont;
extern struct TextFont ScriptFont;
extern struct TextFont SlopeFont;

struct Window *win;
struct RastPort *rp;
struct IntuiMessage *mes;

/* Leere TextAttribut-Structuren für Fonts */

struct TextAttr attr_longisland,attr_boldtype,attr_script,attr_slope;

ULONG mesclass;

struct NewWindow nwin =
  {
    0,0,640,200,0,1,CLOSEWINDOW,
    ACTIVATE|WINDOWCLOSE,NULL,NULL,"<- Hier anklicken um Window zu schliessen",NULL,NULL,0,0,0,0,WBENCHSCREEN
  };

struct IntuiText text1 =      /* Text mit LongislandFont ausgeben */
  {
    1,0,JAM1,10,17,&attr_longisland,"Dieser Text wurde mit vier",NULL
  };

struct IntuiText text2 =      /* Text mit BoldtypeFont ausgeben */
  {
    1,0,JAM1,10,47,&attr_boldtype,"verschiedenen Fonts ausgegeben,",&text1
  };

struct IntuiText text3 =       /* Text mit ScriptFont ausgeben */
  {
    1,0,JAM1,10,77,&attr_script,"ohne das die Diskfont.library",&text2
  };

struct IntuiText text4 =       /* Text mit SlopeFont ausgeben */
  {
    1,0,JAM1,10,107,&attr_slope,"oder ein Font nachgeladen werden musste.",&text3
  };

struct IntuiText text5 =       /* Text mit LongislandFont ausgeben */
  {
    1,0,JAM1,10,137,&attr_longisland,"Der Text wurde mit PrintIText",&text4
  };

struct IntuiText text6 =       /* Text mit ScriptFont ausgeben */
  {
    1,0,JAM1,10,167,&attr_script,"ausgegeben.",&text5
  };


main()
  {
    IntuitionBase = ( struct IntuitionBase * )
    OpenLibrary ( "intuition.library",0 );

    GfxBase = ( struct GfxBase * )
    OpenLibrary ( "graphics.library",0 );

    win = ( struct Window * )
    OpenWindow ( &nwin );

    rp = win  -> RPort;

    FontInit_Longisland();             /* Font initialisieren */
    SetFont ( rp,&LongislandFont );    /* Font setzen */
    AddFont ( &LongislandFont );       /* Font an die Fontliste des Systems hängen */
    AskFont ( rp,&attr_longisland );   /* TextAttribut von Font holen */

    FontInit_Boldtype();               /* Font initialisieren */
    SetFont ( rp,&BoldtypeFont );      /* Font setzen */
    AddFont ( &BoldtypeFont );         /* Font an die Fontliste des Systems hängen */
    AskFont ( rp,&attr_boldtype );     /* TextAttribut von Font holen */

    FontInit_Script();                 /* Font initialisieren */
    SetFont ( rp,&ScriptFont );        /* Font setzen */
    AddFont ( &ScriptFont );           /* Font an die Fontliste des Systems hängen */
    AskFont ( rp,&attr_script );       /* TextAttribut von Font holen */

    FontInit_Slope();                  /* Font initialisieren */
    SetFont ( rp,&SlopeFont );         /* Font setzen */
    AddFont ( &SlopeFont );            /* Font an die Fontliste des Systems hängen */
    AskFont ( rp,&attr_slope );        /* TextAttribut von Font holen */

    /* Text ausgeben mit PrintIText-Funktion, Font kann über das
       das TextAttribut eingestellt werden ( siehe IntuiTextzeilen ) */

    PrintIText ( rp,&text6,0,5 );

    for(;;)
      {
        if(mes=(struct IntuiMessage *)GetMsg(win->UserPort))
          {
            mesclass=mes->Class;
            ReplyMsg(mes);
            if(mesclass==CLOSEWINDOW)
              {
                close_all();
                exit(EXIT_SUCCESS);
              }
          }
      }
  }

close_all()
  {
    RemFont      ( &LongislandFont );   /* Font wird aus der Fontliste des System gelöscht */
    RemFont      ( &BoldtypeFont );     /* Font wird aus der Fontliste des System gelöscht */
    RemFont      ( &ScriptFont );       /* Font wird aus der Fontliste des System gelöscht */
    RemFont      ( &SlopeFont );        /* Font wird aus der Fontliste des System gelöscht */
    CloseWindow  ( win );
    CloseLibrary ( GfxBase );
    CloseLibrary ( IntuitionBase );
  }

