home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / gcc / !GCC / patches / DeskLib / h / Font < prev    next >
Encoding:
Text File  |  1994-10-03  |  4.6 KB  |  153 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Font.h
  12.     Author:  Copyright © 1993 Shaun Blackmore
  13.     Version: 1.01 (22 May 1992)
  14.     Purpose: Assembler SWI veneers for the Font Manager
  15.  
  16.              NOTE that some names are not strictly 'DeskLib' style, to keep
  17.              them consistent with the SWIs they represent ("Converttopoints",
  18.              etc). However, macros with 'DeskLib' naming are provided to allow
  19.              either naming style to be used.
  20. */
  21.  
  22. #ifndef __dl_font_h
  23. #define __dl_font_h
  24.  
  25. #ifndef __dl_core_h
  26. #include "Core.h"
  27. #endif
  28.  
  29. #ifndef __dl_wimp_h
  30. #include "Wimp.h"
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. typedef int font_handle;
  38.  
  39. typedef struct
  40. {
  41.   char name[128];   /* NOTE: Font_ReadDefn returns this string CR terminated */
  42.   int xsize, ysize, xres, yres;
  43.   int age, usage;
  44. } font_defn;
  45.  
  46.  
  47. typedef struct
  48. {
  49.     int minx, miny, maxx, maxy;
  50. } font_info;
  51.  
  52.  
  53. typedef struct
  54. {
  55.   char *s;              /* string */
  56.   int x;                /* in/out, in 1/72000s of an inch */
  57.   int y;                /* in/out, in 1/72000s of an inch */
  58.   int split;            /* in/out: space char, or -1      */
  59.                         /*         on exit, = count of space or printable */
  60.   int term;             /* in/out: index into s */
  61. } font_string;
  62.  
  63.  
  64. typedef struct
  65. {
  66.   int background, foreground;
  67. } font_colours;
  68.  
  69.  
  70. typedef struct
  71. {
  72.   font_handle  font;
  73.   font_colours colour;
  74.   int          offset;
  75. } font_state;
  76.  
  77.  
  78. typedef struct
  79. {
  80.   char offset;
  81.   char thresholds[15];
  82. } font_thresholds;
  83.  
  84.  
  85.    /*  Font usage array  (font_array)
  86.     *  This array is indexed by the font handle - each entry contains a
  87.     *  count of how many times we have FindFont'd this font. This is used
  88.     *  mainly by the template system (Wimp_LoadTemplate).
  89.     *  See Font_LoseAllFonts
  90.     *  For convenience, this is defined in Wimp.h (it is mainly used for
  91.     *  template loading)
  92.     *
  93.     *  typedef struct
  94.     *  {
  95.     *    char fonts[256];
  96.     *  } font_array;
  97.     */
  98.  
  99. extern os_error *Font_CacheAddr(int *version, int *cacheused, int *cachesize);
  100. extern os_error *Font_ListFonts(char *name, int *count);
  101.  
  102. extern os_error *Font_ReadDefn(font_handle font, font_defn *defn);
  103. extern os_error *Font_ReadInfo(font_handle font, font_info *info);
  104.  
  105. extern os_error *Font_ConverttoOS(int x, int y, int *xout, int *yout);
  106. #define Font_ConvertToOS Font_ConverttoOS
  107. extern os_error *Font_Converttopoints(int x, int y, int *xout, int *yout);
  108. #define Font_ConvertToPoints Font_Converttopoints
  109.  
  110. extern os_error *Font_FindFont(font_handle *font, char *name,
  111.                                int xsize, int ysize, int xres, int yres);
  112. extern os_error *Font_LoseFont(font_handle font);
  113.  
  114.   /*  Font_LoseAllFonts
  115.    *  Given a font usage array, this function calls Font_Lose for all fonts
  116.    *  used, and sets the font usage array to zeros. See above for info on
  117.    *  how a font usage array is organised...
  118.    */
  119. extern void Font_LoseAllFonts(font_array *fonts);
  120.  
  121. extern os_error *Font_SetFont(font_handle font);
  122. extern os_error *Font_CurrentFont(font_state *state);
  123. extern os_error *Font_FutureFont(font_state *state);
  124.  
  125. extern os_error *Font_Paint(char *, int options, int x, int y);
  126.  
  127. extern os_error *Font_Caret(int colour, int height, int flags, int x, int y);
  128. extern os_error *Font_FindCaret(font_string *string);
  129. extern os_error *Font_FindCaretJ(font_string *s, int xoffset, int yoffset);
  130.  
  131. extern os_error *Font_StringWidth(font_string *string);
  132. extern os_error *Font_CharBBox(font_handle font, char c,
  133.                                int flags, font_info *info);
  134. extern os_error *Font_StringBBox(char *string, font_info *info);
  135.  
  136. extern os_error *Font_ReadScaleFactor(int *xscale, int *yscale);
  137.  
  138. extern os_error *Font_SetFontColours(font_handle font,
  139.                                      int back_colour, int fore_colour,
  140.                                      int offset);
  141. extern os_error *Font_SetPalette(int back_log,  int fore_log,
  142.                                  int offset,
  143.                                  int back_phys, int fore_phys);
  144.  
  145. extern os_error *Font_ReadThresholds(font_thresholds *t);
  146. extern os_error *Font_SetThresholds(font_thresholds *t);
  147.  
  148. #ifdef __cplusplus
  149.            }
  150. #endif
  151.  
  152. #endif
  153.