1 /* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */ 2 3 #ifndef __VT_DRCS_H__ 4 #define __VT_DRCS_H__ 5 6 #include <pobl/bl_types.h> 7 #include <mef/ef_char.h> 8 9 typedef struct vt_drcs_font { 10 /*ef_charset_t cs;*/ /* 0x40-0x7e */ 11 char *glyphs[0x60]; 12 13 u_int16_t pic_id; /* MAX_INLINE_PICTURES in ui_picture.h */ 14 u_int16_t pic_beg_idx; /* 0x0-0x59 */ 15 u_int16_t pic_num_cols; 16 u_int16_t pic_num_rows; 17 u_int16_t pic_num_cols_small; 18 u_int16_t pic_num_rows_small; 19 u_int32_t pic_offset; /* offset from the begining of the picture */ 20 21 } vt_drcs_font_t; 22 23 typedef struct vt_drcs { 24 vt_drcs_font_t *fonts[CS96SB_ID(0x7e)+1]; 25 26 } vt_drcs_t; 27 28 #define vt_drcs_new() calloc(1, sizeof(vt_drcs_t)) 29 30 #define vt_drcs_destroy(drcs) \ 31 vt_drcs_final_full(drcs); \ 32 free(drcs); 33 34 void vt_drcs_select(vt_drcs_t *drcs); 35 36 char *vt_drcs_get_glyph(ef_charset_t cs, u_char idx); 37 38 vt_drcs_font_t *vt_drcs_get_font(vt_drcs_t *drcs, ef_charset_t cs, int create); 39 40 void vt_drcs_final(vt_drcs_t *drcs, ef_charset_t cs); 41 42 void vt_drcs_final_full(vt_drcs_t *drcs); 43 44 void vt_drcs_add_glyph(vt_drcs_font_t *font, int idx, const char *seq, u_int width, u_int height); 45 46 void vt_drcs_add_picture(vt_drcs_font_t *font, int id, u_int offset, int beg_inx, 47 u_int num_cols, u_int num_rows, u_int num_cols_small, 48 u_int num_rows_small); 49 50 int vt_drcs_get_picture(vt_drcs_font_t *font, int *id, int *pos, u_int ch); 51 52 #define vt_drcs_has_picture(font) ((font)->pic_num_rows > 0) 53 54 #define vt_drcs_is_picture(font, ch) \ 55 (vt_drcs_has_picture(font) && (font)->pic_beg_idx + 0x20 <= ((ch) & 0x7f)) 56 57 int vt_convert_drcs_to_unicode_pua(ef_char_t *ch); 58 59 int vt_convert_unicode_pua_to_drcs(ef_char_t *ch); 60 61 #endif 62