![]() |
DEUTSCHE VERSION |
|
![]() |
Links | | | Forums | | | Comments | | | Report news |
![]() |
Chat | | | Polls | | | Newsticker | | | Archive |
![]() |
amiga-news.de Forum > Programmierung > FontExtent() Problem //gcc 3.4.2 OS4 | [ - Search - New posts - Register - Login - ] |
-1- | [ - Post reply - ] |
2005-05-10, 15:56 h Amigalien Posts: 63 User |
Hallo, mir stürzt mein kleines Programm leider immer an der Funktion FontExtent() ab. Hoffentlich kann mir einer von euch da weiterhelfen. Vielen Dank im Vorraus... Was brauch ich: Ich möchte die X Größe (Width) eines Zeichens eines von mir vorher bestimmten Fonts herausfinden. Ausgabe: GFXBase: 25963296 IFace: 25964032 DFONTBase: 34080448 IFace: 34081232 1. OK... (45176590) Warnungen: KEINE Code: #include <interfaces/exec.h> #include <interfaces/graphics.h> #include <interfaces/diskfont.h> struct Library *DiskfontBase; struct Library *GfxBase; struct GraphicsIFace *IGraphics; struct DiskfontIFace *IDiskfont; struct ExecIFace *IExec; struct TextAttr itextfont; struct TextFont *textfont; struct TextExtent *textextent; // - - - - - - - - - - - - int main(void) { GfxBase = IExec->OpenLibrary("graphics.library",50); IGraphics = (struct GraphicsIFace *) IExec->GetInterface(GfxBase,"main",1,0); DiskfontBase = IExec->OpenLibrary("diskfont.library",50); IDiskfont = (struct DiskfontIFace *) IExec->GetInterface(DiskfontBase,"main",1,0); printf("GFXBase: %itIFace: %inDFONTBase: %itIFace: %in",GfxBase,IGraphics,DiskfontBase,IDiskfont); itextfont.ta_Name="Bitstream Vera Serif.font "; itextfont.ta_YSize=10; itextfont.ta_Style=(UBYTE) 0x0; itextfont.ta_Flags=(UBYTE) 0x2; textfont=IDiskfont->OpenDiskFont(&itextfont); printf("1. OK... (%i)n",textfont); IGraphics->FontExtent( (struct TextFont *) textfont, (struct TextExtent *) textextent); printf("2. OK... (%i)n",textextent); //anderer Code sowie Resourcen schließen return 0; } [ - Answer - Quote - Direct link - ] |
2005-05-10, 16:10 h thomas Posts: 7721 User |
Du solltest für textextent auch noch ein bißchen Speicher reservieren: printf("1. OK... (%i)n",textfont); textextent = IExec->AllocVec (sizeof(struct TextExtent),MEMF_CLEAR); printf("2. OK... (%i)n",textextent); IGraphics->FontExtent( (struct TextFont *) textfont, (struct TextExtent *) textextent); Gruß Thomas -- Email: thomas-rapp@web.de Home: home.t-online.de/home/thomas-rapp/ [ - Answer - Quote - Direct link - ] |
2005-05-10, 16:26 h Amigalien Posts: 63 User |
danke thomas...ich sollte dir auf der nächsten Amigamesse mal was ausgeben ![]() [ - Answer - Quote - Direct link - ] |
-1- | [ - Post reply - ] |
amiga-news.de Forum > Programmierung > FontExtent() Problem //gcc 3.4.2 OS4 | [ - Search - New posts - Register - Login - ] |
![]() |
Masthead |
Privacy policy |
Netiquette |
Advertising |
Contact
Copyright © 1998-2025 by amiga-news.de - all rights reserved. |
![]() |