diskfont.pas 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998-2003 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. History:
  14. Added the defines use_amiga_smartlink and
  15. use_auto_openlib. Implemented autoopening
  16. of the library.
  17. 13 Jan 2003.
  18. Update for AmigaOS 3.9.
  19. FUNCTION GetDiskFontCtrl
  20. PROCEDURE SetDiskFontCtrlA
  21. Varargs for SetDiskFontCtrl is in
  22. systemvartags.
  23. Changed startup for library.
  24. 01 Feb 2003.
  25. Changed cardinal > longword.
  26. 09 Feb 2003.
  27. [email protected] Nils Sjoholm
  28. }
  29. {$PACKRECORDS 2}
  30. {$IFNDEF FPC_DOTTEDUNITS}
  31. unit diskfont;
  32. {$ENDIF FPC_DOTTEDUNITS}
  33. INTERFACE
  34. {$IFDEF FPC_DOTTEDUNITS}
  35. uses Amiga.Core.Exec, Amiga.Core.Agraphics,Amiga.Core.Utility;
  36. {$ELSE FPC_DOTTEDUNITS}
  37. uses exec, agraphics,utility;
  38. {$ENDIF FPC_DOTTEDUNITS}
  39. Const
  40. MAXFONTPATH = 256;
  41. Type
  42. pFontContents = ^tFontContents;
  43. tFontContents = record
  44. fc_FileName : Array [0..MAXFONTPATH-1] of AnsiChar;
  45. fc_YSize : Word;
  46. fc_Style : Byte;
  47. fc_Flags : Byte;
  48. end;
  49. pTFontContents = ^tTFontContents;
  50. tTFontContents = record
  51. tfc_FileName : Array[0..MAXFONTPATH-3] of AnsiChar;
  52. tfc_TagCount : Word;
  53. tfc_YSize : Word;
  54. tfc_Style,
  55. tfc_Flags : Byte;
  56. END;
  57. Const
  58. FCH_ID = $0f00;
  59. TFCH_ID = $0f02;
  60. OFCH_ID = $0f03;
  61. Type
  62. pFontContentsHeader = ^tFontContentsHeader;
  63. tFontContentsHeader = record
  64. fch_FileID : Word;
  65. fch_NumEntries : Word;
  66. end;
  67. Const
  68. DFH_ID = $0f80;
  69. MAXFONTNAME = 32;
  70. Type
  71. pDiskFontHeader = ^tDiskFontHeader;
  72. tDiskFontHeader = record
  73. dfh_DF : tNode;
  74. dfh_FileID : Word;
  75. dfh_Revision : Word;
  76. dfh_Segment : Longint;
  77. dfh_Name : Array [0..MAXFONTNAME-1] of AnsiChar;
  78. dfh_TF : tTextFont;
  79. end;
  80. Const
  81. AFB_MEMORY = 0;
  82. AFF_MEMORY = 1;
  83. AFB_DISK = 1;
  84. AFF_DISK = 2;
  85. AFB_SCALED = 2;
  86. AFF_SCALED = $0004;
  87. AFB_BITMAP = 3;
  88. AFF_BITMAP = $0008;
  89. AFB_TAGGED = 16;
  90. AFF_TAGGED = $10000;
  91. Type
  92. pAvailFonts = ^tAvailFonts;
  93. tAvailFonts = record
  94. af_Type : Word;
  95. af_Attr : tTextAttr;
  96. end;
  97. pTAvailFonts = ^tTAvailFonts;
  98. tTAvailFonts = record
  99. taf_Type : Word;
  100. taf_Attr : tTTextAttr;
  101. END;
  102. pAvailFontsHeader = ^tAvailFontsHeader;
  103. tAvailFontsHeader = record
  104. afh_NumEntries : Word;
  105. end;
  106. const
  107. DISKFONTNAME : PAnsiChar = 'diskfont.library';
  108. VAR DiskfontBase : pLibrary = nil;
  109. FUNCTION AvailFonts(buffer : PAnsiChar location 'a0'; bufBytes : LONGINT location 'd0'; flags : LONGINT location 'd1') : LONGINT; syscall DiskfontBase 036;
  110. PROCEDURE DisposeFontContents(fontContentsHeader : pFontContentsHeader location 'a1'); syscall DiskfontBase 048;
  111. FUNCTION NewFontContents(fontsLock : BPTR location 'a0'; fontName : PAnsiChar location 'a1') : pFontContentsHeader; syscall DiskfontBase 042;
  112. FUNCTION NewScaledDiskFont(sourceFont : pTextFont location 'a0'; destTextAttr : pTextAttr location 'a1') : pDiskFontHeader; syscall DiskfontBase 054;
  113. FUNCTION OpenDiskFont(textAttr : pTextAttr location 'a0') : pTextFont; syscall DiskfontBase 030;
  114. FUNCTION GetDiskFontCtrl(tagid : LONGINT location 'd0') : LONGINT; syscall DiskfontBase 060;
  115. PROCEDURE SetDiskFontCtrlA(taglist : pTagItem location 'a0'); syscall DiskfontBase 066;
  116. IMPLEMENTATION
  117. const
  118. { Change VERSION and LIBVERSION to proper values }
  119. VERSION : string[2] = '0';
  120. LIBVERSION : longword = 0;
  121. initialization
  122. DiskfontBase := OpenLibrary(DISKFONTNAME,LIBVERSION);
  123. finalization
  124. if Assigned(DiskfontBase) then
  125. CloseLibrary(DiskfontBase);
  126. END. (* UNIT DISKFONT *)