home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-22 | 46.6 KB | 1,522 lines |
- #ifndef font_H
- #define font_H
-
- /* C header file for Font
- * written by DefMod (Sep 16 1994) on Thu Sep 22 16:40:12 1994
- * Copyright © Acorn Computers Ltd, 1994
- */
-
- /*************************************************************************
- * This source file was written by Acorn Computers Limited. It is part *
- * of the OSLib library for writing applications for RISC OS. It may be *
- * used freely in the creation of programs for RISC OS. *
- *************************************************************************/
-
- #ifndef types_H
- #include "types.h"
- #endif
-
- #ifndef os_H
- #include "os.h"
- #endif
-
- /**********************************
- * SWI names and SWI reason codes *
- **********************************/
- #undef Font_CacheAddr
- #define Font_CacheAddr 0x40080
- #undef XFont_CacheAddr
- #define XFont_CacheAddr 0x60080
- #undef Font_FindFont
- #define Font_FindFont 0x40081
- #undef XFont_FindFont
- #define XFont_FindFont 0x60081
- #undef Font_LoseFont
- #define Font_LoseFont 0x40082
- #undef XFont_LoseFont
- #define XFont_LoseFont 0x60082
- #undef Font_ReadDefn
- #define Font_ReadDefn 0x40083
- #undef XFont_ReadDefn
- #define XFont_ReadDefn 0x60083
- #undef Font_ReadIdentifier
- #define Font_ReadIdentifier 0x40083
- #undef XFont_ReadIdentifier
- #define XFont_ReadIdentifier 0x60083
- #undef Font_ReadInfo
- #define Font_ReadInfo 0x40084
- #undef XFont_ReadInfo
- #define XFont_ReadInfo 0x60084
- #undef Font_StringWidth
- #define Font_StringWidth 0x40085
- #undef XFont_StringWidth
- #define XFont_StringWidth 0x60085
- #undef Font_Paint
- #define Font_Paint 0x40086
- #undef XFont_Paint
- #define XFont_Paint 0x60086
- #undef Font_Caret
- #define Font_Caret 0x40087
- #undef XFont_Caret
- #define XFont_Caret 0x60087
- #undef Font_ConverttoOS
- #define Font_ConverttoOS 0x40088
- #undef XFont_ConverttoOS
- #define XFont_ConverttoOS 0x60088
- #undef Font_Converttopoints
- #define Font_Converttopoints 0x40089
- #undef XFont_Converttopoints
- #define XFont_Converttopoints 0x60089
- #undef Font_SetFont
- #define Font_SetFont 0x4008A
- #undef XFont_SetFont
- #define XFont_SetFont 0x6008A
- #undef Font_CurrentFont
- #define Font_CurrentFont 0x4008B
- #undef XFont_CurrentFont
- #define XFont_CurrentFont 0x6008B
- #undef Font_FutureFont
- #define Font_FutureFont 0x4008C
- #undef XFont_FutureFont
- #define XFont_FutureFont 0x6008C
- #undef Font_FindCaret
- #define Font_FindCaret 0x4008D
- #undef XFont_FindCaret
- #define XFont_FindCaret 0x6008D
- #undef Font_CharBBox
- #define Font_CharBBox 0x4008E
- #undef XFont_CharBBox
- #define XFont_CharBBox 0x6008E
- #undef Font_ReadScaleFactor
- #define Font_ReadScaleFactor 0x4008F
- #undef XFont_ReadScaleFactor
- #define XFont_ReadScaleFactor 0x6008F
- #undef Font_SetScaleFactor
- #define Font_SetScaleFactor 0x40090
- #undef XFont_SetScaleFactor
- #define XFont_SetScaleFactor 0x60090
- #undef Font_ListFonts
- #define Font_ListFonts 0x40091
- #undef XFont_ListFonts
- #define XFont_ListFonts 0x60091
- #undef Font_SetFontColours
- #define Font_SetFontColours 0x40092
- #undef XFont_SetFontColours
- #define XFont_SetFontColours 0x60092
- #undef Font_SetPalette
- #define Font_SetPalette 0x40093
- #undef XFont_SetPalette
- #define XFont_SetPalette 0x60093
- #undef Font_SetTruePalette
- #define Font_SetTruePalette 0x40093
- #undef XFont_SetTruePalette
- #define XFont_SetTruePalette 0x60093
- #undef Font_ReadThresholds
- #define Font_ReadThresholds 0x40094
- #undef XFont_ReadThresholds
- #define XFont_ReadThresholds 0x60094
- #undef Font_SetThresholds
- #define Font_SetThresholds 0x40095
- #undef XFont_SetThresholds
- #define XFont_SetThresholds 0x60095
- #undef Font_FindCaretJ
- #define Font_FindCaretJ 0x40096
- #undef XFont_FindCaretJ
- #define XFont_FindCaretJ 0x60096
- #undef Font_StringBBox
- #define Font_StringBBox 0x40097
- #undef XFont_StringBBox
- #define XFont_StringBBox 0x60097
- #undef Font_ReadColourTable
- #define Font_ReadColourTable 0x40098
- #undef XFont_ReadColourTable
- #define XFont_ReadColourTable 0x60098
- #undef Font_MakeBitmap
- #define Font_MakeBitmap 0x40099
- #undef XFont_MakeBitmap
- #define XFont_MakeBitmap 0x60099
- #undef Font_UnCacheFile
- #define Font_UnCacheFile 0x4009A
- #undef XFont_UnCacheFile
- #define XFont_UnCacheFile 0x6009A
- #undef Font_SetFontMax
- #define Font_SetFontMax 0x4009B
- #undef XFont_SetFontMax
- #define XFont_SetFontMax 0x6009B
- #undef Font_ReadFontMax
- #define Font_ReadFontMax 0x4009C
- #undef XFont_ReadFontMax
- #define XFont_ReadFontMax 0x6009C
- #undef Font_ReadFontPrefix
- #define Font_ReadFontPrefix 0x4009D
- #undef XFont_ReadFontPrefix
- #define XFont_ReadFontPrefix 0x6009D
- #undef Font_SwitchOutputToBuffer
- #define Font_SwitchOutputToBuffer 0x4009E
- #undef XFont_SwitchOutputToBuffer
- #define XFont_SwitchOutputToBuffer 0x6009E
- #undef Font_ReadFontMetrics
- #define Font_ReadFontMetrics 0x4009F
- #undef XFont_ReadFontMetrics
- #define XFont_ReadFontMetrics 0x6009F
- #undef Font_DecodeMenu
- #define Font_DecodeMenu 0x400A0
- #undef XFont_DecodeMenu
- #define XFont_DecodeMenu 0x600A0
- #undef Font_ScanString
- #define Font_ScanString 0x400A1
- #undef XFont_ScanString
- #define XFont_ScanString 0x600A1
- #undef Font_SetColourTable
- #define Font_SetColourTable 0x400A2
- #undef XFont_SetColourTable
- #define XFont_SetColourTable 0x600A2
- #undef Font_CurrentRGB
- #define Font_CurrentRGB 0x400A3
- #undef XFont_CurrentRGB
- #define XFont_CurrentRGB 0x600A3
- #undef Font_FutureRGB
- #define Font_FutureRGB 0x400A4
- #undef XFont_FutureRGB
- #define XFont_FutureRGB 0x600A4
- #undef Font_ReadEncodingFilename
- #define Font_ReadEncodingFilename 0x400A5
- #undef XFont_ReadEncodingFilename
- #define XFont_ReadEncodingFilename 0x600A5
- #undef Font_FindField
- #define Font_FindField 0x400A6
- #undef XFont_FindField
- #define XFont_FindField 0x600A6
- #undef Font_ApplyFields
- #define Font_ApplyFields 0x400A7
- #undef XFont_ApplyFields
- #define XFont_ApplyFields 0x600A7
- #undef Font_LookupFont
- #define Font_LookupFont 0x400A8
- #undef XFont_LookupFont
- #define XFont_LookupFont 0x600A8
- #undef Service_FontsChanged
- #define Service_FontsChanged 0x6E
-
- /************************************
- * Structure and union declarations *
- ************************************/
- typedef struct font_paint_block font_paint_block;
- typedef struct font_scan_block font_scan_block;
- typedef struct font_thresholds font_thresholds;
- typedef struct font_colour_table font_colour_table;
- typedef struct font_bbox_info font_bbox_info;
- typedef struct font_width_info font_width_info;
- typedef struct font_misc_info font_misc_info;
- typedef struct font_long_kern_pair font_long_kern_pair;
- typedef union font_kern_info font_kern_info;
-
- /********************
- * Type definitions *
- ********************/
- typedef byte font_f;
-
- struct font_paint_block
- { os_coord space;
- os_coord letter;
- os_box rubout;
- };
-
- struct font_scan_block
- { os_coord space;
- os_coord letter;
- int split_char;
- os_box bbox;
- };
-
- struct font_thresholds
- { byte t [UNKNOWN];
- };
-
- #define font_THRESHOLDS(N) \
- struct \
- { byte t [N]; \
- }
-
- #define font_SIZEOF_THRESHOLDS(N) \
- ((N)*sizeof ((font_thresholds *) NULL)->t)
-
- struct font_colour_table
- { byte c [UNKNOWN];
- };
-
- #define font_COLOUR_TABLE(N) \
- struct \
- { byte c [N]; \
- }
-
- #define font_SIZEOF_COLOUR_TABLE(N) \
- ((N)*sizeof ((font_colour_table *) NULL)->c)
-
- struct font_bbox_info
- { os_box bboxes [256];
- };
-
- struct font_width_info
- { int widths [256];
- };
-
- struct font_misc_info
- { short x0;
- short y0;
- short x1;
- short y1;
- short xkern;
- short ykern;
- short italic_correction;
- byte underline_position;
- byte underline_thickness;
- short cap_height;
- short xheight;
- short descender;
- short ascender;
- int reserved;
- };
-
- typedef bits font_short_kern_pair;
-
- struct font_long_kern_pair
- { int c;
- int xkern;
- int ykern;
- };
-
- union font_kern_info
- { struct
- { int table [256];
- int size;
- bits flags;
- font_long_kern_pair pairs [UNKNOWN];
- }
- long_info;
- struct
- { int table [256];
- int size;
- bits flags;
- font_short_kern_pair pairs [UNKNOWN];
- }
- short_info;
- };
-
- /************************
- * Constant definitions *
- ************************/
- #define font_OS_UNIT 400
- #define font_INCH 72000
- #define font_POINT 1000
- #define font_COMMAND_NULL ((char) '\x00')
- #define font_COMMAND_XMOVE ((char) '\x09')
- #define font_COMMAND_LINEFEED ((char) '\x0A')
- #define font_COMMAND_YMOVE ((char) '\x0B')
- #define font_COMMAND_RETURN ((char) '\x0D')
- #define font_COMMAND_GCOL ((char) '\x11')
- #define font_COMMAND_COLOURS ((char) '\x12')
- #define font_COMMAND_TRUE_COLOURS ((char) '\x13')
- #define font_COMMAND_COMMENT ((char) '\x15')
- #define font_COMMAND_UNDERLINE ((char) '\x19')
- #define font_COMMAND_FONT ((char) '\x1A')
- #define font_COMMAND_HOM_TRFM ((char) '\x1B')
- #define font_COMMAND_TRFM ((char) '\x1C')
- #define font_JUSTIFY 0x1u
- #define font_RUBOUT 0x2u
- #define font_OS_UNITS 0x10u
- #define font_GIVEN_BLOCK 0x20u
- #define font_GIVEN_TRFM 0x40u
- #define font_GIVEN_LENGTH 0x80u
- #define font_GIVEN_FONT 0x100u
- #define font_KERN 0x200u
- #define font_RIGHT_TO_LEFT 0x400u
- #define font_RETURN_CARET_POS 0x20000u
- #define font_RETURN_BBOX 0x40000u
- #define font_RETURN_MATRIX 0x80000u
- #define font_RETURN_SPLIT_COUNT 0x100000u
- #define font_NO_OUTPUT 0x1u
- #define font_ADD_HINTS 0x2u
- #define font_OUTPUT_SKELETON 0x4u
- #define font_CONVERT_BITMAP 0x8u
- #define font_ERROR_IF_BITMAP 0x10u
- #define error_FONT_NO_ROOM 0x200u
- #define error_FONT_CACHE_FULL 0x201u
- #define error_FONT_NO_CACHE 0x202u
- #define error_FONT_TOO_LONG 0x203u
- #define error_FONT64K 0x204u
- #define error_FONT_PAL_TOO_BIG 0x205u
- #define error_FONT_BAD_TRAN_BITS 0x206u
- #define error_FONT_NOT_ENOUGH_BITS 0x207u
- #define error_FONT_NO_FONT 0x208u
- #define error_FONT_NO_PIXELS 0x209u
- #define error_FONT_BAD_FONT_NUMBER 0x20Au
- #define error_FONT_NOT_FOUND 0x20Bu
- #define error_FONT_BAD_FONT_FILE 0x20Cu
- #define error_FONT_NO_HANDLES 0x20Du
- #define error_FONT_BAD_COUNTER 0x20Eu
- #define error_FONT_BAD_CTRL_CHAR 0x20Fu
- #define error_FONTS_IN_USE 0x210u
- #define error_FONT_BAD_SEGMENT 0x211u
- #define error_FONT_BAD_PREFIX 0x212u
- #define error_FONT_RESERVED 0x213u
- #define error_FONT_BAD_CHAR_CODE 0x214u
- #define error_FONT_NO_BITMAPS 0x215u
- #define error_FONT_NO_BITMAPS2 0x216u
- #define error_FONT_BAD_FONT_CACHE_FILE 0x217u
- #define error_FONT_FIELD_NOT_FOUND 0x218u
- #define error_FONT_BAD_MATRIX 0x219u
- #define error_FONT_OVERFLOW 0x21Au
- #define error_FONT_DIVBY0 0x21Bu
- #define error_FONT_BAD_READ_METRICS 0x21Cu
- #define error_FONT_BAD_RGB 0x21Du
- #define error_FONT_ENCODING_NOT_FOUND 0x21Eu
- #define error_FONT_MUST_HAVE_SLASH 0x21Fu
- #define error_FONT_BAD_ENCODING_SIZE 0x220u
- #define error_FONT_TOO_MANY_IDS 0x221u
- #define error_FONT_TOO_FEW_IDS 0x222u
- #define error_FONT_NO_BASE_ENCODING 0x223u
- #define error_FONT_IDENTIFIER_NOT_FOUND 0x224u
- #define error_FONT_TOO_MANY_CHUNKS 0x225u
- #define error_FONT_BAD_FONT_FILE2 0x226u
- #define error_FONT_DATA_NOT_FOUND 0x20Bu
- #define error_FONT_DATA_NOT_FOUND2 0x20Bu
- #define font_NAME_LIMIT 40
- #define font_SYSTEM ((font_f) 0)
- #define font_CURRENT ((font_f) 0)
- #define font_BITMAP_DEEP 0x1u
- #define font_BITMAP_HORIZONTAL_SUB_PIXEL 0x2u
- #define font_BITMAP_VERTICAL_SUB_PIXEL 0x4u
- #define font_BITMAP_DELETE 0x8u
- #define font_CHARACTERISTIC_OLD_FORMAT 0x1u
- #define font_CHARACTERISTIC_ROM 0x2u
- #define font_CHARACTERISTIC_MONOCHROME 0x4u
- #define font_CHARACTERISTIC_FILL_RULE_NON_ZERO 0x8u
- #define font_RETURN_FONT_NAME 0x10000u
- #define font_RETURN_LOCAL_FONT_NAME 0x20000u
- #define font_USE_LINEFEED 0x40000u
- #define font_RETURN_FONT_MENU 0x80000u
- #define font_ALLOW_SYSTEM_FONT 0x100000u
- #define font_GIVEN_TICK 0x200000u
- #define font_RETURN_ENCODING_MENU 0x480000u
- #define font_TICK_NONE ((char *) 0)
- #define font_TICK_SYSTEM_FONT ((char *) 1)
- #define font_METRICS_KERN_YONLY 0x2u
- #define font_METRICS_KERN_XONLY 0x4u
- #define font_METRICS_MANY_KERN_PAIRS 0x8u
- #define font_GIVEN_ENCODING_MENU 0x1u
-
- /*************************
- * Function declarations *
- *************************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*************************************************************
- * NOTE: The following functions provide direct access to *
- * the SWI's noted in the function description. *
- * Please read the relevant PRM section for more *
- * information on their input/output parameters. *
- *************************************************************/
-
- /* ------------------------------------------------------------------------
- * Function: font_cache_addr()
- *
- * Description: Gets the version number, font cache size and amount used
- *
- * Output: version - value of R0 on exit
- * cache_size - value of R2 on exit
- * cache_used - value of R3 on exit
- *
- * Other notes: Calls SWI 0x40080.
- */
-
- extern os_error *xfont_cache_addr (int *version,
- int *cache_size,
- int *cache_used);
- extern void font_cache_addr (int *version,
- int *cache_size,
- int *cache_used);
-
- /* ------------------------------------------------------------------------
- * Function: font_find_font()
- *
- * Description: Gets the handle for a font
- *
- * Input: font_name - value of R1 on entry
- * xsize - value of R2 on entry
- * ysize - value of R3 on entry
- * xres - value of R4 on entry
- * yres - value of R5 on entry
- *
- * Output: font - value of R0 on exit (X version only)
- * xres_out - value of R4 on exit
- * yres_out - value of R5 on exit
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x40081.
- */
-
- extern os_error *xfont_find_font (char *font_name,
- int xsize,
- int ysize,
- int xres,
- int yres,
- font_f *font,
- int *xres_out,
- int *yres_out);
- extern font_f font_find_font (char *font_name,
- int xsize,
- int ysize,
- int xres,
- int yres,
- int *xres_out,
- int *yres_out);
-
- /* ------------------------------------------------------------------------
- * Function: font_lose_font()
- *
- * Description: Finishes use of a font
- *
- * Input: font - value of R0 on entry
- *
- * Other notes: Calls SWI 0x40082.
- */
-
- extern os_error *xfont_lose_font (font_f font);
- extern void font_lose_font (font_f font);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_defn()
- *
- * Description: Reads details about a font
- *
- * Input: font - value of R0 on entry
- *
- * Output: xsize - value of R2 on exit
- * ysize - value of R3 on exit
- * xres - value of R4 on exit
- * yres - value of R5 on exit
- * age - value of R6 on exit
- * usage_count - value of R7 on exit
- *
- * Other notes: Calls SWI 0x40083 with R3 = 0x0.
- */
-
- extern os_error *xfont_read_defn (font_f font,
- int *xsize,
- int *ysize,
- int *xres,
- int *yres,
- int *age,
- int *usage_count);
- extern void font_read_defn (font_f font,
- int *xsize,
- int *ysize,
- int *xres,
- int *yres,
- int *age,
- int *usage_count);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_identifier()
- *
- * Description: Reads the full font identifier
- *
- * Input: font - value of R0 on entry
- * buffer - value of R1 on entry
- *
- * Output: used - value of R2 on exit
- *
- * Other notes: Calls SWI 0x40083 with R3 = 0x4C4C5546.
- */
-
- extern os_error *xfont_read_identifier (font_f font,
- byte *buffer,
- int *used);
- extern void font_read_identifier (font_f font,
- byte *buffer,
- int *used);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_info()
- *
- * Description: Gets the font bounding box
- *
- * Input: font - value of R0 on entry
- *
- * Output: x0 - value of R1 on exit
- * y0 - value of R2 on exit
- * x1 - value of R3 on exit
- * y1 - value of R4 on exit
- *
- * Other notes: Calls SWI 0x40084.
- */
-
- extern os_error *xfont_read_info (font_f font,
- int *x0,
- int *y0,
- int *x1,
- int *y1);
- extern void font_read_info (font_f font,
- int *x0,
- int *y0,
- int *x1,
- int *y1);
-
- /* ------------------------------------------------------------------------
- * Function: font_string_width()
- *
- * Description: Calculates how wide a string would be in the current font
- * (prefer Font_ScanString)
- *
- * Input: s - value of R1 on entry
- * xmax - value of R2 on entry
- * ymax - value of R3 on entry
- * split - value of R4 on entry
- * length - value of R5 on entry
- *
- * Output: split_point - value of R1 on exit
- * x - value of R2 on exit
- * y - value of R3 on exit
- * length_out - value of R4 on exit
- * index_out - value of R5 on exit
- *
- * Other notes: Calls SWI 0x40085.
- */
-
- extern os_error *xfont_string_width (char *s,
- int xmax,
- int ymax,
- int split,
- int length,
- char **split_point,
- int *x,
- int *y,
- int *length_out,
- int *index_out);
- extern void font_string_width (char *s,
- int xmax,
- int ymax,
- int split,
- int length,
- char **split_point,
- int *x,
- int *y,
- int *length_out,
- int *index_out);
-
- /* ------------------------------------------------------------------------
- * Function: font_paint()
- *
- * Description: Writes a string to the screen
- *
- * Input: font - value of R0 on entry
- * string - value of R1 on entry
- * flags - value of R2 on entry
- * xpos - value of R3 on entry
- * ypos - value of R4 on entry
- * block - value of R5 on entry
- * trfm - value of R6 on entry
- * length - value of R7 on entry
- *
- * Other notes: Calls SWI 0x40086.
- */
-
- extern os_error *xfont_paint (font_f font,
- char *string,
- bits flags,
- int xpos,
- int ypos,
- font_paint_block *block,
- os_trfm *trfm,
- int length);
- extern void font_paint (font_f font,
- char *string,
- bits flags,
- int xpos,
- int ypos,
- font_paint_block *block,
- os_trfm *trfm,
- int length);
-
- /* ------------------------------------------------------------------------
- * Function: font_caret()
- *
- * Description: Defines text cursor for Font Manager
- *
- * Input: colour_number - value of R0 on entry
- * height - value of R1 on entry
- * flags - value of R2 on entry
- * x - value of R3 on entry
- * y - value of R4 on entry
- *
- * Other notes: Calls SWI 0x40087.
- */
-
- extern os_error *xfont_caret (os_colour_number colour_number,
- int height,
- bits flags,
- int x,
- int y);
- extern void font_caret (os_colour_number colour_number,
- int height,
- bits flags,
- int x,
- int y);
-
- /* ------------------------------------------------------------------------
- * Function: font_convertto_os()
- *
- * Description: Converts internal coordinates to OS coordinates
- *
- * Input: x - value of R1 on entry
- * y - value of R2 on entry
- *
- * Output: x_out - value of R1 on exit
- * y_out - value of R2 on exit
- *
- * Other notes: Calls SWI 0x40088.
- */
-
- extern os_error *xfont_convertto_os (int x,
- int y,
- int *x_out,
- int *y_out);
- extern void font_convertto_os (int x,
- int y,
- int *x_out,
- int *y_out);
-
- /* ------------------------------------------------------------------------
- * Function: font_converttopoints()
- *
- * Description: Converts OS coordinates to internal coordinates
- *
- * Input: x - value of R1 on entry
- * y - value of R2 on entry
- *
- * Output: x_out - value of R1 on exit
- * y_out - value of R2 on exit
- *
- * Other notes: Calls SWI 0x40089.
- */
-
- extern os_error *xfont_converttopoints (int x,
- int y,
- int *x_out,
- int *y_out);
- extern void font_converttopoints (int x,
- int y,
- int *x_out,
- int *y_out);
-
- /* ------------------------------------------------------------------------
- * Function: font_set_font()
- *
- * Description: Selects the font to be subsequently used
- *
- * Input: font - value of R0 on entry
- *
- * Other notes: Calls SWI 0x4008A.
- */
-
- extern os_error *xfont_set_font (font_f font);
- extern void font_set_font (font_f font);
-
- /* ------------------------------------------------------------------------
- * Function: font_current_font()
- *
- * Description: Gets the current font handle and colours
- *
- * Output: font - value of R0 on exit (X version only)
- * bg_hint - value of R1 on exit
- * fill - value of R2 on exit
- * offset - value of R3 on exit
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x4008B.
- */
-
- extern os_error *xfont_current_font (font_f *font,
- os_gcol *bg_hint,
- os_gcol *fill,
- int *offset);
- extern font_f font_current_font (os_gcol *bg_hint,
- os_gcol *fill,
- int *offset);
-
- /* ------------------------------------------------------------------------
- * Function: font_future_font()
- *
- * Description: Checks font characteristics after Font_StringWidth
- *
- * Output: font - value of R0 on exit (X version only)
- * bg_hint - value of R1 on exit
- * fill - value of R2 on exit
- * offset - value of R3 on exit
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x4008C.
- */
-
- extern os_error *xfont_future_font (font_f *font,
- os_gcol *bg_hint,
- os_gcol *fill,
- int *offset);
- extern font_f font_future_font (os_gcol *bg_hint,
- os_gcol *fill,
- int *offset);
-
- /* ------------------------------------------------------------------------
- * Function: font_find_caret()
- *
- * Description: Finds where the caret is in a string
- *
- * Input: s - value of R1 on entry
- * x - value of R2 on entry
- * y - value of R3 on entry
- *
- * Output: split_point - value of R1 on exit
- * x_out - value of R2 on exit
- * y_out - value of R3 on exit
- * length_out - value of R4 on exit
- * index_out - value of R5 on exit
- *
- * Other notes: Calls SWI 0x4008D.
- */
-
- extern os_error *xfont_find_caret (char *s,
- int x,
- int y,
- char **split_point,
- int *x_out,
- int *y_out,
- int *length_out,
- int *index_out);
- extern void font_find_caret (char *s,
- int x,
- int y,
- char **split_point,
- int *x_out,
- int *y_out,
- int *length_out,
- int *index_out);
-
- /* ------------------------------------------------------------------------
- * Function: font_char_bbox()
- *
- * Description: Gets the bounding box of a character
- *
- * Input: font - value of R0 on entry
- * c - value of R1 on entry
- * flags - value of R2 on entry
- *
- * Output: x0 - value of R1 on exit
- * y0 - value of R2 on exit
- * x1 - value of R3 on exit
- * y1 - value of R4 on exit
- *
- * Other notes: Calls SWI 0x4008E.
- */
-
- extern os_error *xfont_char_bbox (font_f font,
- char c,
- bits flags,
- int *x0,
- int *y0,
- int *x1,
- int *y1);
- extern void font_char_bbox (font_f font,
- char c,
- bits flags,
- int *x0,
- int *y0,
- int *x1,
- int *y1);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_scale_factor()
- *
- * Description: Reads the internal to OS conversion factor
- *
- * Output: xfactor - value of R1 on exit
- * yfactor - value of R2 on exit
- *
- * Other notes: Calls SWI 0x4008F.
- */
-
- extern os_error *xfont_read_scale_factor (int *xfactor,
- int *yfactor);
- extern void font_read_scale_factor (int *xfactor,
- int *yfactor);
-
- /* ------------------------------------------------------------------------
- * Function: font_set_scale_factor()
- *
- * Description: Sets the internal to OS conversion factor
- *
- * Input: xfactor - value of R1 on entry
- * yfactor - value of R2 on entry
- *
- * Other notes: Calls SWI 0x40090.
- */
-
- extern os_error *xfont_set_scale_factor (int xfactor,
- int yfactor);
- extern void font_set_scale_factor (int xfactor,
- int yfactor);
-
- /* ------------------------------------------------------------------------
- * Function: font_list_fonts()
- *
- * Description: Scans for fonts, returning their identifiers one at a
- * time; or or builds a menu of fonts
- *
- * Input: buffer1 - value of R1 on entry
- * context - value of R2 on entry
- * size1 - value of R3 on entry
- * buffer2 - value of R4 on entry
- * size2 - value of R5 on entry
- * tick_font - value of R6 on entry
- *
- * Output: context_out - value of R2 on exit (X version only)
- * used1 - value of R3 on exit
- * used2 - value of R5 on exit
- *
- * Returns: R2 (non-X version only)
- *
- * Other notes: Calls SWI 0x40091.
- */
-
- extern os_error *xfont_list_fonts (byte *buffer1,
- int context,
- int size1,
- byte *buffer2,
- int size2,
- char *tick_font,
- int *context_out,
- int *used1,
- int *used2);
- extern int font_list_fonts (byte *buffer1,
- int context,
- int size1,
- byte *buffer2,
- int size2,
- char *tick_font,
- int *used1,
- int *used2);
-
- /* ------------------------------------------------------------------------
- * Function: font_set_font_colours()
- *
- * Description: Changes the current colours and (optionally) the current
- * font (prefer ColourTrans_SetFontColours)
- *
- * Input: font - value of R0 on entry
- * bg_hint - value of R1 on entry
- * fill - value of R2 on entry
- * offset - value of R3 on entry
- *
- * Other notes: Calls SWI 0x40092.
- */
-
- extern os_error *xfont_set_font_colours (font_f font,
- os_gcol bg_hint,
- os_gcol fill,
- int offset);
- extern void font_set_font_colours (font_f font,
- os_gcol bg_hint,
- os_gcol fill,
- int offset);
-
- /* ------------------------------------------------------------------------
- * Function: font_set_palette()
- *
- * Description: Defines the anti-alias palette
- *
- * Input: bg_hint - value of R1 on entry
- * fill - value of R2 on entry
- * offset - value of R3 on entry
- * bg_hint_out - value of R4 on entry
- * fill_out - value of R5 on entry
- *
- * Other notes: Calls SWI 0x40093 with R6 = 0x0.
- */
-
- extern os_error *xfont_set_palette (os_gcol bg_hint,
- os_gcol fill,
- int offset,
- os_colour bg_hint_out,
- os_colour fill_out);
- extern void font_set_palette (os_gcol bg_hint,
- os_gcol fill,
- int offset,
- os_colour bg_hint_out,
- os_colour fill_out);
-
- /* ------------------------------------------------------------------------
- * Function: font_set_true_palette()
- *
- * Description: Defines the anti-alias palette with true colour values
- *
- * Input: bg_hint - value of R1 on entry
- * fill - value of R2 on entry
- * offset - value of R3 on entry
- * bg_hint_out - value of R4 on entry
- * fill_out - value of R5 on entry
- *
- * Other notes: Calls SWI 0x40093 with R6 = 0x65757254.
- */
-
- extern os_error *xfont_set_true_palette (os_gcol bg_hint,
- os_gcol fill,
- int offset,
- os_colour bg_hint_out,
- os_colour fill_out);
- extern void font_set_true_palette (os_gcol bg_hint,
- os_gcol fill,
- int offset,
- os_colour bg_hint_out,
- os_colour fill_out);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_thresholds()
- *
- * Description: Reads the list of threshold values for painting
- *
- * Input: buffer - value of R1 on entry
- *
- * Other notes: Calls SWI 0x40094.
- */
-
- extern os_error *xfont_read_thresholds (font_thresholds *buffer);
- extern void font_read_thresholds (font_thresholds *buffer);
-
- /* ------------------------------------------------------------------------
- * Function: font_set_thresholds()
- *
- * Description: Defines the list of threshold values for painting
- *
- * Input: thresholds - value of R1 on entry
- *
- * Other notes: Calls SWI 0x40095.
- */
-
- extern os_error *xfont_set_thresholds (font_thresholds *thresholds);
- extern void font_set_thresholds (font_thresholds *thresholds);
-
- /* ------------------------------------------------------------------------
- * Function: font_find_caretj()
- *
- * Description: Finds where the caret is in a justified string
- *
- * Input: s - value of R1 on entry
- * x - value of R2 on entry
- * y - value of R3 on entry
- * xjust - value of R4 on entry
- * yjust - value of R5 on entry
- *
- * Output: split_point - value of R1 on exit
- * x_out - value of R2 on exit
- * y_out - value of R3 on exit
- * length_out - value of R4 on exit
- * index_out - value of R5 on exit
- *
- * Other notes: Calls SWI 0x40096.
- */
-
- extern os_error *xfont_find_caretj (char *s,
- int x,
- int y,
- int xjust,
- int yjust,
- char **split_point,
- int *x_out,
- int *y_out,
- int *length_out,
- int *index_out);
- extern void font_find_caretj (char *s,
- int x,
- int y,
- int xjust,
- int yjust,
- char **split_point,
- int *x_out,
- int *y_out,
- int *length_out,
- int *index_out);
-
- /* ------------------------------------------------------------------------
- * Function: font_string_bbox()
- *
- * Description: Measures the size of a string (prefer Font_ScanString)
- *
- * Input: s - value of R1 on entry
- *
- * Output: x0 - value of R1 on exit
- * y0 - value of R2 on exit
- * x1 - value of R3 on exit
- * y1 - value of R4 on exit
- *
- * Other notes: Calls SWI 0x40097.
- */
-
- extern os_error *xfont_string_bbox (char *s,
- int *x0,
- int *y0,
- int *x1,
- int *y1);
- extern void font_string_bbox (char *s,
- int *x0,
- int *y0,
- int *x1,
- int *y1);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_colour_table()
- *
- * Description: Reads the anti-alias colour table
- *
- * Input: colour_table - value of R1 on entry
- *
- * Other notes: Calls SWI 0x40098.
- */
-
- extern os_error *xfont_read_colour_table (font_colour_table *colour_table);
- extern void font_read_colour_table (font_colour_table *colour_table);
-
- /* ------------------------------------------------------------------------
- * Function: font_make_bitmap()
- *
- * Description: Make a font bitmap file
- *
- * Input: font_name - value of R1 on entry
- * xsize - value of R2 on entry
- * ysize - value of R3 on entry
- * xres - value of R4 on entry
- * yres - value of R5 on entry
- * flags - value of R6 on entry
- *
- * Other notes: Calls SWI 0x40099.
- */
-
- extern os_error *xfont_make_bitmap (char *font_name,
- int xsize,
- int ysize,
- int xres,
- int yres,
- bits flags);
- extern void font_make_bitmap (char *font_name,
- int xsize,
- int ysize,
- int xres,
- int yres,
- bits flags);
-
- /* ------------------------------------------------------------------------
- * Function: font_un_cache_file()
- *
- * Description: Deletes font cache information, or recaches it
- *
- * Input: file_name - value of R0 on entry
- * recache - value of R1 on entry
- *
- * Other notes: Calls SWI 0x4009A.
- */
-
- extern os_error *xfont_un_cache_file (char *file_name,
- bool recache);
- extern void font_un_cache_file (char *file_name,
- bool recache);
-
- /* ------------------------------------------------------------------------
- * Function: font_set_font_max()
- *
- * Description: Sets the FontMax values
- *
- * Input: font_max - value of R0 on entry
- * font_max1 - value of R1 on entry
- * font_max2 - value of R2 on entry
- * font_max3 - value of R3 on entry
- * font_max4 - value of R4 on entry
- * font_max5 - value of R5 on entry
- *
- * Other notes: Calls SWI 0x4009B with R6 = 0x0, R7 = 0x0.
- */
-
- extern os_error *xfont_set_font_max (int font_max,
- int font_max1,
- int font_max2,
- int font_max3,
- int font_max4,
- int font_max5);
- extern void font_set_font_max (int font_max,
- int font_max1,
- int font_max2,
- int font_max3,
- int font_max4,
- int font_max5);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_font_max()
- *
- * Description: Reads the FontMax values
- *
- * Output: font_max - value of R0 on exit
- * font_max1 - value of R1 on exit
- * font_max2 - value of R2 on exit
- * font_max3 - value of R3 on exit
- * font_max4 - value of R4 on exit
- * font_max5 - value of R5 on exit
- *
- * Other notes: Calls SWI 0x4009C.
- */
-
- extern os_error *xfont_read_font_max (int *font_max,
- int *font_max1,
- int *font_max2,
- int *font_max3,
- int *font_max4,
- int *font_max5);
- extern void font_read_font_max (int *font_max,
- int *font_max1,
- int *font_max2,
- int *font_max3,
- int *font_max4,
- int *font_max5);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_font_prefix()
- *
- * Description: Finds the directory prefix for a given font handle
- *
- * Input: font - value of R0 on entry
- * buffer - value of R1 on entry
- * size - value of R2 on entry
- *
- * Output: end - value of R1 on exit
- *
- * Other notes: Calls SWI 0x4009D.
- */
-
- extern os_error *xfont_read_font_prefix (font_f font,
- char *buffer,
- int size,
- char **end);
- extern void font_read_font_prefix (font_f font,
- char *buffer,
- int size,
- char **end);
-
- /* ------------------------------------------------------------------------
- * Function: font_switch_output_to_buffer()
- *
- * Description: Switches output to a buffer, creating a Draw file
- * structure
- *
- * Input: flags - value of R0 on entry
- * buffer - value of R1 on entry
- *
- * Output: end - value of R1 on exit
- *
- * Other notes: Calls SWI 0x4009E.
- */
-
- extern os_error *xfont_switch_output_to_buffer (bits flags,
- byte *buffer,
- char **end);
- extern void font_switch_output_to_buffer (bits flags,
- byte *buffer,
- char **end);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_font_metrics()
- *
- * Description: Reads the full metrics information held in a font's
- * IntMetrics file
- *
- * Input: font - value of R0 on entry
- * bbox_info - value of R1 on entry
- * xwidth_info - value of R2 on entry
- * ywidth_info - value of R3 on entry
- * misc_info - value of R4 on entry
- * kern_info - value of R5 on entry
- *
- * Output: flags - value of R0 on exit
- * bbox_info_size - value of R1 on exit
- * xwidth_info_size - value of R2 on exit
- * ywidth_info_size - value of R3 on exit
- * misc_info_size - value of R4 on exit
- * kern_info_size - value of R5 on exit
- *
- * Other notes: Calls SWI 0x4009F with R6 = 0x0, R7 = 0x0.
- */
-
- extern os_error *xfont_read_font_metrics (font_f font,
- font_bbox_info *bbox_info,
- font_width_info *xwidth_info,
- font_width_info *ywidth_info,
- font_misc_info *misc_info,
- font_kern_info *kern_info,
- bits *flags,
- int *bbox_info_size,
- int *xwidth_info_size,
- int *ywidth_info_size,
- int *misc_info_size,
- int *kern_info_size);
- extern void font_read_font_metrics (font_f font,
- font_bbox_info *bbox_info,
- font_width_info *xwidth_info,
- font_width_info *ywidth_info,
- font_misc_info *misc_info,
- font_kern_info *kern_info,
- bits *flags,
- int *bbox_info_size,
- int *xwidth_info_size,
- int *ywidth_info_size,
- int *misc_info_size,
- int *kern_info_size);
-
- /* ------------------------------------------------------------------------
- * Function: font_decode_menu()
- *
- * Description: Decode a selection made from a font menu
- *
- * Input: flags - value of R0 on entry
- * menu - value of R1 on entry
- * block - value of R2 on entry
- * buffer - value of R3 on entry
- * size - value of R4 on entry
- *
- * Output: next_selection - value of R3 on exit
- * used - value of R4 on exit
- *
- * Other notes: Calls SWI 0x400A0.
- */
-
- extern os_error *xfont_decode_menu (bits flags,
- byte *menu,
- byte *block,
- byte *buffer,
- int size,
- int **next_selection,
- int *used);
- extern void font_decode_menu (bits flags,
- byte *menu,
- byte *block,
- byte *buffer,
- int size,
- int **next_selection,
- int *used);
-
- /* ------------------------------------------------------------------------
- * Function: font_scan_string()
- *
- * Description: Returns information on a string
- *
- * Input: font - value of R0 on entry
- * s - value of R1 on entry
- * flags - value of R2 on entry
- * x - value of R3 on entry
- * y - value of R4 on entry
- * block - value of R5 on entry
- * trfm - value of R6 on entry
- * length - value of R7 on entry
- *
- * Output: split_point - value of R1 on exit
- * x_out - value of R3 on exit
- * y_out - value of R4 on exit
- * length_out - value of R7 on exit
- *
- * Other notes: Calls SWI 0x400A1.
- */
-
- extern os_error *xfont_scan_string (font_f font,
- char *s,
- bits flags,
- int x,
- int y,
- font_scan_block *block,
- os_trfm *trfm,
- int length,
- char **split_point,
- int *x_out,
- int *y_out,
- int *length_out);
- extern void font_scan_string (font_f font,
- char *s,
- bits flags,
- int x,
- int y,
- font_scan_block *block,
- os_trfm *trfm,
- int length,
- char **split_point,
- int *x_out,
- int *y_out,
- int *length_out);
-
- /* ------------------------------------------------------------------------
- * Function: font_current_rgb()
- *
- * Description: Reads the settings of colours after calling Font_Paint
- *
- * Output: font - value of R0 on exit (X version only)
- * bg_hint - value of R1 on exit
- * fill - value of R2 on exit
- * offset - value of R3 on exit
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x400A3.
- */
-
- extern os_error *xfont_current_rgb (font_f *font,
- os_colour *bg_hint,
- os_colour *fill,
- int *offset);
- extern font_f font_current_rgb (os_colour *bg_hint,
- os_colour *fill,
- int *offset);
-
- /* ------------------------------------------------------------------------
- * Function: font_future_rgb()
- *
- * Description: Reads the settings of colours after calling various
- * Font... SWI's
- *
- * Output: font - value of R0 on exit (X version only)
- * bg_hint - value of R1 on exit
- * fill - value of R2 on exit
- * offset - value of R3 on exit
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x400A4.
- */
-
- extern os_error *xfont_future_rgb (font_f *font,
- os_colour *bg_hint,
- os_colour *fill,
- int *offset);
- extern font_f font_future_rgb (os_colour *bg_hint,
- os_colour *fill,
- int *offset);
-
- /* ------------------------------------------------------------------------
- * Function: font_read_encoding_filename()
- *
- * Description: Returns the file name of the encoding file used for a
- * given font handle
- *
- * Input: font - value of R0 on entry
- * buffer - value of R1 on entry
- * size - value of R2 on entry
- *
- * Output: end - value of R1 on exit
- *
- * Other notes: Calls SWI 0x400A5.
- */
-
- extern os_error *xfont_read_encoding_filename (font_f font,
- char *buffer,
- int size,
- char **end);
- extern void font_read_encoding_filename (font_f font,
- char *buffer,
- int size,
- char **end);
-
- /* ------------------------------------------------------------------------
- * Function: font_find_field()
- *
- * Description: Returns a pointer to a specified field within a font
- * identifier
- *
- * Input: identifier - value of R0 on entry
- * qualifier - value of R2 on entry
- *
- * Output: field - value of R1 on exit
- * found - value of R2 on exit (X version only)
- *
- * Returns: R2 (non-X version only)
- *
- * Other notes: Calls SWI 0x400A6.
- */
-
- extern os_error *xfont_find_field (char *identifier,
- char qualifier,
- char **field,
- bool *found);
- extern bool font_find_field (char *identifier,
- char qualifier,
- char **field);
-
- /* ------------------------------------------------------------------------
- * Function: font_apply_fields()
- *
- * Description: Merges a new set of fields with those already in a given
- * font identifier
- *
- * Input: identifier - value of R0 on entry
- * fields - value of R1 on entry
- * buffer - value of R2 on entry
- * size - value of R3 on entry
- *
- * Output: spare - value of R3 on exit
- *
- * Other notes: Calls SWI 0x400A7.
- */
-
- extern os_error *xfont_apply_fields (char *identifier,
- char *fields,
- char *buffer,
- int size,
- int *spare);
- extern void font_apply_fields (char *identifier,
- char *fields,
- char *buffer,
- int size,
- int *spare);
-
- /* ------------------------------------------------------------------------
- * Function: font_lookup_font()
- *
- * Description: Returns information about a given font
- *
- * Input: font - value of R0 on entry
- *
- * Output: flags - value of R2 on exit (X version only)
- *
- * Returns: R2 (non-X version only)
- *
- * Other notes: Calls SWI 0x400A8 with R1 = 0x0, R2 = 0x0.
- */
-
- extern os_error *xfont_lookup_font (font_f font,
- bits *flags);
- extern bits font_lookup_font (font_f font);
-
- /* ------------------------------------------------------------------------
- * Function: service_fonts_changed()
- *
- * Description: New Font$Path detected
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x6E.
- */
-
- extern os_error *xservice_fonts_changed (void);
- extern void service_fonts_changed (void);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-