home *** CD-ROM | disk | FTP | other *** search
- /*
- #### # # # #
- # # # # # The FreeWare C library for
- # # ## ### # # # # ### RISC OS machines
- # # # # # # # # # # # ___________________________________
- # # #### ### ## # # # #
- # # # # # # # # # # Please refer to the accompanying
- #### ### #### # # ##### # ### documentation for conditions of use
- ________________________________________________________________________
-
- File: Font.h
- Author: Copyright © 1993 Shaun Blackmore
- Version: 1.01 (22 May 1992)
- Purpose: Assembler SWI veneers for the Font Manager
-
- NOTE that some names are not strictly 'DeskLib' style, to keep
- them consistent with the SWIs they represent ("Converttopoints",
- etc). However, macros with 'DeskLib' naming are provided to allow
- either naming style to be used.
- */
-
- #ifndef __dl_font_h
- #define __dl_font_h
-
- #ifndef __dl_core_h
- #include "Core.h"
- #endif
-
- #ifndef __dl_wimp_h
- #include "Wimp.h"
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- typedef int font_handle;
-
- typedef struct
- {
- char name[128]; /* NOTE: Font_ReadDefn returns this string CR terminated */
- int xsize, ysize, xres, yres;
- int age, usage;
- } font_defn;
-
-
- typedef struct
- {
- int minx, miny, maxx, maxy;
- } font_info;
-
-
- typedef struct
- {
- char *s; /* string */
- int x; /* in/out, in 1/72000s of an inch */
- int y; /* in/out, in 1/72000s of an inch */
- int split; /* in/out: space char, or -1 */
- /* on exit, = count of space or printable */
- int term; /* in/out: index into s */
- } font_string;
-
-
- typedef struct
- {
- int background, foreground;
- } font_colours;
-
-
- typedef struct
- {
- font_handle font;
- font_colours colour;
- int offset;
- } font_state;
-
-
- typedef struct
- {
- char offset;
- char thresholds[15];
- } font_thresholds;
-
-
- /* Font usage array (font_array)
- * This array is indexed by the font handle - each entry contains a
- * count of how many times we have FindFont'd this font. This is used
- * mainly by the template system (Wimp_LoadTemplate).
- * See Font_LoseAllFonts
- * For convenience, this is defined in Wimp.h (it is mainly used for
- * template loading)
- *
- * typedef struct
- * {
- * char fonts[256];
- * } font_array;
- */
-
- extern os_error *Font_CacheAddr(int *version, int *cacheused, int *cachesize);
- extern os_error *Font_ListFonts(char *name, int *count);
-
- extern os_error *Font_ReadDefn(font_handle font, font_defn *defn);
- extern os_error *Font_ReadInfo(font_handle font, font_info *info);
-
- extern os_error *Font_ConverttoOS(int x, int y, int *xout, int *yout);
- #define Font_ConvertToOS Font_ConverttoOS
- extern os_error *Font_Converttopoints(int x, int y, int *xout, int *yout);
- #define Font_ConvertToPoints Font_Converttopoints
-
- extern os_error *Font_FindFont(font_handle *font, char *name,
- int xsize, int ysize, int xres, int yres);
- extern os_error *Font_LoseFont(font_handle font);
-
- /* Font_LoseAllFonts
- * Given a font usage array, this function calls Font_Lose for all fonts
- * used, and sets the font usage array to zeros. See above for info on
- * how a font usage array is organised...
- */
- extern void Font_LoseAllFonts(font_array *fonts);
-
- extern os_error *Font_SetFont(font_handle font);
- extern os_error *Font_CurrentFont(font_state *state);
- extern os_error *Font_FutureFont(font_state *state);
-
- extern os_error *Font_Paint(char *, int options, int x, int y);
-
- extern os_error *Font_Caret(int colour, int height, int flags, int x, int y);
- extern os_error *Font_FindCaret(font_string *string);
- extern os_error *Font_FindCaretJ(font_string *s, int xoffset, int yoffset);
-
- extern os_error *Font_StringWidth(font_string *string);
- extern os_error *Font_CharBBox(font_handle font, char c,
- int flags, font_info *info);
- extern os_error *Font_StringBBox(char *string, font_info *info);
-
- extern os_error *Font_ReadScaleFactor(int *xscale, int *yscale);
-
- extern os_error *Font_SetFontColours(font_handle font,
- int back_colour, int fore_colour,
- int offset);
- extern os_error *Font_SetPalette(int back_log, int fore_log,
- int offset,
- int back_phys, int fore_phys);
-
- extern os_error *Font_ReadThresholds(font_thresholds *t);
- extern os_error *Font_SetThresholds(font_thresholds *t);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-