| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | #ifndef _LIBXFONT2_H_ |
| 24 | #define _LIBXFONT2_H_ |
| 25 | |
| 26 | #include <stddef.h> |
| 27 | #include <stdarg.h> |
| 28 | #include <stdint.h> |
| 29 | #include <X11/Xfuncproto.h> |
| 30 | #include <X11/fonts/font.h> |
| 31 | #include <X11/fonts/fontproto.h> |
| 32 | |
| 33 | #define XFONT2_FPE_FUNCS_VERSION 1 |
| 34 | |
| 35 | typedef int (*WakeupFpe) (FontPathElementPtr fpe); |
| 36 | |
| 37 | typedef struct _xfont2_fpe_funcs { |
| 38 | int version; |
| 39 | NameCheckFunc name_check; |
| 40 | InitFpeFunc init_fpe; |
| 41 | FreeFpeFunc free_fpe; |
| 42 | ResetFpeFunc reset_fpe; |
| 43 | OpenFontFunc open_font; |
| 44 | CloseFontFunc close_font; |
| 45 | ListFontsFunc list_fonts; |
| 46 | StartLfwiFunc start_list_fonts_with_info; |
| 47 | NextLfwiFunc list_next_font_with_info; |
| 48 | WakeupFpe wakeup_fpe; |
| 49 | ClientDiedFunc client_died; |
| 50 | LoadGlyphsFunc load_glyphs; |
| 51 | StartLaFunc start_list_fonts_and_aliases; |
| 52 | NextLaFunc list_next_font_or_alias; |
| 53 | SetPathFunc set_path_hook; |
| 54 | } xfont2_fpe_funcs_rec, *xfont2_fpe_funcs_ptr; |
| 55 | |
| 56 | typedef void (*FontBlockHandlerProcPtr) (void *timeout); |
| 57 | |
| 58 | typedef void (*FontFdHandlerProcPtr) (int fd, void *data); |
| 59 | |
| 60 | #define XFONT2_CLIENT_FUNCS_VERSION 1 |
| 61 | |
| 62 | typedef struct _xfont2_client_funcs { |
| 63 | int version; |
| 64 | int (*client_auth_generation)(ClientPtr client); |
| 65 | Bool (*client_signal)(ClientPtr client); |
| 66 | void (*delete_font_client_id)(Font id); |
| 67 | void (*verrorf)(const char *f, va_list ap) _X_ATTRIBUTE_PRINTF(1,0); |
| 68 | FontPtr (*find_old_font)(FSID id); |
| 69 | FontResolutionPtr (*get_client_resolutions)(int *num); |
| 70 | int (*get_default_point_size)(void); |
| 71 | Font (*get_new_font_client_id)(void); |
| 72 | uint32_t (*get_time_in_millis)(void); |
| 73 | int (*init_fs_handlers)(FontPathElementPtr fpe, |
| 74 | FontBlockHandlerProcPtr block_handler); |
| 75 | int (*register_fpe_funcs)(const xfont2_fpe_funcs_rec *funcs); |
| 76 | void (*remove_fs_handlers)(FontPathElementPtr fpe, |
| 77 | FontBlockHandlerProcPtr block_handler, |
| 78 | Bool all ); |
| 79 | void *(*get_server_client)(void); |
| 80 | int (*set_font_authorizations)(char **authorizations, |
| 81 | int *authlen, void *client); |
| 82 | int (*store_font_client_font)(FontPtr pfont, Font id); |
| 83 | Atom (*make_atom)(const char *string, unsigned len, int makeit); |
| 84 | int (*valid_atom)(Atom atom); |
| 85 | const char *(*name_for_atom)(Atom atom); |
| 86 | unsigned long (*get_server_generation)(void); |
| 87 | int (*add_fs_fd)(int fd, FontFdHandlerProcPtr handler, void *data); |
| 88 | void (*remove_fs_fd)(int fd); |
| 89 | void (*adjust_fs_wait_for_delay)(void *wt, unsigned long newdelay); |
| 90 | } xfont2_client_funcs_rec, *xfont2_client_funcs_ptr; |
| 91 | |
| 92 | _X_EXPORT int |
| 93 | xfont2_init(xfont2_client_funcs_rec const *client_funcs); |
| 94 | |
| 95 | _X_EXPORT void |
| 96 | xfont2_query_glyph_extents(FontPtr pFont, CharInfoPtr *charinfo, |
| 97 | unsigned long count, ExtentInfoRec *info); |
| 98 | |
| 99 | _X_EXPORT Bool |
| 100 | xfont2_query_text_extents(FontPtr pFont, unsigned long count, |
| 101 | unsigned char *chars, ExtentInfoRec *info); |
| 102 | |
| 103 | _X_EXPORT Bool |
| 104 | xfont2_parse_glyph_caching_mode(char *str); |
| 105 | |
| 106 | _X_EXPORT void |
| 107 | xfont2_init_glyph_caching(void); |
| 108 | |
| 109 | _X_EXPORT void |
| 110 | xfont2_set_glyph_caching_mode(int newmode); |
| 111 | |
| 112 | _X_EXPORT FontNamesPtr |
| 113 | xfont2_make_font_names_record(unsigned size); |
| 114 | |
| 115 | _X_EXPORT void |
| 116 | xfont2_free_font_names(FontNamesPtr pFN); |
| 117 | |
| 118 | _X_EXPORT int |
| 119 | xfont2_add_font_names_name(FontNamesPtr names, |
| 120 | char *name, |
| 121 | int length); |
| 122 | |
| 123 | typedef struct _xfont2_pattern_cache *xfont2_pattern_cache_ptr; |
| 124 | |
| 125 | _X_EXPORT xfont2_pattern_cache_ptr |
| 126 | xfont2_make_font_pattern_cache(void); |
| 127 | |
| 128 | _X_EXPORT void |
| 129 | xfont2_free_font_pattern_cache(xfont2_pattern_cache_ptr cache); |
| 130 | |
| 131 | _X_EXPORT void |
| 132 | xfont2_empty_font_pattern_cache(xfont2_pattern_cache_ptr cache); |
| 133 | |
| 134 | _X_EXPORT void |
| 135 | xfont2_cache_font_pattern(xfont2_pattern_cache_ptr cache, |
| 136 | const char * pattern, |
| 137 | int patlen, |
| 138 | FontPtr pFont); |
| 139 | |
| 140 | _X_EXPORT FontPtr |
| 141 | xfont2_find_cached_font_pattern(xfont2_pattern_cache_ptr cache, |
| 142 | const char * pattern, |
| 143 | int patlen); |
| 144 | |
| 145 | _X_EXPORT void |
| 146 | xfont2_remove_cached_font_pattern(xfont2_pattern_cache_ptr cache, |
| 147 | FontPtr pFont); |
| 148 | |
| 149 | |
| 150 | |
| 151 | _X_EXPORT int |
| 152 | xfont2_allocate_font_private_index (void); |
| 153 | |
| 154 | static inline void * |
| 155 | xfont2_font_get_private(FontPtr pFont, int n) |
| 156 | { |
| 157 | if (n > pFont->maxPrivate) |
| 158 | return NULL; |
| 159 | return pFont->devPrivates[n]; |
| 160 | } |
| 161 | |
| 162 | _X_EXPORT Bool |
| 163 | xfont2_font_set_private(FontPtr pFont, int n, void *ptr); |
| 164 | |
| 165 | #endif |