amiga-news DEUTSCHE VERSION
.
Links| Forums| Comments| Report news
.
Chat| Polls| Newsticker| Archive
.

amiga-news.de Forum > Programmierung > ASL Fontrequester & PrintIText (C Programmierung) [ - Search - New posts - Register - Login - ]

-1- [ - Post reply - ]

2005-02-07, 21:36 h

Amigalien
Posts: 63
User
Hallo alle zusammen,
ich möchte gerne einen Font auswählen und mithilfe von PrintIText einen Text malen.
Ich weiß, die man einen Fontrequester mit ASL öffnet (siehe unten). Wie kann ich diesen ausgwählten Font nun mit PrintIText nutzen?

Ich danke schon einmal für die Hilfe.



if (fontr = (struct FontRequester *) IAsl->AllocAslRequestTags(ASL_FontRequest,
/* Supply initial values for requester */
ASL_FontName, (ULONG)"topaz.font",
ASL_FontHeight, 11L,
ASL_MinHeight, 5L,
ASL_MaxHeight, 25L,
TAG_DONE))
{
/* Pop up the requester */
if (IAsl->AslRequest(fontr, NULL))
{
/* The user selected something, report their choice */
printf("%sn YSize = %d Style = 0x%x Flags = 0x%xn"
" FPen = 0x%x BPen = 0x%x DrawMode = 0x%xn",
fontr->fo_Attr.ta_Name,
fontr->fo_Attr.ta_YSize,
fontr->fo_Attr.ta_Style,
fontr->fo_Attr.ta_Flags,
fontr->fo_FrontPen,
fontr->fo_BackPen,
fontr->fo_DrawMode);
font->ta_Name=fontr->fo_Attr.ta_Name;
font->ta_YSize=fontr->fo_Attr.ta_YSize;
font->ta_Style=fontr->fo_Attr.ta_Style;
font->ta_Flags=fontr->fo_Attr.ta_Flags;
text.ITextFont=(struct TextAttr *) IGraphics->OpenFont(font);
}
IAsl->FreeAslRequest(fontr);
}

[ - Answer - Quote - Direct link - ]

2005-02-07, 22:03 h

thomas
Posts: 7721
User
Zitat:
text.ITextFont=(struct TextAttr *) IGraphics->OpenFont(font);

Das ist falsch. Du kannst keinen struct Font in einen struct TextAttr casten, das sind zwei verschiedene Dinge.

Korrekt ist es so:
code:
if (AslRequest (fontr,NULL))
   {
   text.ITextFont = &fontr->fo_Attr;
   PrintIText (win->RPort,&text,10,10);
   }


Gruß Thomas

--
Email: thomas-rapp@web.de
Home: home.t-online.de/home/thomas-rapp/

[ Dieser Beitrag wurde von thomas am 07.02.2005 editiert. ]

[ - Answer - Quote - Direct link - ]

2005-02-07, 23:40 h

Amigalien
Posts: 63
User
Danke für die schnelle Antwort. Ich werds gleich mal ausprobieren.

[ - Answer - Quote - Direct link - ]


-1- [ - Post reply - ]


amiga-news.de Forum > Programmierung > ASL Fontrequester & PrintIText (C Programmierung) [ - Search - New posts - Register - Login - ]


.
Masthead | Privacy policy | Netiquette | Advertising | Contact
Copyright © 1998-2025 by amiga-news.de - all rights reserved.
.