/****************************************************************************** Copyright (c) 2004 Digital STREAM Technology Inc. All Rights Reserved FILE NAME GFN_Service.h VERSION Version 0.4 DESCRIPTION This file is for Font Manager service header in Graphics Lib. AUTHOR S/W 3 Team Jinsook Kim. HISTORY NAME DATE REMARKS Jong-ki Jeong 03-20-2004 Created initial version 0.01 Jong-ki Jeong 03-20-2004 modify function name and ... Jong-ki Jeong 05-25-2004 add GFN_UOpenPagePrint add GFN_OpenPagePrint add GFN_ClosePagePrint add GFN_GetPageInfo add GFN_PageMoveDown add GFN_PageMoveUp add GFN_INSIDE Jinsook Kim 06-24-2004 modify GFN_Init modify font_style:UINT8->SINT32 add GFN_HANGUL_NORMAL type Jinsook Kim 06-25-2004 Updated version : 0.01->0.1 Jinsook Kim 08-18-2004 Updated version : 0.1->0.2 Jong-ki Jeong 08-19-2004 GFN_FONT_ATTR ±¸Á¶Ã¼ ¸â¹ö real_center Ãß°¡ Jinsook Kim 12-10-2004 GFN_FONT_ATTR ±¸Á¶Ã¼ ¸â¹ö space_ofs_x Ãß°¡ Jong-ki Jeong 03-14-2005 font mode, user font °ü·Ã ±¸Á¶Ã¼ ¹× ÇÔ¼öÃß°¡ Jinsook Kim 03-30-2005 Updated version : 0.2->0.3 Jinsook Kim 04-21-2005 Updated version : 0.3->0.4 REMARK ******************************************************************************/ #ifndef GFN_FONT_H #define GFN_FONT_H #ifdef __cplusplus extern "C" { #endif /*----------------------------------------------------------------------------- * type define of variable types *----------------------------------------------------------------------------*/ /******* font Á¾·ù ***********************************************************/ typedef enum { GFN_JUNGLE_MODE =0, GFN_DST_MODE =1,//ÇöÀç »ç¿ëÁß ¾Æ´Ô GFN_USER_MODE =2, GFN_NUM_MODE }GFN_FONT_MODE; /******* Á¤·Ä Á¾·ù ***********************************************************/ typedef enum { GFN_LEFT =0, //ÁÂÃø Á¤·Ä GFN_CENTER , //¿µ¿ªÀÇ Á¤Áß¾Ó GFN_RIGHT , //¿ìÃø Á¤·Ä GFN_CENTER_TOP , //Á¿ì center, À§ÂÊ Á¤·Ä // GFN_CENTER_BOT , //Á¿ì center, ¾Æ·¡ÂÊ Á¤·Ä GFN_LEFT_CENTER , //»óÇÏ center, ÁÂÃø Á¤·Ä GFN_RIGHT_CENTER, //»óÇÏ center, ¿ìÃø Á¤·Ä GFN_NUM_ADJUST }GFN_JUSTIFY; /******* Font Style variables ************************************************/ enum { GFN_DEFALUT = 0, //(3:SANSERIFMONO_FONT) GFN_SERIFMONO = 1, GFN_SERIF = 2, GFN_SANSERIFMONO = 3, GFN_SANSERIF = 4, GFN_CASUAL = 5, GFN_CURSIVE = 6, GFN_SMALLCAPITAL = 7, GFN_CC_DEFALUT = 20, //(23:SANSERIFMONO_FONT) GFN_CC_SERIFMONO = 21, GFN_CC_SERIF = 22, GFN_CC_SANSERIFMONO = 23, GFN_CC_SANSERIF = 24, GFN_CC_CASUAL = 25, GFN_CC_CURSIVE = 26, GFN_CC_SMALLCAPITAL = 27, GFN_HANGUL_NORMAL = 100 //Á¤±Û¿¡¼­ »ç¿ëÇÏ´Â ÇÑ±ÛÆùÆ® id }; /******* Pen Style ***********************************************************/ #define GFN_PEN_NORMAL 0x00 #define GFN_PEN_ITALIC 0x01 #define GFN_PEN_UNDERLINE 0x02 #define GFN_PEN_BOLD 0x04 /******* Font edge Á¾·ù ******************************************************/ enum { GFN_EDGE_NONE = 0, //edge ¾ø½¿ GFN_EDGE_RAISED = 1, //edge °¡ string ÀÇ ÁÂÃø»ó´Ü¿¡ À§Ä¡ÇÔ GFN_EDGE_DEPRESSED = 2, //edge °¡ string ÀÇ ¿ìÃøÇÏ´Ü¿¡ À§Ä¡ÇÔ GFN_EDGE_UNIFORM = 3, //edge °¡ string ÀÇ outline ¿¡ À§Ä¡ÇÔ GFN_EDGE_DROPSHADOW = 4 //edge °¡ string ¿¡ ¿À¹ö·¦µÇ¾î À§ÂÊ¿¡ À§Ä¡ÇÔ }; #define DEGREE_TO_RADIAN 0.01745329251944 /*----------------------------------------------------------------------------- * data structure *----------------------------------------------------------------------------*/ /************************************************************* FONT_STYLE Definition : SINT32 font_style; enum { GFN_DEFALUT = 0, //(3:SANSERIFMONO_FONT) GFN_SERIFMONO = 1, GFN_SERIF = 2, GFN_SANSERIFMONO = 3, GFN_SANSERIF = 4, GFN_CASUAL = 5, GFN_CURSIVE = 6, GFN_SMALLCAPITAL = 7, GFN_CC_DEFALUT = 20, //(23:SANSERIFMONO_FONT) GFN_CC_SERIFMONO = 21, GFN_CC_SERIF = 22, GFN_CC_SANSERIFMONO = 23, GFN_CC_SANSERIF = 24, GFN_CC_CASUAL = 25, GFN_CC_CURSIVE = 26, GFN_CC_SMALLCAPITAL = 27, GFN_HANGUL_NORMAL = 100 }; long font_size; -> em size of font UINT8 edge_types; //0-4 -> 0: GFN_EDGE_NONE 1: GFN_EDGE_RAISED 2: GFN_EDGE_DEPRESSED 3: GFN_EDGE_UNIFORM 4: GFN_EDGE_DROPSHADOW UINT8 pen_types; -> 1st bit Italic (ex. pen_types | PEN_ITALIC, pen_types & ~PEN_ITALIC) 2nd bit Underline (ex. pen_types | PEN_UNDERLINE, pen_types & ~PEN_UNDERLINE) italic degree : 30µµ 3rd bit BOLD (ex. pen_types | PEN_BOLD, pen_types & ~PEN_BOLD) UINT32 text_color; -> 256ÀÌ»óÀÏ °æ¿ì default color : white UINT32 edge_color; -> 256ÀÌ»óÀÏ °æ¿ì default : black UINT32 back_color; -> 256ÀÌ»óÀÏ °æ¿ì default : nothing int hor_pitch; -> ±ÛÀÚ°£°Ý int ver_pitch; -> ÁÙ°£°Ý UINT8 hor_align; -> (0: Left, 1: Center, 2: Right) UINT8 ver_align; -> (0: Top, 1: Middle, 2: Bottom) UINT8 backcolor_used; //back color is used UINT8 wordrap; //0: no wordrap, 1: apply wordrap && delete wordrap space, 2: apply wordrap && maintain wordrap space UINT8 same_char_width; //1: same charater width, 0 :none UINT8 cutting; //0:[...]Ç¥½Ã, 1: cutting GFN_JUSTIFY justify; //0=GFN_LEFT,ÀÌÈÄ ¼ø¼­´ë·Î GFN_CENTER, GFN_RIGHT, //GFN_CENTER_TOP,GFN_LEFT_CENTER,GFN_RIGHT_CENTER UINT8 real_center; //back box ¸¦ ±âÁØÀ¸·Î ÇÑ center int space_ofs_x; //space ¿Í ÀÌÈÄ¿¡ Ãâ·ÂµÉ ±ÛÀÚ¿ÍÀÇ ofs_x, *************************************************************/ /******* Font ¼Ó¼º ±¸Á¶Ã¼ ****************************************************/ typedef struct { SINT32 font_style; //0-7,100 SINT32 font_width; //em_size SINT32 font_height; //em_size UINT8 edge_types; //0-4 UINT8 pen_types; //1st bit Italic, 2nd bit Underline, 3rd bit BOLD UINT32 text_color; //256ÀÌ»óÀÏ °æ¿ì default : white UINT32 edge_color; //256ÀÌ»óÀÏ °æ¿ì default : black UINT32 back_color; //256ÀÌ»óÀÏ °æ¿ì default : nothing int hor_pitch; //±ÛÀÚ°£°Ý int ver_pitch; //ÁÙ°£°Ý UINT8 hor_align; //0: Left, 1: Center, 2: Right UINT8 ver_align; //0: Top, 1: Middle, 2: Bottom UINT8 backcolor_used; //back color is used UINT8 wordrap; //1=>wordrap UINT8 same_char_width;//not used UINT8 cutting; //0:[...]Ç¥½Ã, 1: cutting GFN_JUSTIFY justify; //0=GFN_LEFT,ÀÌÈÄ ¼ø¼­´ë·Î GFN_CENTER, GFN_RIGHT,... UINT8 real_center; //back box ¸¦ ±âÁØÀ¸·Î ÇÑ center int space_ofs_x; //space ¿Í ÀÌÈÄ¿¡ Ãâ·ÂµÉ ±ÛÀÚ¿ÍÀÇ ofs_x, } GFN_FONT_ATTR; /******* BITMAP font data map ÀÌ ¾î¶»°Ô ±¸¼ºµÇ¾îÀִ°¡¸¦ ³ªÅ¸³¿ ***************/ typedef struct { char start_ofsx; char start_ofsy; unsigned char char_width; //active font width unsigned char char_height; unsigned char byte_per_line; unsigned char reserved; unsigned short unicode_id; unsigned char *bitmap; }GFN_BIT_CHAR; typedef struct { unsigned short min_char; //minimum character in this font unsigned short max_char; //maximum character in this font unsigned char bit_used; // 0 or 1 : 1bit , 2: 2bit font unsigned char max_width; unsigned char max_height; unsigned char reserved; unsigned short reserved1; unsigned short num_char; GFN_BIT_CHAR *font; //fonts }GFN_USERFONT; typedef struct { char start_ofsx; //ÇöÀç´Â 0À¸·Î °íÁ¤µÊ char start_ofsy; //º¯°æµÇ´Â °ª unsigned char real_width; //°íÁ¤µÈ °ª unsigned char real_height; //°íÁ¤µÈ °ª unsigned char max_width; //ÇöÀç´Â real_width ¿Í µ¿ÀÏÇÔ unsigned char max_height; //real_height+offset_y(ÃÖ¼ÒÇÑ real_height) unsigned char *f_kerning_x; //Ãʼº unsigned char *f_kerning_y; unsigned char *s_kerning_x; //Áß¼º unsigned char *s_kerning_y; unsigned char *t_kerning_x; //Á¾¼º unsigned char *t_kerning_y; unsigned char *f_char_width; unsigned char *f_char_height; unsigned char *s_char_width; unsigned char *s_char_height; unsigned char *t_char_width; unsigned char *t_char_height; unsigned short *f_start_index; //bitmap ¹è¿­¿¡¼­ÀÇ ½ÃÀÛÀ§Ä¡ unsigned short *s_start_index; unsigned short *t_start_index; unsigned short *f_bitmap; unsigned short *s_bitmap; unsigned short *t_bitmap; }DST_HANGUL_FONT; /*----------------------------------------------------------------------------- * function prototype *----------------------------------------------------------------------------*/ /******* font manager init, terminate ****************************************/ void GFN_Init(CANVAS *cv) ; void GFN_InitEx(CANVAS *cv, GRP_NATION font_nation) ; void GFN_Terminate(void) ; /******* string print ********************************************************/ void GFN_CenterPrint(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 w ,SINT32 h , SINT8 *str, UINT32 text_color ) ; #define GFN_CenterPrintR(cv,r, str,text_color) GFN_CenterPrint(cv,(SINT32)((r)->x),(SINT32)((r)->y),(SINT32)((r)->w),(SINT32)((r)->h),str, text_color ) void GFN_LinePrint(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 width, SINT8 *str, UINT32 text_color) ; void GFN_Print(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 w, SINT32 h, SINT8 *str, UINT32 text_color ) ; #define GFN_PrintR(cv,r, str,text_color) GFN_Print(cv,(SINT32)((r)->x),(SINT32)((r)->y),(SINT32)((r)->w),(SINT32)((r)->h),str, text_color ) SINT32 GFN_PrintXY(CANVAS *cv, SINT32 sx, SINT32 sy, SINT8 *str, UINT32 text_color ) ; void GFN_GetLineHeight(CANVAS *cv,SINT32 *h ) ; void GFN_GetMaxCharSize( CANVAS *cv,int *w, int *h ) ; void GFN_GetStrSize(CANVAS *cv, SINT32 *w, SINT32 *h, SINT8 * str) ; /******* unicode string print ************************************************/ void GFN_UCenterPrint(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 w ,SINT32 h , UINT16 *str, UINT32 text_color ) ; #define GFN_UCenterPrintR(cv, r, str, text_color) GFN_UCenterPrint(cv,(SINT32)((r)->x),(SINT32)((r)->y),(SINT32)((r)->w),(SINT32)((r)->h),str,text_color) void GFN_ULinePrint(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 width, UINT16 *str, UINT32 text_color) ; void GFN_UPrint(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 w ,SINT32 h , UINT16 *str, UINT32 text_color ) ; #define GFN_UPrintR(cv,r, str,text_color) GFN_UPrint(cv,(SINT32)((r)->x),(SINT32)((r)->y),(SINT32)((r)->w),(SINT32)((r)->h),str, text_color ) SINT32 GFN_UPrintXY(CANVAS *cv, SINT32 sx, SINT32 sy, UINT16 *str, UINT32 text_color ) ; void GFN_UGetStrSize(CANVAS *cv, SINT32 *w,SINT32 *h, UINT16 *str) ; /******* page print **********************************************************/ void GFN_OpenPagePrint(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 w, SINT32 h, SINT8 *str, UINT32 text_color, UINT32 back_color) ; #define GFN_OpenPagePrintR(cv,r, str,text_color,back_color) GFN_OpenPagePrint(cv,(SINT32)((r)->x),(SINT32)((r)->y),(SINT32)((r)->w),(SINT32)((r)->h),str, text_color,back_color ) void GFN_GetPageInfo(CANVAS *cv, SINT32 *total_line, SINT32 *line_per_page, SINT32 *top_index, SINT32 *curr_pos_index) ; /******* unicode page print **************************************************/ void GFN_UOpenPagePrint(CANVAS *cv, SINT32 sx, SINT32 sy, SINT32 w, SINT32 h, UINT16 *str, UINT32 text_color, UINT32 back_color) ; #define GFN_UOpenPagePrintR(cv,r, str,text_color,back_color) GFN_UOpenPagePrint(cv,(SINT32)((r)->x),(SINT32)((r)->y),(SINT32)((r)->w),(SINT32)((r)->h),str, text_color,back_color ) /******* page print operation ************************************************/ void GFN_ClosePagePrint(CANVAS *cv) ; void GFN_PageMoveDown(CANVAS *cv, SINT32 refresh_now ) ; void GFN_PageMoveUp(CANVAS *cv, SINT32 refresh_now ) ; /******* font attribute ******************************************************/ void GFN_GetEdgeType(CANVAS *cv,UINT8 *edge_type,UINT32 *edge_color) ; void GFN_GetFontAttr(CANVAS *cv, GFN_FONT_ATTR *font_attr ) ; void GFN_SetAlign(CANVAS *cv, UINT8 hor_align,UINT8 ver_align) ; void GFN_SetBakColor(CANVAS *cv, UINT8 bakcolor_used, UINT32 back_color ) ; void GFN_SetEdgeType(CANVAS *cv, UINT8 edge_type , UINT32 edge_color ) ; void GFN_SetFontAttr(CANVAS *cv, GFN_FONT_ATTR *font_attr ) ; GRP_NATION GFN_GetFontNation(CANVAS *cv) ; void GFN_SetFontNation(CANVAS *cv, GRP_NATION font_nation) ; void GFN_SetFontStyle(CANVAS *cv, SINT32 font_style, SINT32 font_width, SINT32 font_height) ; void GFN_SetOutputStyle(CANVAS *cv, GFN_JUSTIFY justify, SINT32 same_char_width, UINT8 wordrap, UINT8 cutting) ; void GFN_SetPenType(CANVAS *cv, UINT8 pen_type ) ; void GFN_SetPitch(CANVAS *cv, SINT32 hor_pitch,SINT32 ver_pitch) ; void GFN_SetSpaceOffsetX(CANVAS *cv, SINT32 space_ofs_x) ; /******* user font info ******************************************************/ SINT32 GFN_RegisterUserFont(CANVAS *cv, void *user_font) ; void GFN_GetUserFont(CANVAS *cv, void **user_finfo) ; /******* dst font info *******************************************************/ SINT32 GFN_RegisterDstFont(CANVAS *cv, void *dst_hfont, void *user_efont) ; /******* font mode info ******************************************************/ void GFN_GetFontMode(CANVAS *cv,GFN_FONT_MODE *font_mode) ; void GFN_SetFontMode(CANVAS *cv, GFN_FONT_MODE font_mode) ; /******* font config *********************************************************/ void GFN_GetFontConfigFromCv(CANVAS *cv, GFN_FONT_ATTR *font_attr, GFN_FONT_MODE *font_mode) ; void GFN_SetFontConfigToCv(CANVAS *cv, GFN_FONT_ATTR *font_attr, GFN_FONT_MODE font_mode); /******* font util ***********************************************************/ int GFN_HStrLen(unsigned char *ucp) ; int GFN_UStrLen(unsigned short *usp) ; int GFN_UStrCpy(unsigned short *tar, unsigned short *src) ; SINT32 GFN_Ascii2Unicode(unsigned char *in_str, unsigned short *out_str) ; SINT32 GFN_ConvCharcode(unsigned char *in_str, unsigned short *out_str, BOOLEAN bConvert) ; #ifdef __cplusplus } #endif #endif //-----------------------------------------end of file