home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / biblioteki / fontlib / fontlib.h next >
C/C++ Source or Header  |  1996-04-08  |  2KB  |  82 lines

  1. //
  2. // FontLib.h
  3. // Version 1.0
  4. //
  5. // FontLib ©1996 Henrik Isaksson
  6. // EMail: henriki@pluggnet.se
  7. // All Rights Reserved.
  8. //
  9. // This library is FreeWare.
  10. // If you plan to use any of theese funtions in commercial software,
  11. // ask me first at the address above.
  12. // I can not be held responsible for any damage or loss of data caused
  13. // by this software. Use it at your own risk.
  14. //
  15. // Questions and suggestions to: henriki@pluggnet.se
  16. //
  17.  
  18. #ifndef FONTLIB_H
  19. #define FONTLIB_H
  20.  
  21. //
  22. // Structs
  23. //
  24.  
  25. typedef struct {
  26.  struct FLFont *Next;    // Next FLFont
  27.  struct FLFont *Prev;    // Previous FLFont
  28.  struct TextAttr ta;    // TextAttr
  29.  struct TextFont *tf;    // TextFont
  30.  UWORD OpenCnt;
  31. } FLFont;
  32.  
  33. //
  34. // Macros & Defines
  35. //
  36.  
  37. #define TOPAZ8        "topaz.font",8,0,0
  38. #define TIMES11        "times.font",11,0,0
  39. #define TIMES24        "times.font",24,0,0
  40. #define XEN8        "xen.font",8,0,0
  41. #define XEN11        "xen.font",11,0,0
  42. #define XCOURIER11    "xcourier.font",11,0,0
  43. #define COURIER24    "courier.font",24,0,0
  44. // ^^^ Theese defines does not work with the macros below.
  45.  
  46. #define TEXTATTR(x,y,z,v)    ((FLFont *)FL_LoadFont(x,y,z,v)->ta)
  47. #define TEXTFONT(x,y,z,v)    ((FLFont *)FL_LoadFont(x,y,z,v)->tf)
  48. #define SETFONT(rp,x,y,z,v)    SetFont(rp,(struct TextFont *)((FLFont *)FL_LoadFont(x,y,z,v)->tf));
  49. #define SETWFONT(w,x,y,z,v)    SetFont(w->RPort,(struct TextFont *)((FLFont *)FL_LoadFont(x,y,z,v)->tf));
  50. #define SETWDRAW(w,fg,bg,drmd)    SetAPen(w->RPort,fg); SetBPen(w->RPort,bg); SetDrMd(w->RPort,drmd);
  51. #define WTEXT(w,x,y,txt)    Move(w->RPort,x,y+w->RPort->Font->tf_Baseline); Text(w->RPort,txt,strlen(txt));
  52.  
  53. //
  54. // Protos
  55. //
  56.  
  57. //
  58. // FL_LoadFont:
  59. //
  60. // Allocates a FLFont structure and tries to open the requested font.
  61. // The arguments will be copied to the TextAttr struct in FLFont.
  62. //
  63. // Returns FLFont or NULL if it fails.
  64. //
  65. FLFont *FL_LoadFont(STRPTR name, UWORD size, UBYTE style, UBYTE flags);
  66.  
  67. //
  68. // FL_FreeFont:
  69. //
  70. // Deallocates a FLFont structure.
  71. //
  72. void FL_FreeFont(FLFont *flf);
  73.  
  74. //
  75. // FL_FreeAll:
  76. //
  77. // Deallocates all FLFont structures used by this application.
  78. //
  79. void FL_FreeAll(void);
  80.  
  81. #endif
  82.