home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / oslib / oslib_1 / OSLib / User / h / font < prev    next >
Encoding:
Text File  |  1995-08-21  |  50.1 KB  |  1,591 lines

  1. #ifndef font_H
  2. #define font_H
  3.  
  4. /* C header file for Font
  5.  * written by DefMod (Jul 24 1995) on Mon Aug 21 19:04:08 1995
  6.  * Jonathan Coxhead, Acorn Computers Ltd
  7.  */
  8.  
  9. #ifndef types_H
  10. #include "types.h"
  11. #endif
  12.  
  13. #ifndef os_H
  14. #include "os.h"
  15. #endif
  16.  
  17. /**********************************
  18.  * SWI names and SWI reason codes *
  19.  **********************************/
  20. #undef  Font_CacheAddr
  21. #define Font_CacheAddr                          0x40080
  22. #undef  XFont_CacheAddr
  23. #define XFont_CacheAddr                         0x60080
  24. #undef  Font_FindFont
  25. #define Font_FindFont                           0x40081
  26. #undef  XFont_FindFont
  27. #define XFont_FindFont                          0x60081
  28. #undef  Font_LoseFont
  29. #define Font_LoseFont                           0x40082
  30. #undef  XFont_LoseFont
  31. #define XFont_LoseFont                          0x60082
  32. #undef  Font_ReadDefn
  33. #define Font_ReadDefn                           0x40083
  34. #undef  XFont_ReadDefn
  35. #define XFont_ReadDefn                          0x60083
  36. #undef  Font_ReadIdentifier
  37. #define Font_ReadIdentifier                     0x40083
  38. #undef  XFont_ReadIdentifier
  39. #define XFont_ReadIdentifier                    0x60083
  40. #undef  Font_ReadInfo
  41. #define Font_ReadInfo                           0x40084
  42. #undef  XFont_ReadInfo
  43. #define XFont_ReadInfo                          0x60084
  44. #undef  Font_StringWidth
  45. #define Font_StringWidth                        0x40085
  46. #undef  XFont_StringWidth
  47. #define XFont_StringWidth                       0x60085
  48. #undef  Font_Paint
  49. #define Font_Paint                              0x40086
  50. #undef  XFont_Paint
  51. #define XFont_Paint                             0x60086
  52. #undef  Font_Caret
  53. #define Font_Caret                              0x40087
  54. #undef  XFont_Caret
  55. #define XFont_Caret                             0x60087
  56. #undef  Font_ConverttoOS
  57. #define Font_ConverttoOS                        0x40088
  58. #undef  XFont_ConverttoOS
  59. #define XFont_ConverttoOS                       0x60088
  60. #undef  Font_Converttopoints
  61. #define Font_Converttopoints                    0x40089
  62. #undef  XFont_Converttopoints
  63. #define XFont_Converttopoints                   0x60089
  64. #undef  Font_SetFont
  65. #define Font_SetFont                            0x4008A
  66. #undef  XFont_SetFont
  67. #define XFont_SetFont                           0x6008A
  68. #undef  Font_CurrentFont
  69. #define Font_CurrentFont                        0x4008B
  70. #undef  XFont_CurrentFont
  71. #define XFont_CurrentFont                       0x6008B
  72. #undef  Font_FutureFont
  73. #define Font_FutureFont                         0x4008C
  74. #undef  XFont_FutureFont
  75. #define XFont_FutureFont                        0x6008C
  76. #undef  Font_FindCaret
  77. #define Font_FindCaret                          0x4008D
  78. #undef  XFont_FindCaret
  79. #define XFont_FindCaret                         0x6008D
  80. #undef  Font_CharBBox
  81. #define Font_CharBBox                           0x4008E
  82. #undef  XFont_CharBBox
  83. #define XFont_CharBBox                          0x6008E
  84. #undef  Font_ReadScaleFactor
  85. #define Font_ReadScaleFactor                    0x4008F
  86. #undef  XFont_ReadScaleFactor
  87. #define XFont_ReadScaleFactor                   0x6008F
  88. #undef  Font_SetScaleFactor
  89. #define Font_SetScaleFactor                     0x40090
  90. #undef  XFont_SetScaleFactor
  91. #define XFont_SetScaleFactor                    0x60090
  92. #undef  Font_ListFonts
  93. #define Font_ListFonts                          0x40091
  94. #undef  XFont_ListFonts
  95. #define XFont_ListFonts                         0x60091
  96. #undef  Font_SetFontColours
  97. #define Font_SetFontColours                     0x40092
  98. #undef  XFont_SetFontColours
  99. #define XFont_SetFontColours                    0x60092
  100. #undef  Font_SetPalette
  101. #define Font_SetPalette                         0x40093
  102. #undef  XFont_SetPalette
  103. #define XFont_SetPalette                        0x60093
  104. #undef  Font_SetTruePalette
  105. #define Font_SetTruePalette                     0x40093
  106. #undef  XFont_SetTruePalette
  107. #define XFont_SetTruePalette                    0x60093
  108. #undef  Font_ReadThresholds
  109. #define Font_ReadThresholds                     0x40094
  110. #undef  XFont_ReadThresholds
  111. #define XFont_ReadThresholds                    0x60094
  112. #undef  Font_SetThresholds
  113. #define Font_SetThresholds                      0x40095
  114. #undef  XFont_SetThresholds
  115. #define XFont_SetThresholds                     0x60095
  116. #undef  Font_FindCaretJ
  117. #define Font_FindCaretJ                         0x40096
  118. #undef  XFont_FindCaretJ
  119. #define XFont_FindCaretJ                        0x60096
  120. #undef  Font_StringBBox
  121. #define Font_StringBBox                         0x40097
  122. #undef  XFont_StringBBox
  123. #define XFont_StringBBox                        0x60097
  124. #undef  Font_ReadColourTable
  125. #define Font_ReadColourTable                    0x40098
  126. #undef  XFont_ReadColourTable
  127. #define XFont_ReadColourTable                   0x60098
  128. #undef  Font_MakeBitmap
  129. #define Font_MakeBitmap                         0x40099
  130. #undef  XFont_MakeBitmap
  131. #define XFont_MakeBitmap                        0x60099
  132. #undef  Font_UnCacheFile
  133. #define Font_UnCacheFile                        0x4009A
  134. #undef  XFont_UnCacheFile
  135. #define XFont_UnCacheFile                       0x6009A
  136. #undef  Font_SetFontMax
  137. #define Font_SetFontMax                         0x4009B
  138. #undef  XFont_SetFontMax
  139. #define XFont_SetFontMax                        0x6009B
  140. #undef  Font_ReadFontMax
  141. #define Font_ReadFontMax                        0x4009C
  142. #undef  XFont_ReadFontMax
  143. #define XFont_ReadFontMax                       0x6009C
  144. #undef  Font_ReadFontPrefix
  145. #define Font_ReadFontPrefix                     0x4009D
  146. #undef  XFont_ReadFontPrefix
  147. #define XFont_ReadFontPrefix                    0x6009D
  148. #undef  Font_SwitchOutputToBuffer
  149. #define Font_SwitchOutputToBuffer               0x4009E
  150. #undef  XFont_SwitchOutputToBuffer
  151. #define XFont_SwitchOutputToBuffer              0x6009E
  152. #undef  Font_ReadFontMetrics
  153. #define Font_ReadFontMetrics                    0x4009F
  154. #undef  XFont_ReadFontMetrics
  155. #define XFont_ReadFontMetrics                   0x6009F
  156. #undef  Font_DecodeMenu
  157. #define Font_DecodeMenu                         0x400A0
  158. #undef  XFont_DecodeMenu
  159. #define XFont_DecodeMenu                        0x600A0
  160. #undef  Font_ScanString
  161. #define Font_ScanString                         0x400A1
  162. #undef  XFont_ScanString
  163. #define XFont_ScanString                        0x600A1
  164. #undef  Font_SetColourTable
  165. #define Font_SetColourTable                     0x400A2
  166. #undef  XFont_SetColourTable
  167. #define XFont_SetColourTable                    0x600A2
  168. #undef  Font_CurrentRGB
  169. #define Font_CurrentRGB                         0x400A3
  170. #undef  XFont_CurrentRGB
  171. #define XFont_CurrentRGB                        0x600A3
  172. #undef  Font_FutureRGB
  173. #define Font_FutureRGB                          0x400A4
  174. #undef  XFont_FutureRGB
  175. #define XFont_FutureRGB                         0x600A4
  176. #undef  Font_ReadEncodingFilename
  177. #define Font_ReadEncodingFilename               0x400A5
  178. #undef  XFont_ReadEncodingFilename
  179. #define XFont_ReadEncodingFilename              0x600A5
  180. #undef  Font_FindField
  181. #define Font_FindField                          0x400A6
  182. #undef  XFont_FindField
  183. #define XFont_FindField                         0x600A6
  184. #undef  Font_ApplyFields
  185. #define Font_ApplyFields                        0x400A7
  186. #undef  XFont_ApplyFields
  187. #define XFont_ApplyFields                       0x600A7
  188. #undef  Font_LookupFont
  189. #define Font_LookupFont                         0x400A8
  190. #undef  XFont_LookupFont
  191. #define XFont_LookupFont                        0x600A8
  192. #undef  Service_FontsChanged
  193. #define Service_FontsChanged                    0x6E
  194.  
  195. /************************************
  196.  * Structure and union declarations *
  197.  ************************************/
  198. typedef struct font_paint_block                 font_paint_block;
  199. typedef struct font_scan_block                  font_scan_block;
  200. typedef struct font_thresholds                  font_thresholds;
  201. typedef struct font_colour_table                font_colour_table;
  202. typedef struct font_bbox_info                   font_bbox_info;
  203. typedef struct font_width_info                  font_width_info;
  204. typedef struct font_misc_info                   font_misc_info;
  205. typedef struct font_long_kern_pair              font_long_kern_pair;
  206. typedef union  font_kern_info                   font_kern_info;
  207.  
  208. /********************
  209.  * Type definitions *
  210.  ********************/
  211. typedef bits font_string_flags;
  212.       /*Flags for painting and scanning strings*/
  213.  
  214. typedef byte font_f;
  215.  
  216. struct font_paint_block
  217.    {  os_coord space;
  218.       os_coord letter;
  219.       os_box rubout;
  220.    };
  221.  
  222. struct font_scan_block
  223.    {  os_coord space;
  224.       os_coord letter;
  225.       int split_char;
  226.       os_box bbox;
  227.    };
  228.  
  229. struct font_thresholds
  230.    {  byte t [UNKNOWN];
  231.    };
  232.  
  233. #define font_THRESHOLDS(N) \
  234.    struct \
  235.       {  byte t [N]; \
  236.       }
  237.  
  238. #define font_SIZEOF_THRESHOLDS(N) \
  239.    ((N)*sizeof ((font_thresholds *) NULL)->t)
  240.  
  241. struct font_colour_table
  242.    {  byte c [UNKNOWN];
  243.    };
  244.  
  245. #define font_COLOUR_TABLE(N) \
  246.    struct \
  247.       {  byte c [N]; \
  248.       }
  249.  
  250. #define font_SIZEOF_COLOUR_TABLE(N) \
  251.    ((N)*sizeof ((font_colour_table *) NULL)->c)
  252.  
  253. typedef bits font_bitmap_type;
  254.  
  255. typedef bits font_characteristic_flags;
  256.  
  257. typedef int font_list_context;
  258.  
  259. typedef bits font_kern_flags;
  260.  
  261. typedef bits font_metric_flags;
  262.  
  263. struct font_bbox_info
  264.    {  os_box bboxes [256];
  265.    };
  266.  
  267. struct font_width_info
  268.    {  int widths [256];
  269.    };
  270.  
  271. struct font_misc_info
  272.    {  short x0;
  273.       short y0;
  274.       short x1;
  275.       short y1;
  276.       short xkern;
  277.       short ykern;
  278.       short italic_correction;
  279.       byte underline_position;
  280.       byte underline_thickness;
  281.       short cap_height;
  282.       short xheight;
  283.       short descender;
  284.       short ascender;
  285.       int reserved;
  286.    };
  287.  
  288. typedef bits font_short_kern_pair;
  289.  
  290. struct font_long_kern_pair
  291.    {  int c;
  292.       int xkern;
  293.       int ykern;
  294.    };
  295.  
  296. union font_kern_info
  297.    {  struct
  298.       {  int table [256];
  299.          int size;
  300.          font_kern_flags flags;
  301.          font_long_kern_pair pairs [UNKNOWN];
  302.       }
  303.       long_info;
  304.       struct
  305.       {  int table [256];
  306.          int size;
  307.          font_kern_flags flags;
  308.          font_short_kern_pair pairs [UNKNOWN];
  309.       }
  310.       short_info;
  311.    };
  312.  
  313. typedef bits font_decode_flags;
  314.  
  315. /************************
  316.  * Constant definitions *
  317.  ************************/
  318. #define font_OS_UNIT                            400
  319.       /*1 O S unit in millipoints*/
  320. #define font_INCH                               72000
  321.       /*1in in millipoints*/
  322. #define font_POINT                              1000
  323.       /*1pt in millipoints*/
  324. #define font_COMMAND_NULL                       ((char) '\x00')
  325. #define font_COMMAND_XMOVE                      ((char) '\x09')
  326. #define font_COMMAND_LINEFEED                   ((char) '\x0A')
  327. #define font_COMMAND_YMOVE                      ((char) '\x0B')
  328. #define font_COMMAND_RETURN                     ((char) '\x0D')
  329. #define font_COMMAND_GCOL                       ((char) '\x11')
  330. #define font_COMMAND_COLOURS                    ((char) '\x12')
  331. #define font_COMMAND_TRUE_COLOURS               ((char) '\x13')
  332. #define font_COMMAND_COMMENT                    ((char) '\x15')
  333. #define font_COMMAND_UNDERLINE                  ((char) '\x19')
  334. #define font_COMMAND_FONT                       ((char) '\x1A')
  335. #define font_COMMAND_HOM_TRFM                   ((char) '\x1B')
  336. #define font_COMMAND_TRFM                       ((char) '\x1C')
  337. #define font_JUSTIFY                            ((font_string_flags) 0x1u)
  338.       /*Use when painting*/
  339. #define font_RUBOUT                             ((font_string_flags) 0x2u)
  340.       /*Use when painting*/
  341. #define font_OS_UNITS                           ((font_string_flags) 0x10u)
  342.       /*Use when painting, scanning, caret or charbbox*/
  343. #define font_GIVEN_BLOCK                        ((font_string_flags) 0x20u)
  344.       /*Use when painting or scanning*/
  345. #define font_GIVEN_TRFM                         ((font_string_flags) 0x40u)
  346.       /*Use when painting or scanning*/
  347. #define font_GIVEN_LENGTH                       ((font_string_flags) 0x80u)
  348.       /*Use when painting or scanning*/
  349. #define font_GIVEN_FONT                         ((font_string_flags) 0x100u)
  350.       /*Use when painting or scanning*/
  351. #define font_KERN                               ((font_string_flags) 0x200u)
  352.       /*Use when painting or scanning*/
  353. #define font_RIGHT_TO_LEFT                      ((font_string_flags) 0x400u)
  354.       /*Use when painting or scanning*/
  355. #define font_RETURN_CARET_POS                   ((font_string_flags) 0x20000u)
  356.       /*Use when scanning*/
  357. #define font_RETURN_BBOX                        ((font_string_flags) 0x40000u)
  358.       /*Use when scanning*/
  359. #define font_RETURN_MATRIX                      ((font_string_flags) 0x80000u)
  360.       /*Use when scanning*/
  361. #define font_RETURN_SPLIT_COUNT                 ((font_string_flags) 0x100000u)
  362.       /*Use when scanning*/
  363. #define font_NO_OUTPUT                          0x1u
  364. #define font_ADD_HINTS                          0x2u
  365. #define font_OUTPUT_SKELETON                    0x4u
  366. #define font_CONVERT_BITMAP                     0x8u
  367. #define font_ERROR_IF_BITMAP                    0x10u
  368. #define error_FONT_NO_ROOM                      0x200u
  369.       /*Not enough memory for Font cache*/
  370. #define error_FONT_CACHE_FULL                   0x201u
  371.       /*Font cache full*/
  372. #define error_FONT_NO_CACHE                     0x202u
  373.       /*No font cache present*/
  374. #define error_FONT_TOO_LONG                     0x203u
  375.       /*String too long*/
  376. #define error_FONT64K                           0x204u
  377.       /*Font definition too large*/
  378. #define error_FONT_PAL_TOO_BIG                  0x205u
  379.       /*Undefined font colour*/
  380. #define error_FONT_BAD_TRAN_BITS                0x206u
  381.       /*Invalid data passed to Font_SetTransfer*/
  382. #define error_FONT_NOT_ENOUGH_BITS              0x207u
  383.       /*Invalid font colour*/
  384. #define error_FONT_NO_FONT                      0x208u
  385.       /*Undefined font handle*/
  386. #define error_FONT_NO_PIXELS                    0x209u
  387.       /*No pixel data for this font*/
  388. #define error_FONT_BAD_FONT_NUMBER              0x20Au
  389.       /*Font handle out of range*/
  390. #define error_FONT_NOT_FOUND                    0x20Bu
  391.       /*%0 font not found*/
  392. #define error_FONT_BAD_FONT_FILE                0x20Cu
  393.       /*Illegal font file*/
  394. #define error_FONT_NO_HANDLES                   0x20Du
  395.       /*No more font handles*/
  396. #define error_FONT_BAD_COUNTER                  0x20Eu
  397.       /*Fonts must be read sequentially*/
  398. #define error_FONT_BAD_CTRL_CHAR                0x20Fu
  399.       /*Illegal control character in font string*/
  400. #define error_FONTS_IN_USE                      0x210u
  401.       /*Font manager in use*/
  402. #define error_FONT_BAD_SEGMENT                  0x211u
  403.       /*Illegal line segment in outline font*/
  404. #define error_FONT_BAD_PREFIX                   0x212u
  405.       /*%1 (while scanning Font$Path)*/
  406. #define error_FONT_RESERVED                     0x213u
  407.       /*Reserved fields must be zero*/
  408. #define error_FONT_BAD_CHAR_CODE                0x214u
  409.       /*Character code out of range*/
  410. #define error_FONT_NO_BITMAPS                   0x215u
  411.       /*ROM font directory cannot contain bitmaps*/
  412. #define error_FONT_NO_BITMAPS2                  0x216u
  413.       /*Can't convert bitmap characters into outlines*/
  414. #define error_FONT_BAD_FONT_CACHE_FILE          0x217u
  415.       /*Invalid font cache file*/
  416. #define error_FONT_FIELD_NOT_FOUND              0x218u
  417.       /*%0 field not present in font string*/
  418. #define error_FONT_BAD_MATRIX                   0x219u
  419.       /*Invalid matrix passed to Font Manager*/
  420. #define error_FONT_OVERFLOW                     0x21Au
  421.       /*Number too big*/
  422. #define error_FONT_DIVBY0                       0x21Bu
  423.       /*Division by zero*/
  424. #define error_FONT_BAD_READ_METRICS             0x21Cu
  425.       /*Font_ReadFontMetrics not allowed on a transformed font*/
  426. #define error_FONT_BAD_RGB                      0x21Du
  427.       /*Undefined RGB font colours*/
  428. #define error_FONT_ENCODING_NOT_FOUND           0x21Eu
  429.       /*%0 encoding not found*/
  430. #define error_FONT_MUST_HAVE_SLASH              0x21Fu
  431.       /*Identifier '%1' should be preceded by '/' in encoding '%0'*/
  432. #define error_FONT_BAD_ENCODING_SIZE            0x220u
  433.       /*Max total size of input and output encoding files is 16k*/
  434. #define error_FONT_TOO_MANY_IDS                 0x221u
  435.       /*Too many identifiers in %0 encoding*/
  436. #define error_FONT_TOO_FEW_IDS                  0x222u
  437.       /*Not enough identifiers in %0 encoding*/
  438. #define error_FONT_NO_BASE_ENCODING             0x223u
  439.       /*Base encoding %0 not found*/
  440. #define error_FONT_IDENTIFIER_NOT_FOUND         0x224u
  441.       /*Identifier %1 not found in encoding %0*/
  442. #define error_FONT_TOO_MANY_CHUNKS              0x225u
  443.       /*Too many characters in %0*/
  444. #define error_FONT_BAD_FONT_FILE2               0x226u
  445.       /*Illegal font file in %0*/
  446. #define error_FONT_DATA_NOT_FOUND               0x20Bu
  447.       /*Font data not found*/
  448. #define error_FONT_DATA_NOT_FOUND2              0x20Bu
  449.       /*No suitable font data for %0*/
  450. #define font_NAME_LIMIT                         40
  451. #define font_SYSTEM                             ((font_f) 0x0u)
  452.       /*Value used as system font or no font*/
  453. #define font_CURRENT                            ((font_f) 0x0u)
  454.       /*Value for scanning*/
  455. #define font_BITMAP_DEEP                        ((font_bitmap_type) 0x1u)
  456. #define font_BITMAP_HORIZONTAL_SUB_PIXEL        ((font_bitmap_type) 0x2u)
  457. #define font_BITMAP_VERTICAL_SUB_PIXEL          ((font_bitmap_type) 0x4u)
  458. #define font_BITMAP_DELETE                      ((font_bitmap_type) 0x8u)
  459. #define font_CHARACTERISTIC_OLD_FORMAT          ((font_characteristic_flags) 0x1u)
  460. #define font_CHARACTERISTIC_ROM                 ((font_characteristic_flags) 0x2u)
  461. #define font_CHARACTERISTIC_MONOCHROME          ((font_characteristic_flags) 0x4u)
  462. #define font_CHARACTERISTIC_FILL_RULE_NON_ZERO  ((font_characteristic_flags) 0x8u)
  463. #define font_RETURN_FONT_NAME                   ((font_list_context) 0x10000u)
  464. #define font_RETURN_LOCAL_FONT_NAME             ((font_list_context) 0x20000u)
  465. #define font_USE_LINEFEED                       ((font_list_context) 0x40000u)
  466. #define font_RETURN_FONT_MENU                   ((font_list_context) 0x80000u)
  467. #define font_ALLOW_SYSTEM_FONT                  ((font_list_context) 0x100000u)
  468. #define font_GIVEN_TICK                         ((font_list_context) 0x200000u)
  469. #define font_RETURN_ENCODING_MENU               ((font_list_context) 0x480000u)
  470. #define font_TICK_NONE                          ((char *) 0x0u)
  471. #define font_TICK_SYSTEM_FONT                   ((char *) 0x1u)
  472. #define font_KERN_NO_BBOXES                     ((font_kern_flags) 0x1u)
  473. #define font_KERN_NO_XOFFSETS                   ((font_kern_flags) 0x2u)
  474. #define font_KERN_NO_YOFFSETS                   ((font_kern_flags) 0x4u)
  475. #define font_METRICS_KERN_YONLY                 ((font_metric_flags) 0x2u)
  476. #define font_METRICS_KERN_XONLY                 ((font_metric_flags) 0x4u)
  477. #define font_METRICS_MANY_KERN_PAIRS            ((font_metric_flags) 0x8u)
  478. #define font_GIVEN_ENCODING_MENU                0x1u
  479.  
  480. /*************************
  481.  * Function declarations *
  482.  *************************/
  483.  
  484. #ifdef __cplusplus
  485.    extern "C" {
  486. #endif
  487.  
  488. /* ------------------------------------------------------------------------
  489.  * Function:      font_cache_addr()
  490.  *
  491.  * Description:   Gets the version number, font cache size and amount used
  492.  *
  493.  * Output:        version - value of R0 on exit
  494.  *                cache_size - value of R2 on exit
  495.  *                cache_used - value of R3 on exit
  496.  *
  497.  * Other notes:   Calls SWI 0x40080.
  498.  */
  499.  
  500. extern os_error *xfont_cache_addr (int *version,
  501.       int *cache_size,
  502.       int *cache_used);
  503. extern void font_cache_addr (int *version,
  504.       int *cache_size,
  505.       int *cache_used);
  506.  
  507. /* ------------------------------------------------------------------------
  508.  * Function:      font_find_font()
  509.  *
  510.  * Description:   Gets the handle for a font
  511.  *
  512.  * Input:         font_name - value of R1 on entry
  513.  *                xsize - value of R2 on entry
  514.  *                ysize - value of R3 on entry
  515.  *                xres - value of R4 on entry
  516.  *                yres - value of R5 on entry
  517.  *
  518.  * Output:        font - value of R0 on exit (X version only)
  519.  *                xres_out - value of R4 on exit
  520.  *                yres_out - value of R5 on exit
  521.  *
  522.  * Returns:       R0 (non-X version only)
  523.  *
  524.  * Other notes:   Calls SWI 0x40081.
  525.  */
  526.  
  527. extern os_error *xfont_find_font (char const *font_name,
  528.       int xsize,
  529.       int ysize,
  530.       int xres,
  531.       int yres,
  532.       font_f *font,
  533.       int *xres_out,
  534.       int *yres_out);
  535. extern font_f font_find_font (char const *font_name,
  536.       int xsize,
  537.       int ysize,
  538.       int xres,
  539.       int yres,
  540.       int *xres_out,
  541.       int *yres_out);
  542.  
  543. /* ------------------------------------------------------------------------
  544.  * Function:      font_lose_font()
  545.  *
  546.  * Description:   Finishes use of a font
  547.  *
  548.  * Input:         font - value of R0 on entry
  549.  *
  550.  * Other notes:   Calls SWI 0x40082.
  551.  */
  552.  
  553. extern os_error *xfont_lose_font (font_f font);
  554. __swi (0x40082) void font_lose_font (font_f font);
  555.  
  556. /* ------------------------------------------------------------------------
  557.  * Function:      font_read_defn()
  558.  *
  559.  * Description:   Reads details about a font
  560.  *
  561.  * Input:         font - value of R0 on entry
  562.  *
  563.  * Output:        xsize - value of R2 on exit
  564.  *                ysize - value of R3 on exit
  565.  *                xres - value of R4 on exit
  566.  *                yres - value of R5 on exit
  567.  *                age - value of R6 on exit
  568.  *                usage_count - value of R7 on exit
  569.  *
  570.  * Other notes:   Calls SWI 0x40083 with R3 = 0x0.
  571.  */
  572.  
  573. extern os_error *xfont_read_defn (font_f font,
  574.       int *xsize,
  575.       int *ysize,
  576.       int *xres,
  577.       int *yres,
  578.       int *age,
  579.       int *usage_count);
  580. extern void font_read_defn (font_f font,
  581.       int *xsize,
  582.       int *ysize,
  583.       int *xres,
  584.       int *yres,
  585.       int *age,
  586.       int *usage_count);
  587.  
  588. /* ------------------------------------------------------------------------
  589.  * Function:      font_read_identifier()
  590.  *
  591.  * Description:   Reads the full font identifier
  592.  *
  593.  * Input:         font - value of R0 on entry
  594.  *                buffer - value of R1 on entry
  595.  *
  596.  * Output:        used - value of R2 on exit (X version only)
  597.  *
  598.  * Returns:       R2 (non-X version only)
  599.  *
  600.  * Other notes:   Calls SWI 0x40083 with R3 = 0x4C4C5546.
  601.  */
  602.  
  603. extern os_error *xfont_read_identifier (font_f font,
  604.       byte *buffer,
  605.       int *used);
  606. extern int font_read_identifier (font_f font,
  607.       byte *buffer);
  608.  
  609. /* ------------------------------------------------------------------------
  610.  * Function:      font_read_info()
  611.  *
  612.  * Description:   Gets the font bounding box
  613.  *
  614.  * Input:         font - value of R0 on entry
  615.  *
  616.  * Output:        x0 - value of R1 on exit
  617.  *                y0 - value of R2 on exit
  618.  *                x1 - value of R3 on exit
  619.  *                y1 - value of R4 on exit
  620.  *
  621.  * Other notes:   Calls SWI 0x40084.
  622.  */
  623.  
  624. extern os_error *xfont_read_info (font_f font,
  625.       int *x0,
  626.       int *y0,
  627.       int *x1,
  628.       int *y1);
  629. extern void font_read_info (font_f font,
  630.       int *x0,
  631.       int *y0,
  632.       int *x1,
  633.       int *y1);
  634.  
  635. /* ------------------------------------------------------------------------
  636.  * Function:      font_string_width()
  637.  *
  638.  * Description:   Calculates how wide a string would be in the current font
  639.  *                - prefer Font_ScanString
  640.  *
  641.  * Input:         s - value of R1 on entry
  642.  *                xmax - value of R2 on entry
  643.  *                ymax - value of R3 on entry
  644.  *                split - value of R4 on entry
  645.  *                length - value of R5 on entry
  646.  *
  647.  * Output:        split_point - value of R1 on exit
  648.  *                x - value of R2 on exit
  649.  *                y - value of R3 on exit
  650.  *                length_out - value of R4 on exit
  651.  *                index_out - value of R5 on exit
  652.  *
  653.  * Other notes:   Calls SWI 0x40085.
  654.  */
  655.  
  656. extern os_error *xfont_string_width (char const *s,
  657.       int xmax,
  658.       int ymax,
  659.       int split,
  660.       int length,
  661.       char **split_point,
  662.       int *x,
  663.       int *y,
  664.       int *length_out,
  665.       int *index_out);
  666. extern void font_string_width (char const *s,
  667.       int xmax,
  668.       int ymax,
  669.       int split,
  670.       int length,
  671.       char **split_point,
  672.       int *x,
  673.       int *y,
  674.       int *length_out,
  675.       int *index_out);
  676.  
  677. /* ------------------------------------------------------------------------
  678.  * Function:      font_paint()
  679.  *
  680.  * Description:   Writes a string to the screen
  681.  *
  682.  * Input:         font - value of R0 on entry
  683.  *                string - value of R1 on entry
  684.  *                flags - value of R2 on entry
  685.  *                xpos - value of R3 on entry
  686.  *                ypos - value of R4 on entry
  687.  *                block - value of R5 on entry
  688.  *                trfm - value of R6 on entry
  689.  *                length - value of R7 on entry
  690.  *
  691.  * Other notes:   Calls SWI 0x40086.
  692.  */
  693.  
  694. extern os_error *xfont_paint (font_f font,
  695.       char const *string,
  696.       font_string_flags flags,
  697.       int xpos,
  698.       int ypos,
  699.       font_paint_block const *block,
  700.       os_trfm const *trfm,
  701.       int length);
  702. extern void font_paint (font_f font,
  703.       char const *string,
  704.       font_string_flags flags,
  705.       int xpos,
  706.       int ypos,
  707.       font_paint_block const *block,
  708.       os_trfm const *trfm,
  709.       int length);
  710.  
  711. /* ------------------------------------------------------------------------
  712.  * Function:      font_caret()
  713.  *
  714.  * Description:   Defines text cursor for Font Manager
  715.  *
  716.  * Input:         colour_number - value of R0 on entry
  717.  *                height - value of R1 on entry
  718.  *                unit_flags - value of R2 on entry
  719.  *                x - value of R3 on entry
  720.  *                y - value of R4 on entry
  721.  *
  722.  * Other notes:   Calls SWI 0x40087.
  723.  */
  724.  
  725. extern os_error *xfont_caret (os_colour_number colour_number,
  726.       int height,
  727.       font_string_flags unit_flags,
  728.       int x,
  729.       int y);
  730. extern void font_caret (os_colour_number colour_number,
  731.       int height,
  732.       font_string_flags unit_flags,
  733.       int x,
  734.       int y);
  735.  
  736. /* ------------------------------------------------------------------------
  737.  * Function:      font_convertto_os()
  738.  *
  739.  * Description:   Converts internal coordinates to OS coordinates
  740.  *
  741.  * Input:         x - value of R1 on entry
  742.  *                y - value of R2 on entry
  743.  *
  744.  * Output:        x_out - value of R1 on exit
  745.  *                y_out - value of R2 on exit
  746.  *
  747.  * Other notes:   Calls SWI 0x40088.
  748.  */
  749.  
  750. extern os_error *xfont_convertto_os (int x,
  751.       int y,
  752.       int *x_out,
  753.       int *y_out);
  754. extern void font_convertto_os (int x,
  755.       int y,
  756.       int *x_out,
  757.       int *y_out);
  758.  
  759. /* ------------------------------------------------------------------------
  760.  * Function:      font_converttopoints()
  761.  *
  762.  * Description:   Converts OS coordinates to internal coordinates
  763.  *
  764.  * Input:         x - value of R1 on entry
  765.  *                y - value of R2 on entry
  766.  *
  767.  * Output:        x_out - value of R1 on exit
  768.  *                y_out - value of R2 on exit
  769.  *
  770.  * Other notes:   Calls SWI 0x40089.
  771.  */
  772.  
  773. extern os_error *xfont_converttopoints (int x,
  774.       int y,
  775.       int *x_out,
  776.       int *y_out);
  777. extern void font_converttopoints (int x,
  778.       int y,
  779.       int *x_out,
  780.       int *y_out);
  781.  
  782. /* ------------------------------------------------------------------------
  783.  * Function:      font_set_font()
  784.  *
  785.  * Description:   Selects the font to be subsequently used
  786.  *
  787.  * Input:         font - value of R0 on entry
  788.  *
  789.  * Other notes:   Calls SWI 0x4008A.
  790.  */
  791.  
  792. extern os_error *xfont_set_font (font_f font);
  793. __swi (0x4008A) void font_set_font (font_f font);
  794.  
  795. /* ------------------------------------------------------------------------
  796.  * Function:      font_current_font()
  797.  *
  798.  * Description:   Gets the current font handle and colours
  799.  *
  800.  * Output:        font - value of R0 on exit (X version only)
  801.  *                bg_hint - value of R1 on exit
  802.  *                fill - value of R2 on exit
  803.  *                offset - value of R3 on exit
  804.  *
  805.  * Returns:       R0 (non-X version only)
  806.  *
  807.  * Other notes:   Calls SWI 0x4008B.
  808.  */
  809.  
  810. extern os_error *xfont_current_font (font_f *font,
  811.       os_gcol *bg_hint,
  812.       os_gcol *fill,
  813.       int *offset);
  814. extern font_f font_current_font (os_gcol *bg_hint,
  815.       os_gcol *fill,
  816.       int *offset);
  817.  
  818. /* ------------------------------------------------------------------------
  819.  * Function:      font_future_font()
  820.  *
  821.  * Description:   Checks font characteristics after Font_StringWidth
  822.  *
  823.  * Output:        font - value of R0 on exit (X version only)
  824.  *                bg_hint - value of R1 on exit
  825.  *                fill - value of R2 on exit
  826.  *                offset - value of R3 on exit
  827.  *
  828.  * Returns:       R0 (non-X version only)
  829.  *
  830.  * Other notes:   Calls SWI 0x4008C.
  831.  */
  832.  
  833. extern os_error *xfont_future_font (font_f *font,
  834.       os_gcol *bg_hint,
  835.       os_gcol *fill,
  836.       int *offset);
  837. extern font_f font_future_font (os_gcol *bg_hint,
  838.       os_gcol *fill,
  839.       int *offset);
  840.  
  841. /* ------------------------------------------------------------------------
  842.  * Function:      font_find_caret()
  843.  *
  844.  * Description:   Finds where the caret is in a string
  845.  *
  846.  * Input:         s - value of R1 on entry
  847.  *                x - value of R2 on entry
  848.  *                y - value of R3 on entry
  849.  *
  850.  * Output:        split_point - value of R1 on exit
  851.  *                x_out - value of R2 on exit
  852.  *                y_out - value of R3 on exit
  853.  *                length_out - value of R4 on exit
  854.  *                index_out - value of R5 on exit
  855.  *
  856.  * Other notes:   Calls SWI 0x4008D.
  857.  */
  858.  
  859. extern os_error *xfont_find_caret (char const *s,
  860.       int x,
  861.       int y,
  862.       char **split_point,
  863.       int *x_out,
  864.       int *y_out,
  865.       int *length_out,
  866.       int *index_out);
  867. extern void font_find_caret (char const *s,
  868.       int x,
  869.       int y,
  870.       char **split_point,
  871.       int *x_out,
  872.       int *y_out,
  873.       int *length_out,
  874.       int *index_out);
  875.  
  876. /* ------------------------------------------------------------------------
  877.  * Function:      font_char_bbox()
  878.  *
  879.  * Description:   Gets the bounding box of a character
  880.  *
  881.  * Input:         font - value of R0 on entry
  882.  *                c - value of R1 on entry
  883.  *                unit_flags - value of R2 on entry
  884.  *
  885.  * Output:        x0 - value of R1 on exit
  886.  *                y0 - value of R2 on exit
  887.  *                x1 - value of R3 on exit
  888.  *                y1 - value of R4 on exit
  889.  *
  890.  * Other notes:   Calls SWI 0x4008E.
  891.  */
  892.  
  893. extern os_error *xfont_char_bbox (font_f font,
  894.       char c,
  895.       font_string_flags unit_flags,
  896.       int *x0,
  897.       int *y0,
  898.       int *x1,
  899.       int *y1);
  900. extern void font_char_bbox (font_f font,
  901.       char c,
  902.       font_string_flags unit_flags,
  903.       int *x0,
  904.       int *y0,
  905.       int *x1,
  906.       int *y1);
  907.  
  908. /* ------------------------------------------------------------------------
  909.  * Function:      font_read_scale_factor()
  910.  *
  911.  * Description:   Reads the internal to OS conversion factor
  912.  *
  913.  * Output:        xfactor - value of R1 on exit
  914.  *                yfactor - value of R2 on exit
  915.  *
  916.  * Other notes:   Calls SWI 0x4008F.
  917.  */
  918.  
  919. extern os_error *xfont_read_scale_factor (int *xfactor,
  920.       int *yfactor);
  921. extern void font_read_scale_factor (int *xfactor,
  922.       int *yfactor);
  923.  
  924. /* ------------------------------------------------------------------------
  925.  * Function:      font_set_scale_factor()
  926.  *
  927.  * Description:   Sets the internal to OS conversion factor
  928.  *
  929.  * Input:         xfactor - value of R1 on entry
  930.  *                yfactor - value of R2 on entry
  931.  *
  932.  * Other notes:   Calls SWI 0x40090.
  933.  */
  934.  
  935. extern os_error *xfont_set_scale_factor (int xfactor,
  936.       int yfactor);
  937. extern void font_set_scale_factor (int xfactor,
  938.       int yfactor);
  939.  
  940. /* ------------------------------------------------------------------------
  941.  * Function:      font_list_fonts()
  942.  *
  943.  * Description:   Scans for fonts, returning their identifiers one at a
  944.  *                time; or or builds a menu of fonts
  945.  *
  946.  * Input:         buffer1 - value of R1 on entry
  947.  *                context - value of R2 on entry
  948.  *                size1 - value of R3 on entry
  949.  *                buffer2 - value of R4 on entry
  950.  *                size2 - value of R5 on entry
  951.  *                tick_font - value of R6 on entry
  952.  *
  953.  * Output:        context_out - value of R2 on exit (X version only)
  954.  *                used1 - value of R3 on exit
  955.  *                used2 - value of R5 on exit
  956.  *
  957.  * Returns:       R2 (non-X version only)
  958.  *
  959.  * Other notes:   Calls SWI 0x40091.
  960.  */
  961.  
  962. extern os_error *xfont_list_fonts (byte *buffer1,
  963.       font_list_context context,
  964.       int size1,
  965.       byte *buffer2,
  966.       int size2,
  967.       char const *tick_font,
  968.       font_list_context *context_out,
  969.       int *used1,
  970.       int *used2);
  971. extern font_list_context font_list_fonts (byte *buffer1,
  972.       font_list_context context,
  973.       int size1,
  974.       byte *buffer2,
  975.       int size2,
  976.       char const *tick_font,
  977.       int *used1,
  978.       int *used2);
  979.  
  980. /* ------------------------------------------------------------------------
  981.  * Function:      font_set_font_colours()
  982.  *
  983.  * Description:   Changes the current colours and (optionally) the current
  984.  *                font - prefer ColourTrans_SetFontColours
  985.  *
  986.  * Input:         font - value of R0 on entry
  987.  *                bg_hint - value of R1 on entry
  988.  *                fill - value of R2 on entry
  989.  *                offset - value of R3 on entry
  990.  *
  991.  * Other notes:   Calls SWI 0x40092.
  992.  */
  993.  
  994. extern os_error *xfont_set_font_colours (font_f font,
  995.       os_gcol bg_hint,
  996.       os_gcol fill,
  997.       int offset);
  998. __swi (0x40092) void font_set_font_colours (font_f font,
  999.       os_gcol bg_hint,
  1000.       os_gcol fill,
  1001.       int offset);
  1002.  
  1003. /* ------------------------------------------------------------------------
  1004.  * Function:      font_set_palette()
  1005.  *
  1006.  * Description:   Defines the anti-alias palette
  1007.  *
  1008.  * Input:         bg_hint - value of R1 on entry
  1009.  *                fill - value of R2 on entry
  1010.  *                offset - value of R3 on entry
  1011.  *                bg_hint_out - value of R4 on entry
  1012.  *                fill_out - value of R5 on entry
  1013.  *
  1014.  * Other notes:   Calls SWI 0x40093 with R6 = 0x0.
  1015.  */
  1016.  
  1017. extern os_error *xfont_set_palette (os_gcol bg_hint,
  1018.       os_gcol fill,
  1019.       int offset,
  1020.       os_colour bg_hint_out,
  1021.       os_colour fill_out);
  1022. extern void font_set_palette (os_gcol bg_hint,
  1023.       os_gcol fill,
  1024.       int offset,
  1025.       os_colour bg_hint_out,
  1026.       os_colour fill_out);
  1027.  
  1028. /* ------------------------------------------------------------------------
  1029.  * Function:      font_set_true_palette()
  1030.  *
  1031.  * Description:   Defines the anti-alias palette with true colour values
  1032.  *
  1033.  * Input:         bg_hint - value of R1 on entry
  1034.  *                fill - value of R2 on entry
  1035.  *                offset - value of R3 on entry
  1036.  *                bg_hint_out - value of R4 on entry
  1037.  *                fill_out - value of R5 on entry
  1038.  *
  1039.  * Other notes:   Calls SWI 0x40093 with R6 = 0x65757254.
  1040.  */
  1041.  
  1042. extern os_error *xfont_set_true_palette (os_gcol bg_hint,
  1043.       os_gcol fill,
  1044.       int offset,
  1045.       os_colour bg_hint_out,
  1046.       os_colour fill_out);
  1047. extern void font_set_true_palette (os_gcol bg_hint,
  1048.       os_gcol fill,
  1049.       int offset,
  1050.       os_colour bg_hint_out,
  1051.       os_colour fill_out);
  1052.  
  1053. /* ------------------------------------------------------------------------
  1054.  * Function:      font_read_thresholds()
  1055.  *
  1056.  * Description:   Reads the list of threshold values for painting
  1057.  *
  1058.  * Input:         buffer - value of R1 on entry
  1059.  *
  1060.  * Other notes:   Calls SWI 0x40094.
  1061.  */
  1062.  
  1063. extern os_error *xfont_read_thresholds (font_thresholds *buffer);
  1064. extern void font_read_thresholds (font_thresholds *buffer);
  1065.  
  1066. /* ------------------------------------------------------------------------
  1067.  * Function:      font_set_thresholds()
  1068.  *
  1069.  * Description:   Defines the list of threshold values for painting
  1070.  *
  1071.  * Input:         thresholds - value of R1 on entry
  1072.  *
  1073.  * Other notes:   Calls SWI 0x40095.
  1074.  */
  1075.  
  1076. extern os_error *xfont_set_thresholds (font_thresholds const *thresholds);
  1077. extern void font_set_thresholds (font_thresholds const *thresholds);
  1078.  
  1079. /* ------------------------------------------------------------------------
  1080.  * Function:      font_find_caretj()
  1081.  *
  1082.  * Description:   Finds where the caret is in a justified string
  1083.  *
  1084.  * Input:         s - value of R1 on entry
  1085.  *                x - value of R2 on entry
  1086.  *                y - value of R3 on entry
  1087.  *                xjust - value of R4 on entry
  1088.  *                yjust - value of R5 on entry
  1089.  *
  1090.  * Output:        split_point - value of R1 on exit
  1091.  *                x_out - value of R2 on exit
  1092.  *                y_out - value of R3 on exit
  1093.  *                length_out - value of R4 on exit
  1094.  *                index_out - value of R5 on exit
  1095.  *
  1096.  * Other notes:   Calls SWI 0x40096.
  1097.  */
  1098.  
  1099. extern os_error *xfont_find_caretj (char const *s,
  1100.       int x,
  1101.       int y,
  1102.       int xjust,
  1103.       int yjust,
  1104.       char **split_point,
  1105.       int *x_out,
  1106.       int *y_out,
  1107.       int *length_out,
  1108.       int *index_out);
  1109. extern void font_find_caretj (char const *s,
  1110.       int x,
  1111.       int y,
  1112.       int xjust,
  1113.       int yjust,
  1114.       char **split_point,
  1115.       int *x_out,
  1116.       int *y_out,
  1117.       int *length_out,
  1118.       int *index_out);
  1119.  
  1120. /* ------------------------------------------------------------------------
  1121.  * Function:      font_string_bbox()
  1122.  *
  1123.  * Description:   Measures the size of a string - prefer Font_ScanString
  1124.  *
  1125.  * Input:         s - value of R1 on entry
  1126.  *
  1127.  * Output:        x0 - value of R1 on exit
  1128.  *                y0 - value of R2 on exit
  1129.  *                x1 - value of R3 on exit
  1130.  *                y1 - value of R4 on exit
  1131.  *
  1132.  * Other notes:   Calls SWI 0x40097.
  1133.  */
  1134.  
  1135. extern os_error *xfont_string_bbox (char const *s,
  1136.       int *x0,
  1137.       int *y0,
  1138.       int *x1,
  1139.       int *y1);
  1140. extern void font_string_bbox (char const *s,
  1141.       int *x0,
  1142.       int *y0,
  1143.       int *x1,
  1144.       int *y1);
  1145.  
  1146. /* ------------------------------------------------------------------------
  1147.  * Function:      font_read_colour_table()
  1148.  *
  1149.  * Description:   Reads the anti-alias colour table
  1150.  *
  1151.  * Input:         colour_table - value of R1 on entry
  1152.  *
  1153.  * Other notes:   Calls SWI 0x40098.
  1154.  */
  1155.  
  1156. extern os_error *xfont_read_colour_table (font_colour_table const *colour_table);
  1157. extern void font_read_colour_table (font_colour_table const *colour_table);
  1158.  
  1159. /* ------------------------------------------------------------------------
  1160.  * Function:      font_make_bitmap()
  1161.  *
  1162.  * Description:   Make a font bitmap file
  1163.  *
  1164.  * Input:         font_name - value of R1 on entry
  1165.  *                xsize - value of R2 on entry
  1166.  *                ysize - value of R3 on entry
  1167.  *                xres - value of R4 on entry
  1168.  *                yres - value of R5 on entry
  1169.  *                flags - value of R6 on entry
  1170.  *
  1171.  * Other notes:   Calls SWI 0x40099.
  1172.  */
  1173.  
  1174. extern os_error *xfont_make_bitmap (char const *font_name,
  1175.       int xsize,
  1176.       int ysize,
  1177.       int xres,
  1178.       int yres,
  1179.       font_bitmap_type flags);
  1180. extern void font_make_bitmap (char const *font_name,
  1181.       int xsize,
  1182.       int ysize,
  1183.       int xres,
  1184.       int yres,
  1185.       font_bitmap_type flags);
  1186.  
  1187. /* ------------------------------------------------------------------------
  1188.  * Function:      font_un_cache_file()
  1189.  *
  1190.  * Description:   Deletes font cache information, or recaches it
  1191.  *
  1192.  * Input:         file_name - value of R0 on entry
  1193.  *                recache - value of R1 on entry
  1194.  *
  1195.  * Other notes:   Calls SWI 0x4009A.
  1196.  */
  1197.  
  1198. extern os_error *xfont_un_cache_file (char const *file_name,
  1199.       bool recache);
  1200. __swi (0x4009A) void font_un_cache_file (char const *file_name,
  1201.       bool recache);
  1202.  
  1203. /* ------------------------------------------------------------------------
  1204.  * Function:      font_set_font_max()
  1205.  *
  1206.  * Description:   Sets the FontMax values
  1207.  *
  1208.  * Input:         font_max - value of R0 on entry
  1209.  *                font_max1 - value of R1 on entry
  1210.  *                font_max2 - value of R2 on entry
  1211.  *                font_max3 - value of R3 on entry
  1212.  *                font_max4 - value of R4 on entry
  1213.  *                font_max5 - value of R5 on entry
  1214.  *
  1215.  * Other notes:   Calls SWI 0x4009B with R6 = 0x0, R7 = 0x0.
  1216.  */
  1217.  
  1218. extern os_error *xfont_set_font_max (int font_max,
  1219.       int font_max1,
  1220.       int font_max2,
  1221.       int font_max3,
  1222.       int font_max4,
  1223.       int font_max5);
  1224. extern void font_set_font_max (int font_max,
  1225.       int font_max1,
  1226.       int font_max2,
  1227.       int font_max3,
  1228.       int font_max4,
  1229.       int font_max5);
  1230.  
  1231. /* ------------------------------------------------------------------------
  1232.  * Function:      font_read_font_max()
  1233.  *
  1234.  * Description:   Reads the FontMax values
  1235.  *
  1236.  * Output:        font_max - value of R0 on exit
  1237.  *                font_max1 - value of R1 on exit
  1238.  *                font_max2 - value of R2 on exit
  1239.  *                font_max3 - value of R3 on exit
  1240.  *                font_max4 - value of R4 on exit
  1241.  *                font_max5 - value of R5 on exit
  1242.  *
  1243.  * Other notes:   Calls SWI 0x4009C.
  1244.  */
  1245.  
  1246. extern os_error *xfont_read_font_max (int *font_max,
  1247.       int *font_max1,
  1248.       int *font_max2,
  1249.       int *font_max3,
  1250.       int *font_max4,
  1251.       int *font_max5);
  1252. extern void font_read_font_max (int *font_max,
  1253.       int *font_max1,
  1254.       int *font_max2,
  1255.       int *font_max3,
  1256.       int *font_max4,
  1257.       int *font_max5);
  1258.  
  1259. /* ------------------------------------------------------------------------
  1260.  * Function:      font_read_font_prefix()
  1261.  *
  1262.  * Description:   Finds the directory prefix for a given font handle
  1263.  *
  1264.  * Input:         font - value of R0 on entry
  1265.  *                buffer - value of R1 on entry
  1266.  *                size - value of R2 on entry
  1267.  *
  1268.  * Output:        end - value of R1 on exit (X version only)
  1269.  *
  1270.  * Returns:       R1 (non-X version only)
  1271.  *
  1272.  * Other notes:   Calls SWI 0x4009D.
  1273.  */
  1274.  
  1275. extern os_error *xfont_read_font_prefix (font_f font,
  1276.       char *buffer,
  1277.       int size,
  1278.       char **end);
  1279. extern char *font_read_font_prefix (font_f font,
  1280.       char *buffer,
  1281.       int size);
  1282.  
  1283. /* ------------------------------------------------------------------------
  1284.  * Function:      font_switch_output_to_buffer()
  1285.  *
  1286.  * Description:   Switches output to a buffer, creating a Draw file
  1287.  *                structure
  1288.  *
  1289.  * Input:         flags - value of R0 on entry
  1290.  *                buffer - value of R1 on entry
  1291.  *
  1292.  * Output:        end - value of R1 on exit (X version only)
  1293.  *
  1294.  * Returns:       R1 (non-X version only)
  1295.  *
  1296.  * Other notes:   Calls SWI 0x4009E.
  1297.  */
  1298.  
  1299. extern os_error *xfont_switch_output_to_buffer (bits flags,
  1300.       byte *buffer,
  1301.       char **end);
  1302. extern char *font_switch_output_to_buffer (bits flags,
  1303.       byte *buffer);
  1304.  
  1305. /* ------------------------------------------------------------------------
  1306.  * Function:      font_read_font_metrics()
  1307.  *
  1308.  * Description:   Reads the full metrics information held in a font's
  1309.  *                IntMetrics file
  1310.  *
  1311.  * Input:         font - value of R0 on entry
  1312.  *                bbox_info - value of R1 on entry
  1313.  *                xwidth_info - value of R2 on entry
  1314.  *                ywidth_info - value of R3 on entry
  1315.  *                misc_info - value of R4 on entry
  1316.  *                kern_info - value of R5 on entry
  1317.  *
  1318.  * Output:        flags - value of R0 on exit
  1319.  *                bbox_info_size - value of R1 on exit
  1320.  *                xwidth_info_size - value of R2 on exit
  1321.  *                ywidth_info_size - value of R3 on exit
  1322.  *                misc_info_size - value of R4 on exit
  1323.  *                kern_info_size - value of R5 on exit
  1324.  *
  1325.  * Other notes:   Calls SWI 0x4009F with R6 = 0x0, R7 = 0x0.
  1326.  */
  1327.  
  1328. extern os_error *xfont_read_font_metrics (font_f font,
  1329.       font_bbox_info *bbox_info,
  1330.       font_width_info *xwidth_info,
  1331.       font_width_info *ywidth_info,
  1332.       font_misc_info *misc_info,
  1333.       font_kern_info *kern_info,
  1334.       font_metric_flags *flags,
  1335.       int *bbox_info_size,
  1336.       int *xwidth_info_size,
  1337.       int *ywidth_info_size,
  1338.       int *misc_info_size,
  1339.       int *kern_info_size);
  1340. extern void font_read_font_metrics (font_f font,
  1341.       font_bbox_info *bbox_info,
  1342.       font_width_info *xwidth_info,
  1343.       font_width_info *ywidth_info,
  1344.       font_misc_info *misc_info,
  1345.       font_kern_info *kern_info,
  1346.       font_metric_flags *flags,
  1347.       int *bbox_info_size,
  1348.       int *xwidth_info_size,
  1349.       int *ywidth_info_size,
  1350.       int *misc_info_size,
  1351.       int *kern_info_size);
  1352.  
  1353. /* ------------------------------------------------------------------------
  1354.  * Function:      font_decode_menu()
  1355.  *
  1356.  * Description:   Decode a selection made from a font menu
  1357.  *
  1358.  * Input:         flags - value of R0 on entry
  1359.  *                menu - value of R1 on entry
  1360.  *                block - value of R2 on entry
  1361.  *                buffer - value of R3 on entry
  1362.  *                size - value of R4 on entry
  1363.  *
  1364.  * Output:        next_selection - value of R3 on exit
  1365.  *                used - value of R4 on exit
  1366.  *
  1367.  * Other notes:   Calls SWI 0x400A0.
  1368.  */
  1369.  
  1370. extern os_error *xfont_decode_menu (font_decode_flags flags,
  1371.       byte const *menu,
  1372.       byte const *block,
  1373.       byte *buffer,
  1374.       int size,
  1375.       int **next_selection,
  1376.       int *used);
  1377. extern void font_decode_menu (font_decode_flags flags,
  1378.       byte const *menu,
  1379.       byte const *block,
  1380.       byte *buffer,
  1381.       int size,
  1382.       int **next_selection,
  1383.       int *used);
  1384.  
  1385. /* ------------------------------------------------------------------------
  1386.  * Function:      font_scan_string()
  1387.  *
  1388.  * Description:   Returns information on a string
  1389.  *
  1390.  * Input:         font - value of R0 on entry
  1391.  *                s - value of R1 on entry
  1392.  *                flags - value of R2 on entry
  1393.  *                x - value of R3 on entry
  1394.  *                y - value of R4 on entry
  1395.  *                block - value of R5 on entry
  1396.  *                trfm - value of R6 on entry
  1397.  *                length - value of R7 on entry
  1398.  *
  1399.  * Output:        split_point - value of R1 on exit
  1400.  *                x_out - value of R3 on exit
  1401.  *                y_out - value of R4 on exit
  1402.  *                length_out - value of R7 on exit
  1403.  *
  1404.  * Other notes:   Calls SWI 0x400A1.
  1405.  */
  1406.  
  1407. extern os_error *xfont_scan_string (font_f font,
  1408.       char const *s,
  1409.       font_string_flags flags,
  1410.       int x,
  1411.       int y,
  1412.       font_scan_block const *block,
  1413.       os_trfm const *trfm,
  1414.       int length,
  1415.       char **split_point,
  1416.       int *x_out,
  1417.       int *y_out,
  1418.       int *length_out);
  1419. extern void font_scan_string (font_f font,
  1420.       char const *s,
  1421.       font_string_flags flags,
  1422.       int x,
  1423.       int y,
  1424.       font_scan_block const *block,
  1425.       os_trfm const *trfm,
  1426.       int length,
  1427.       char **split_point,
  1428.       int *x_out,
  1429.       int *y_out,
  1430.       int *length_out);
  1431.  
  1432. /* ------------------------------------------------------------------------
  1433.  * Function:      font_current_rgb()
  1434.  *
  1435.  * Description:   Reads the settings of colours after calling Font_Paint
  1436.  *
  1437.  * Output:        font - value of R0 on exit (X version only)
  1438.  *                bg_hint - value of R1 on exit
  1439.  *                fill - value of R2 on exit
  1440.  *                offset - value of R3 on exit
  1441.  *
  1442.  * Returns:       R0 (non-X version only)
  1443.  *
  1444.  * Other notes:   Calls SWI 0x400A3.
  1445.  */
  1446.  
  1447. extern os_error *xfont_current_rgb (font_f *font,
  1448.       os_colour *bg_hint,
  1449.       os_colour *fill,
  1450.       int *offset);
  1451. extern font_f font_current_rgb (os_colour *bg_hint,
  1452.       os_colour *fill,
  1453.       int *offset);
  1454.  
  1455. /* ------------------------------------------------------------------------
  1456.  * Function:      font_future_rgb()
  1457.  *
  1458.  * Description:   Reads the settings of colours after calling various
  1459.  *                Font... SWI's
  1460.  *
  1461.  * Output:        font - value of R0 on exit (X version only)
  1462.  *                bg_hint - value of R1 on exit
  1463.  *                fill - value of R2 on exit
  1464.  *                offset - value of R3 on exit
  1465.  *
  1466.  * Returns:       R0 (non-X version only)
  1467.  *
  1468.  * Other notes:   Calls SWI 0x400A4.
  1469.  */
  1470.  
  1471. extern os_error *xfont_future_rgb (font_f *font,
  1472.       os_colour *bg_hint,
  1473.       os_colour *fill,
  1474.       int *offset);
  1475. extern font_f font_future_rgb (os_colour *bg_hint,
  1476.       os_colour *fill,
  1477.       int *offset);
  1478.  
  1479. /* ------------------------------------------------------------------------
  1480.  * Function:      font_read_encoding_filename()
  1481.  *
  1482.  * Description:   Returns the file name of the encoding file used for a
  1483.  *                given font handle
  1484.  *
  1485.  * Input:         font - value of R0 on entry
  1486.  *                buffer - value of R1 on entry
  1487.  *                size - value of R2 on entry
  1488.  *
  1489.  * Output:        end - value of R1 on exit (X version only)
  1490.  *
  1491.  * Returns:       R1 (non-X version only)
  1492.  *
  1493.  * Other notes:   Calls SWI 0x400A5.
  1494.  */
  1495.  
  1496. extern os_error *xfont_read_encoding_filename (font_f font,
  1497.       char *buffer,
  1498.       int size,
  1499.       char **end);
  1500. extern char *font_read_encoding_filename (font_f font,
  1501.       char *buffer,
  1502.       int size);
  1503.  
  1504. /* ------------------------------------------------------------------------
  1505.  * Function:      font_find_field()
  1506.  *
  1507.  * Description:   Returns a pointer to a specified field within a font
  1508.  *                identifier
  1509.  *
  1510.  * Input:         identifier - value of R0 on entry
  1511.  *                qualifier - value of R2 on entry
  1512.  *
  1513.  * Output:        field - value of R1 on exit
  1514.  *                found - value of R2 on exit (X version only)
  1515.  *
  1516.  * Returns:       R2 (non-X version only)
  1517.  *
  1518.  * Other notes:   Calls SWI 0x400A6.
  1519.  */
  1520.  
  1521. extern os_error *xfont_find_field (char const *identifier,
  1522.       char qualifier,
  1523.       char **field,
  1524.       bool *found);
  1525. extern bool font_find_field (char const *identifier,
  1526.       char qualifier,
  1527.       char **field);
  1528.  
  1529. /* ------------------------------------------------------------------------
  1530.  * Function:      font_apply_fields()
  1531.  *
  1532.  * Description:   Merges a new set of fields with those already in a given
  1533.  *                font identifier
  1534.  *
  1535.  * Input:         identifier - value of R0 on entry
  1536.  *                fields - value of R1 on entry
  1537.  *                buffer - value of R2 on entry
  1538.  *                size - value of R3 on entry
  1539.  *
  1540.  * Output:        spare - value of R3 on exit (X version only)
  1541.  *
  1542.  * Returns:       R3 (non-X version only)
  1543.  *
  1544.  * Other notes:   Calls SWI 0x400A7.
  1545.  */
  1546.  
  1547. extern os_error *xfont_apply_fields (char const *identifier,
  1548.       char const *fields,
  1549.       char *buffer,
  1550.       int size,
  1551.       int *spare);
  1552. extern int font_apply_fields (char const *identifier,
  1553.       char const *fields,
  1554.       char *buffer,
  1555.       int size);
  1556.  
  1557. /* ------------------------------------------------------------------------
  1558.  * Function:      font_lookup_font()
  1559.  *
  1560.  * Description:   Returns information about a given font
  1561.  *
  1562.  * Input:         font - value of R0 on entry
  1563.  *
  1564.  * Output:        flags - value of R2 on exit (X version only)
  1565.  *
  1566.  * Returns:       R2 (non-X version only)
  1567.  *
  1568.  * Other notes:   Calls SWI 0x400A8 with R1 = 0x0, R2 = 0x0.
  1569.  */
  1570.  
  1571. extern os_error *xfont_lookup_font (font_f font,
  1572.       font_characteristic_flags *flags);
  1573. extern font_characteristic_flags font_lookup_font (font_f font);
  1574.  
  1575. /* ------------------------------------------------------------------------
  1576.  * Function:      service_fonts_changed()
  1577.  *
  1578.  * Description:   New Font$Path detected
  1579.  *
  1580.  * Other notes:   Calls SWI 0x30 with R1 = 0x6E.
  1581.  */
  1582.  
  1583. extern os_error *xservice_fonts_changed (void);
  1584. extern void service_fonts_changed (void);
  1585.  
  1586. #ifdef __cplusplus
  1587.    }
  1588. #endif
  1589.  
  1590. #endif
  1591.