| 1 | /****************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright (c) 2004 Digital STREAM Technology Inc. All Rights Reserved |
|---|
| 4 | |
|---|
| 5 | FILE NAME |
|---|
| 6 | |
|---|
| 7 | GFN_Base.h |
|---|
| 8 | |
|---|
| 9 | VERSION |
|---|
| 10 | |
|---|
| 11 | Version 0.4 |
|---|
| 12 | |
|---|
| 13 | DESCRIPTION |
|---|
| 14 | |
|---|
| 15 | This file is header file for Font Manager module in Graphics Lib. |
|---|
| 16 | |
|---|
| 17 | AUTHOR |
|---|
| 18 | |
|---|
| 19 | S/W 3 team Jongki-Jeong |
|---|
| 20 | |
|---|
| 21 | HISTORY |
|---|
| 22 | |
|---|
| 23 | NAME DATE REMARKS |
|---|
| 24 | |
|---|
| 25 | Jong-ki Jeong 05-25-2004 Created initial version 0.01 |
|---|
| 26 | Jong-ki Jeong 05-25-2004 add gfn_open_page_print |
|---|
| 27 | add gfn_open_page_uprint |
|---|
| 28 | add gfn_close_page_print |
|---|
| 29 | add gfn_get_page_info |
|---|
| 30 | add gfn_page_move_down |
|---|
| 31 | add gfn_page_move_up |
|---|
| 32 | add GFN_INSIDE |
|---|
| 33 | Jinsook Kim 06-24-2004 modify GFN_INSIDE ¿¡ UT_FC fc Ãß°¡ |
|---|
| 34 | Jinsook Kim 06-25-2004 Updated version : 0.01->0.1 |
|---|
| 35 | Jinsook Kim 08-18-2004 Updated version : 0.1->0.2 |
|---|
| 36 | Jinsook Kim 09-17-2004 modify FN_CACHE [jum3, jum1 ¿¡ ´ëÇÑ member Ãß°¡] |
|---|
| 37 | Jong-ki Jeong 03-14-2005 font mode, user font °ü·Ã ±¸Á¶Ã¼ ¹× ÇÔ¼öÃß°¡ |
|---|
| 38 | Jinsook Kim 03-30-2005 Updated version : 0.2->0.3 |
|---|
| 39 | Jinsook Kim 04-21-2005 Updated version : 0.3->0.4 |
|---|
| 40 | |
|---|
| 41 | REMARK |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | ***************************************************************************/ |
|---|
| 45 | |
|---|
| 46 | #ifndef GFN_BASE_H |
|---|
| 47 | #define GFN_BASE_H |
|---|
| 48 | |
|---|
| 49 | #include "GFN_Service.h" |
|---|
| 50 | #include "JUNGLE/JungleSupport.h" |
|---|
| 51 | |
|---|
| 52 | #ifdef __cplusplus |
|---|
| 53 | extern "C" { |
|---|
| 54 | #endif |
|---|
| 55 | |
|---|
| 56 | typedef struct { |
|---|
| 57 | |
|---|
| 58 | UINT8 ascii_w[128-32+1]; //min ascii 32 , max ascii 128 |
|---|
| 59 | UINT8 ascii_h[128-32+1]; |
|---|
| 60 | UINT8 ofs_y[128-32+1]; |
|---|
| 61 | SINT32 max_char_h; |
|---|
| 62 | SINT32 max_char_w; |
|---|
| 63 | SINT32 min_ofs_y; |
|---|
| 64 | SINT32 line_height; |
|---|
| 65 | SINT32 jum3_width; //[...]ÀÇ ÃѱæÀÌ |
|---|
| 66 | SINT32 jum3_height; //[...]ÀÇ ³ôÀÌ |
|---|
| 67 | SINT32 jum1_width; //[.]ÀÇ ³ÐÀÌ |
|---|
| 68 | SINT32 jum1_hor_pitch; //[.]ÀÇ horizontal pitch |
|---|
| 69 | SINT32 jum1_ox; //[.]ÀÇ image.bbox.ox |
|---|
| 70 | |
|---|
| 71 | }FN_CACHE; //size ¿¡ ´ëÇÑ cache |
|---|
| 72 | |
|---|
| 73 | typedef struct { |
|---|
| 74 | UINT16 *data; |
|---|
| 75 | SINT16 sx; |
|---|
| 76 | SINT16 sy; |
|---|
| 77 | }FN_LINE_DATA; |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | typedef enum { |
|---|
| 81 | FN_PAGE_NONE = 0, // virtual port °¡ »ç¿ëµÇÁö¾Ê´Â»óÅÂÀÓ |
|---|
| 82 | FN_PAGE_INIT = 1, |
|---|
| 83 | FN_PAGE_USING = 2, |
|---|
| 84 | }FN_PAGE_STAT; |
|---|
| 85 | |
|---|
| 86 | typedef enum { |
|---|
| 87 | FN_PAGE_NORMAL = 0, |
|---|
| 88 | FN_PAGE_AROUND = 1, |
|---|
| 89 | }FN_PAGE_TYPE; |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | #define GFN_CACHE(cv) (&(((GFN_INSIDE *)(cv)->font_inside)->cache[(cv)->font_mode%GFN_NUM_MODE])) |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | typedef struct { |
|---|
| 96 | FN_CACHE cache[GFN_NUM_MODE]; //size ¸¦ ´ã°í ÀÖ´Â cache |
|---|
| 97 | /* |
|---|
| 98 | #define MIN_CHAR_WIDTH 10 |
|---|
| 99 | #define MAX_CHAR_WIDTH 44 |
|---|
| 100 | SINT8 max_char_width[MAX_CHAR_WIDTH-MIN_CHAR_WIDTH+1]; |
|---|
| 101 | SINT8 max_char_height[MAX_CHAR_WIDTH-MIN_CHAR_WIDTH+1]; |
|---|
| 102 | SINT8 max_char_jum3_size[MAX_CHAR_WIDTH-MIN_CHAR_WIDTH+1]; |
|---|
| 103 | */ |
|---|
| 104 | SINT32 last_x; //canvas ¿¡ ±ÛÀÚ¸¦ ¾´ÈÄ ´ÙÀ½ x ÁÂÇ¥ |
|---|
| 105 | |
|---|
| 106 | /* GFN_OpenVirPrint µîÀÇ ÇÔ¼ö³»¿¡¼ »ç¿ë */ |
|---|
| 107 | GFN_FONT_ATTR bak_attr; |
|---|
| 108 | GFN_FONT_ATTR page_font_attr; |
|---|
| 109 | FN_LINE_DATA *line_datas; //¶óÀεéÀÇ text ¹è¿ |
|---|
| 110 | |
|---|
| 111 | FN_PAGE_STAT page_text_used; //»ç¿ëµÇ°íÀÖ´Â ¿©ºÎ PAge ÇÔ¼ö¸¦ »ç¿ëÇÑµÚ Ç×»ó NONE À¸·Î clear µÈ´Ù. |
|---|
| 112 | FN_PAGE_STAT page_text_used_backup; //»ç¿ëµÇ°íÀÖ´Â ¿©ºÎ |
|---|
| 113 | |
|---|
| 114 | FN_PAGE_TYPE type; //page scroll À» ¾î¶²½ÄÀ¸·Î Áö¿øÇϴ°¡ |
|---|
| 115 | GRP_RECT page_text_r; //page pixel Å©±â¿Í ½ÃÀÛ ÁÂÇ¥ |
|---|
| 116 | SINT32 text_total_line; //total ¶óÀÎ ¼ö |
|---|
| 117 | |
|---|
| 118 | SINT32 top_line_index; //page ¿¡¼ Á¦ÀÏ Ã¹¶óÀÎ |
|---|
| 119 | SINT32 line_per_page; //page ´ç line ¼ö |
|---|
| 120 | SINT32 curr_pos_index; //ÇöÀç Ä¿¼°¡ ÀÖ´Ù°í °¡Á¤ÇßÀ»¶§ pos index |
|---|
| 121 | UINT16 *alloc_string; //ascii code µéÀ» unicode ·Î º¯È¯ÇÑ pointer |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | UT_FC fc; |
|---|
| 125 | }GFN_INSIDE; //³»ºÎ¾È¿¡¼ »ç¿ëµÇ´Â ROOTINE |
|---|
| 126 | |
|---|
| 127 | /********************* debug ºÎºÐ ********************************/ |
|---|
| 128 | //int g_Trace_FontDebug=3; |
|---|
| 129 | //4=value check, 3=enter/exit, 2=warning, 1=error |
|---|
| 130 | //int gfn_printf(int level, char *fmt, ...) ; |
|---|
| 131 | int gfn_printf(char *fmt, ...) ; |
|---|
| 132 | |
|---|
| 133 | /******* jungle engine ********************************************************/ |
|---|
| 134 | void JG_init( void ) ; |
|---|
| 135 | void JG_free (CANVAS *cv) ; |
|---|
| 136 | void JG_get_max_char_size(CANVAS *cv, SINT32 *max_width ,SINT32 *max_height) ; |
|---|
| 137 | void JG_set_attr(CANVAS *cv ) ; |
|---|
| 138 | void JG_get_uchar_size(CANVAS *cv, SINT32 *width, SINT32 *height, SINT32 *ofs_y, UINT16 ch) ; |
|---|
| 139 | SINT32 JG_put_char(CANVAS *cv, SINT32 pos_x, SINT32 pos_y, UINT16 ch) ; |
|---|
| 140 | SINT32 JG_get_real_char_size(CANVAS *cv, SINT32 *char_x, SINT32 *char_y, SINT32 *char_w, SINT32 *char_h, UINT16 ch) ; |
|---|
| 141 | void JG_open(CANVAS *cv) ; |
|---|
| 142 | |
|---|
| 143 | /******* user bitmap font *****************************************************/ |
|---|
| 144 | void BIT_get_max_char_size(CANVAS *cv , SINT32 *max_width ,SINT32 *max_height ) ; |
|---|
| 145 | void BIT_set_attr(CANVAS *cv ) ; |
|---|
| 146 | void BIT_get_uchar_size(CANVAS *cv,SINT32 *width, SINT32 *height, SINT32 *ofs_y, UINT16 ch) ; |
|---|
| 147 | SINT32 BIT_font_register( CANVAS *cv , void *finfo_ptr ) ; |
|---|
| 148 | SINT32 BIT_get_real_char_size(CANVAS *cv,SINT32 *char_x, SINT32 *char_y, SINT32 *char_w, SINT32 *char_h, UINT16 ch) ; |
|---|
| 149 | SINT32 BIT_put_char(CANVAS *cv, SINT32 sx, SINT32 sy, UINT16 ch) ; |
|---|
| 150 | void BIT_free(CANVAS *cv) ; |
|---|
| 151 | |
|---|
| 152 | /******* dst bitmap font ******************************************************/ |
|---|
| 153 | void DST_get_max_char_size(CANVAS *cv , SINT32 *max_width ,SINT32 *max_height ) ; |
|---|
| 154 | void DST_set_attr(CANVAS *cv) ; |
|---|
| 155 | void DST_get_uchar_size(CANVAS *cv,SINT32 *width, SINT32 *height, SINT32 *ofs_y, UINT16 ch) ; |
|---|
| 156 | SINT32 DST_font_register(CANVAS *cv, void *dst_hfinfo_ptr, void *user_efinfo_ptr) ; |
|---|
| 157 | SINT32 DST_put_char(CANVAS *cv, SINT32 sx, SINT32 sy, UINT16 ch) ; |
|---|
| 158 | void DST_free(CANVAS *cv) ; |
|---|
| 159 | |
|---|
| 160 | /******* common functions *****************************************************/ |
|---|
| 161 | void make_multi_string(SINT8 *string) ; |
|---|
| 162 | SINT32 get_num_line(SINT8 *string) ; |
|---|
| 163 | SINT32 get_line_string(SINT8 *src_string, SINT8 *tar_string, int line_num) ; |
|---|
| 164 | SINT32 line_str_len(SINT8 *src_string) ; |
|---|
| 165 | |
|---|
| 166 | int u_get_line_string(UINT16 *src_string, UINT16 *tar_string, int line_num) ; |
|---|
| 167 | int u_get_num_line(UINT16 *string) ; |
|---|
| 168 | int u_line_str_len(UINT16 *src_string) ; |
|---|
| 169 | int u_strcpy(UINT16 *tar, UINT16 *src) ; |
|---|
| 170 | int u_strlen(UINT16 *usp) ; |
|---|
| 171 | |
|---|
| 172 | void gfn_init(CANVAS *cv, UINT32 font_nation) ; |
|---|
| 173 | void gfn_set_font_nation(CANVAS *cv, GRP_NATION f_nation) ; |
|---|
| 174 | void gfn_set_attr(CANVAS *cv) ; |
|---|
| 175 | void gfn_get_max_char_size(CANVAS *cv, SINT32 *max_width, SINT32 *max_height ) ; |
|---|
| 176 | SINT32 gfn_get_real_char_size(CANVAS *cv, SINT32 *char_x, SINT32 *char_y, SINT32 *char_w, SINT32 *char_h, UINT16 ch) ; |
|---|
| 177 | SINT32 gfn_put_uchar(CANVAS *cv, SINT32 sx, SINT32 sy, UINT16 ch) ; |
|---|
| 178 | void gfn_free(CANVAS *cv); |
|---|
| 179 | void gfn_get_uchar_size( CANVAS *cv, SINT32 *width , SINT32 *height, SINT32 *ofs_y,UINT16 ch) ; |
|---|
| 180 | |
|---|
| 181 | SINT32 gfn_put_string(CANVAS *cv, SINT32 x, SINT32 y, SINT32 w, SINT32 h, SINT8 *str) ; |
|---|
| 182 | SINT32 gfn_put_ustring(CANVAS *cv, SINT32 x, SINT32 y, SINT32 w, SINT32 h, UINT16 *unicode) ; |
|---|
| 183 | SINT32 gfn_put_string_xy(CANVAS *cv,SINT32 *sx,SINT32 *sy, SINT8 *string) ; |
|---|
| 184 | SINT32 gfn_put_ustring_xy(CANVAS *cv,SINT32 *sx,SINT32 *sy, UINT16 *unicode, SINT32 max_len,SINT32 str_w) ; |
|---|
| 185 | |
|---|
| 186 | SINT32 gfn_get_ustr_size(CANVAS *cv,SINT32 *w, SINT32 *h, UINT16 *unicode, SINT32 *ofs_y, SINT32 max_len ) ; |
|---|
| 187 | void gfn_get_str_size(CANVAS *cv,SINT32 *w, SINT32 *h, SINT8 *string ) ; |
|---|
| 188 | SINT32 gfn_put_line_ustring(CANVAS *cv, SINT32 *sx, SINT32 *sy, SINT32 width, UINT16 *str_ptr, SINT32 max_len) ; |
|---|
| 189 | SINT32 gfn_put_line_string(CANVAS *cv, SINT32 *sx, SINT32 *sy, SINT32 width,SINT8 *string, SINT32 max_len) ; |
|---|
| 190 | |
|---|
| 191 | void gfn_open_page_print(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 w, SINT32 h ,SINT8 *str ) ; |
|---|
| 192 | void gfn_open_page_uprint(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 w, SINT32 h ,UINT16 *str ) ; |
|---|
| 193 | void gfn_page_move_down(CANVAS *cv ) ; |
|---|
| 194 | void gfn_page_move_up(CANVAS *cv ) ; |
|---|
| 195 | void gfn_get_page_info(CANVAS *cv, int *total_line ,int *line_per_page, int *top_index,int *curr_pos_index) ; |
|---|
| 196 | void gfn_close_page_print(CANVAS *cv) ; |
|---|
| 197 | void gfn_reset_cache(CANVAS *cv) ; |
|---|
| 198 | SINT32 gfn_get_line_height(CANVAS *cv) ; |
|---|
| 199 | |
|---|
| 200 | int KSX2Unicode(unsigned char *in_str, unsigned short *out_str, char bConvert) ; |
|---|
| 201 | int Ascii2Unicode(unsigned char *in_str, unsigned short *out_str) ; |
|---|
| 202 | |
|---|
| 203 | #ifdef __cplusplus |
|---|
| 204 | } |
|---|
| 205 | #endif |
|---|
| 206 | |
|---|
| 207 | #endif |
|---|
| 208 | //-----------------------------------------end of file |
|---|