From 4b633c801dc59f4e676897e52fc096fdc2eec43d Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Tue, 5 Mar 2019 12:27:35 +0800 Subject: [PATCH] Introduce the Mchar32 type, and distinguish glyph and character --- ChangeLog | 2 +- include/gdi.h | 10 +- src/control/bidiedit.c | 74 ++-- src/control/test/bidiedit_arabic.c | 18 +- src/font/bitmapfont.c | 6 +- src/font/charset-arabic.c | 118 +++--- src/font/charset-bidi.c | 8 +- src/font/charset.c | 642 ++++++++++++++--------------- src/font/freetype2.c | 6 +- src/font/rawbitmap.c | 2 +- src/font/test/arabic/shape_test.c | 2 +- src/font/textops.c | 4 +- src/font/unicode-bidi-tables.h | 2 +- src/include/bidi.h | 4 +- src/include/devfont.h | 68 +-- src/include/glyph.h | 1 + src/newgdi/bidi.c | 138 +++---- src/newgdi/drawtext.c | 4 +- src/newgdi/drawtext.h | 2 +- src/newgdi/glyph-old.c | 2 +- src/newgdi/glyph-unicode.c | 19 +- src/newgdi/glyph.c | 72 +++- src/newgdi/tabbedtextout.c | 18 +- src/newgdi/textout.c | 24 +- 24 files changed, 630 insertions(+), 616 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7cca661..63ae7016 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3216,7 +3216,7 @@ alExtra.(xwyan) * src/gui/lf_flat.c * src/gui/lf_skin.c -08/24: ENHANCEMENT #1: Add a new method for FONTOPS: get_glyph_type to return +08/24: ENHANCEMENT #1: Add a new method for FONTOPS: get_char_type to return the glyph type the devfont can give us. * src/include/devfont.h * src/font/*.c diff --git a/include/gdi.h b/include/gdi.h index eb47169d..6708e410 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -9709,18 +9709,18 @@ typedef enum { } GLYPHSHAPETYPE; /** - * \fn Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar, \ + * \fn Glyph32 GUIAPI GetShapedGlyph (LOGFONT* logfont, const char* mchar, \ * int mchar_len, GLYPHSHAPETYPE shape_type) * \brief Get the glyph shape of a character. * * \param logfont The logical font. * \param mchar The pointer to the multi-byte character. * \param mchar_len The length of \a mchar in bytes. - * \param shape_type The shape type of \a mchar. + * \param shape_type The requested shape type. * * \return The multi-byte character's glyph shape value. */ -MG_EXPORT Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar, +MG_EXPORT Glyph32 GUIAPI GetShapedGlyph (LOGFONT* logfont, const char* mchar, int mchar_len, GLYPHSHAPETYPE shape_type); /** @@ -9829,10 +9829,10 @@ typedef struct _GLYPHINFO { Uint32 mask; /** The glyph type */ - Uint32 glyph_type; + Uint32 char_type; /** The BIDI glyph type */ - Uint32 bidi_glyph_type; + Uint32 bidi_char_type; #if 0 // VincentWei: removed since 3.4.0 /** The height of the glyph */ diff --git a/src/control/bidiedit.c b/src/control/bidiedit.c index 2e331d62..ce7209f3 100644 --- a/src/control/bidiedit.c +++ b/src/control/bidiedit.c @@ -174,19 +174,19 @@ static void update_glyph_info (HWND hWnd, PBIDISLEDITDATA sled) return; } -#define GLYPH_TYPE_RTL 1 -#define GLYPH_TYPE_LTR 0 -#define GLYPH_TYPE_UNKKOWN -1 +#define CHAR_TYPE_RTL 1 +#define CHAR_TYPE_LTR 0 +#define CHAR_TYPE_UNKKOWN -1 -static int get_glyph_type (PBIDISLEDITDATA sled, int glyph_index) +static int get_char_type (PBIDISLEDITDATA sled, int glyph_index) { if (glyph_index < 0 || glyph_index >= GLYPHSLEN) - return GLYPH_TYPE_UNKKOWN; + return CHAR_TYPE_UNKKOWN; if (GLYPHSMAP[glyph_index].is_rtol) - return GLYPH_TYPE_RTL; + return CHAR_TYPE_RTL; else - return GLYPH_TYPE_LTR; + return CHAR_TYPE_LTR; } @@ -1073,8 +1073,8 @@ static int inline get_glyph_bidi_type (LOGFONT* logfont, Glyph32 glyph) if (IS_MBC_GLYPH(glyph)) { devfont = logfont->devfonts[1]; - if (devfont->charset_ops->bidi_glyph_type) { - return devfont->charset_ops->bidi_glyph_type (glyph); + if (devfont->charset_ops->bidi_char_type) { + return devfont->charset_ops->bidi_char_type (glyph); } else { return BIDI_TYPE_LTR; @@ -1085,8 +1085,8 @@ static int inline get_glyph_bidi_type (LOGFONT* logfont, Glyph32 glyph) } } -static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_glyph_type, - int r_glyph_type, int line_type) +static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_char_type, + int r_char_type, int line_type) { int bidi_type; Glyph32 glyph; @@ -1101,36 +1101,36 @@ static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_glyph_type, { if (BIDI_IS_RTL(bidi_type)) { - return GLYPH_TYPE_RTL; + return CHAR_TYPE_RTL; } else { - return GLYPH_TYPE_LTR; + return CHAR_TYPE_LTR; } } if (BIDI_IS_NUMBER(bidi_type)) { - return GLYPH_TYPE_LTR; + return CHAR_TYPE_LTR; } - if (l_glyph_type == r_glyph_type) + if (l_char_type == r_char_type) { - return l_glyph_type; + return l_char_type; } /*no left glyph*/ - else if (l_glyph_type == -1) + else if (l_char_type == -1) { if (BIDI_IS_WEAK (bidi_type)) - return r_glyph_type; + return r_char_type; else return line_type; } /*no right glyph*/ - else if (r_glyph_type == -1) + else if (r_char_type == -1) { if (BIDI_IS_WEAK (bidi_type)) - return l_glyph_type; + return l_char_type; else return line_type; } @@ -1150,7 +1150,7 @@ static int get_line_rl_type (GLYPHMAPINFO* map, int len) return map->is_rtol; map++; } - return GLYPH_TYPE_UNKKOWN; + return CHAR_TYPE_UNKKOWN; } #define INSERTPOS_BEFORE(sled, cur_glyph_index) \ @@ -1171,30 +1171,30 @@ get_insert_pos (PLOGFONT logfont, PBIDISLEDITDATA sled, char *newtext, int l_glyph_index = sled->editPos - 1; int r_glyph_index = sled->editPos; - int l_glyph_type = get_glyph_type (sled, l_glyph_index); - int r_glyph_type = get_glyph_type (sled, r_glyph_index); + int l_char_type = get_char_type (sled, l_glyph_index); + int r_char_type = get_char_type (sled, r_glyph_index); int line_type = get_line_rl_type (GLYPHSMAP, GLYPHSLEN); - *cur_type = get_text_rl_type (logfont, newtext, l_glyph_type, - r_glyph_type, line_type); + *cur_type = get_text_rl_type (logfont, newtext, l_char_type, + r_char_type, line_type); - if (*cur_type == GLYPH_TYPE_RTL) { - if (l_glyph_type == GLYPH_TYPE_RTL) { + if (*cur_type == CHAR_TYPE_RTL) { + if (l_char_type == CHAR_TYPE_RTL) { return INSERTPOS_BEFORE (sled, l_glyph_index); } - else if (r_glyph_type == GLYPH_TYPE_RTL) { + else if (r_char_type == CHAR_TYPE_RTL) { return INSERTPOS_AFTER (sled, r_glyph_index); } else { /*L|L, or L|0(must in a L line)*/ - if (l_glyph_type == GLYPH_TYPE_LTR) { + if (l_char_type == CHAR_TYPE_LTR) { return INSERTPOS_AFTER (sled, l_glyph_index); } /*0|L*/ - else if (r_glyph_type == GLYPH_TYPE_LTR) { + else if (r_char_type == CHAR_TYPE_LTR) { /*logical head in L line*/ - if (line_type == GLYPH_TYPE_LTR) + if (line_type == CHAR_TYPE_LTR) { return 0; } @@ -1210,21 +1210,21 @@ get_insert_pos (PLOGFONT logfont, PBIDISLEDITDATA sled, char *newtext, } } else { - if (l_glyph_type == GLYPH_TYPE_LTR) { + if (l_char_type == CHAR_TYPE_LTR) { return INSERTPOS_AFTER (sled, l_glyph_index); } - else if (r_glyph_type == GLYPH_TYPE_LTR) { + else if (r_char_type == CHAR_TYPE_LTR) { return INSERTPOS_BEFORE (sled, r_glyph_index); } else { /*R|R or 0|R(must in R line)*/ - if (r_glyph_type == GLYPH_TYPE_RTL) { + if (r_char_type == CHAR_TYPE_RTL) { return INSERTPOS_AFTER (sled, r_glyph_index); } /*R|0*/ - else if (l_glyph_type == GLYPH_TYPE_RTL) { + else if (l_char_type == CHAR_TYPE_RTL) { /*logical head in R line*/ - if (line_type == GLYPH_TYPE_RTL) { + if (line_type == CHAR_TYPE_RTL) { return 0; } /*logical tail in L line*/ @@ -1324,7 +1324,7 @@ sleInsertText (HWND hWnd, PBIDISLEDITDATA sled, char *newtext, edtChangeCont (hWnd, sled); /* RTL */ - if (cur_type == GLYPH_TYPE_RTL) { + if (cur_type == CHAR_TYPE_RTL) { sled->editPos = get_text_glyph_index (sled, insert_pos); } else { /*LTR*/ diff --git a/src/control/test/bidiedit_arabic.c b/src/control/test/bidiedit_arabic.c index a715ca46..ce00653c 100644 --- a/src/control/test/bidiedit_arabic.c +++ b/src/control/test/bidiedit_arabic.c @@ -271,30 +271,30 @@ static void set_keyboard_layout(HWND hDlg) } #if 0 - if (cur_type == GLYPH_TYPE_RTL) { - if (l_glyph_type == GLYPH_TYPE_RTL) + if (cur_type == CHAR_TYPE_RTL) { + if (l_char_type == CHAR_TYPE_RTL) return INSERTPOS_BEFORE (sled, l_glyph_index); - else if (r_glyph_type == GLYPH_TYPE_RTL) + else if (r_char_type == CHAR_TYPE_RTL) return INSERTPOS_AFTER (sled, r_glyph_index); else { - if (l_glyph_type == GLYPH_TYPE_LTR) + if (l_char_type == CHAR_TYPE_LTR) return INSERTPOS_AFTER (sled, l_glyph_index); - else if (l_glyph_type == GLYPH_TYPE_LTR) + else if (l_char_type == CHAR_TYPE_LTR) return INSERTPOS_BEFORE (sled, r_glyph_index); else return 0; } } else { - if (l_glyph_type == GLYPH_TYPE_LTR) + if (l_char_type == CHAR_TYPE_LTR) return INSERTPOS_AFTER (sled, l_glyph_index); - else if (r_glyph_type == GLYPH_TYPE_LTR) + else if (r_char_type == CHAR_TYPE_LTR) return INSERTPOS_BEFORE (sled, r_glyph_index); else { - if (l_glyph_type == GLYPH_TYPE_RTL) + if (l_char_type == CHAR_TYPE_RTL) return INSERTPOS_BEFORE (sled, l_glyph_index); - else if (l_glyph_type == GLYPH_TYPE_RTL) + else if (l_char_type == CHAR_TYPE_RTL) return INSERTPOS_AFTER (sled, r_glyph_index); else return 0; diff --git a/src/font/bitmapfont.c b/src/font/bitmapfont.c index a7b40168..f4f0457e 100644 --- a/src/font/bitmapfont.c +++ b/src/font/bitmapfont.c @@ -487,7 +487,7 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp, goto error_create; } - offset = (charset_ops->char_glyph_value) (NULL, 0, + offset = (charset_ops->get_char_value) (NULL, 0, (const unsigned char*) start_mchar, 0); bmpfont_info = build_bmpfont_info (bmpfont_name, glyph_bmp, @@ -550,7 +550,7 @@ BOOL AddGlyphsToBMPFont (DEVFONT* dev_font, BITMAP* glyph_bmp, return FALSE; /* Insert a node in the avl tree */ - offset = (*dev_font->charset_ops->char_glyph_value) (NULL, 0, + offset = (*dev_font->charset_ops->get_char_value) (NULL, 0, (const unsigned char*)start_mchar, 0); if (look_up (root, offset) == NULL) { @@ -644,7 +644,7 @@ static int avl_look_up (DEVFONT *dev_font, char *start_mchar, int n) GLYPHTREENODE *p; int offset; - offset = (*dev_font->charset_ops->char_glyph_value) (NULL, 0, + offset = (*dev_font->charset_ops->get_char_value) (NULL, 0, (const unsigned char*)start_mchar, n); offset += n; diff --git a/src/font/charset-arabic.c b/src/font/charset-arabic.c index 68b2d8c2..9074e3f4 100644 --- a/src/font/charset-arabic.c +++ b/src/font/charset-arabic.c @@ -174,12 +174,12 @@ static unsigned short iso8859_68x_unicode_map [] = 0xFEF7, 0xFEF8, 0xFEF9, 0xFEFA, /*0x130~0x133*/ }; -static Uchar32 iso8859_6_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_6_conv_to_uc32 (Mchar32 chv) { - if (glyph_value < 0x81) - return (Glyph32) (glyph_value); - else if (glyph_value <= MAX_GLYPH_VALUE ) - return (Glyph32) iso8859_68x_unicode_map[glyph_value - 0x81]; + if (chv < 0x81) + return (Mchar32) (chv); + else if (chv <= MAX_GLYPH_VALUE ) + return (Mchar32) iso8859_68x_unicode_map[chv - 0x81]; else return 0xFFFF; } @@ -212,8 +212,8 @@ static int iso8859_6_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) } #endif -/* must attetion the para s is arabic glyph value.*/ -static int is_arabic_glyph_vowel(Uint8 c) +/* must attetion the para s is arabic chv value.*/ +static int is_arabic_char_vowel(Uint8 c) { if ((c >= 0x81) && (c <= 0x86)) return 1; @@ -256,7 +256,7 @@ static int is_arabic_glyph_vowel(Uint8 c) /* this define is relative with fontset 0xa1~0xa7. * it it used for ligature such as LAM+ALEF, one ligature - * have two fontset glyphs.*/ + * have two fontset chvs.*/ #define LAM_ALIF 0x12C //0xA1A5 #define LAM_ALIF_F 0x12D //0xA1A6 @@ -272,15 +272,15 @@ static int is_arabic_glyph_vowel(Uint8 c) /* Because the get_ligature is close relative with fontset 6.8x, so * do it in the follow five functions, if the fontset is change, you only * need to implement follow five interface. - * 1. get_vowel_glyph(). - * 2. get_twovowel_glyph(). - * 3. get_tadweel_glyph(). - * 4. get_ligature_glyph(). - * 5. get_punpoint_glyph(). + * 1. get_vowel_char(). + * 2. get_twovowel_char(). + * 3. get_tadweel_char(). + * 4. get_ligature_char(). + * 5. get_punpoint_char(). * houhh 20080128. * */ -static int fontset_68x_get_punpoint_glyph(Uint8 c) +static int fontset_68x_get_punpoint_char(Uint8 c) { int ligature = -1; switch(c){ @@ -293,7 +293,7 @@ static int fontset_68x_get_punpoint_glyph(Uint8 c) return ligature; } -static int fontset_68x_get_vowel_glyph(Uint8 c) +static int fontset_68x_get_vowel_char(Uint8 c) { int ligature = -1; switch(c){ @@ -310,7 +310,7 @@ static int fontset_68x_get_vowel_glyph(Uint8 c) return ligature; } -static int fontset_68x_get_twovowel_glyph(unsigned char c, unsigned char next, int* ignore) +static int fontset_68x_get_twovowel_char(unsigned char c, unsigned char next, int* ignore) { int ligature = -1; if(c == SHADDA){ @@ -326,12 +326,12 @@ static int fontset_68x_get_twovowel_glyph(unsigned char c, unsigned char next, i } else { *ignore = 0; - ligature = fontset_68x_get_vowel_glyph(c); + ligature = fontset_68x_get_vowel_char(c); } return ligature; } -static int fontset_68x_get_ligature_glyph(unsigned char c, BOOL prev_affects_joining, int* ignore) +static int fontset_68x_get_ligature_char(unsigned char c, BOOL prev_affects_joining, int* ignore) { int ligature = -1; if(prev_affects_joining){ @@ -355,7 +355,7 @@ static int fontset_68x_get_ligature_glyph(unsigned char c, BOOL prev_affects_joi return ligature; } -static int fontset_68x_get_tadweel_glyph(unsigned char c, unsigned char next, int* ignore) +static int fontset_68x_get_tadweel_char(unsigned char c, unsigned char next, int* ignore) { int ligature = -1; if(c == SHADDA){ @@ -400,12 +400,12 @@ int get_ligature(const unsigned char* mchar, int len, BOOL prev_affects_joining, cur_char = *mchar; - ligature = fontset_68x_get_punpoint_glyph(cur_char); + ligature = fontset_68x_get_punpoint_char(cur_char); if(ligature > 0) return ligature; if(len == 1){ if (ISARABIC_VOWEL(cur_char)){ - ligature = fontset_68x_get_vowel_glyph(cur_char); + ligature = fontset_68x_get_vowel_char(cur_char); } else if(cur_char == TADWEEL){ ligature = TADWEEL; @@ -414,16 +414,16 @@ int get_ligature(const unsigned char* mchar, int len, BOOL prev_affects_joining, else if(len > 1){ next = *(mchar+1); if (ISARABIC_VOWEL(cur_char)){ /* two VOWEL, one must be SHADDA first. */ - ligature = fontset_68x_get_twovowel_glyph(cur_char, next, ignore); + ligature = fontset_68x_get_twovowel_char(cur_char, next, ignore); } else if (cur_char == LAM) { /* LAM+ALEF+HAMAZ+MADDA ligature. */ - ligature = fontset_68x_get_ligature_glyph(next, prev_affects_joining, ignore); + ligature = fontset_68x_get_ligature_char(next, prev_affects_joining, ignore); } else if(cur_char == TADWEEL){ /* TADWEEL combine with VOWEL*/ if(len > 2) next_next = *(mchar+2); else next_next = 0; - ligature = fontset_68x_get_tadweel_glyph(next, next_next, ignore); + ligature = fontset_68x_get_tadweel_char(next, next_next, ignore); if(ligature == -1 && cur_char == TADWEEL){ ligature = TADWEEL; } @@ -454,15 +454,15 @@ static int iso8859_6_len_first_char (const unsigned char* mstr, int len) #define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6)) -static unsigned int iso8859_6_glyph_type (Glyph32 glyph_value) +static unsigned int iso8859_6_char_type (Mchar32 chv) { unsigned int ch_type = MCHAR_TYPE_UNKNOWN; - if (is_arabic_glyph_vowel (glyph_value)) { /* is vowel */ + if (is_arabic_char_vowel (chv)) { /* is vowel */ ch_type = MCHAR_TYPE_VOWEL; } else{ - ch_type = sb_glyph_type (glyph_value); + ch_type = sb_char_type (chv); } return ch_type; @@ -586,9 +586,9 @@ static Uint32 __mg_iso8859_68x_type[] = { BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, }; -static unsigned int iso8859_6_bidi_glyph_type (Glyph32 glyph_value) +static unsigned int iso8859_6_bidi_char_type (Mchar32 chv) { - return __mg_iso8859_68x_type [REAL_GLYPH(glyph_value)]; + return __mg_iso8859_68x_type [chv]; } static int get_table_index(Uint8 c) @@ -655,7 +655,7 @@ static int get_next_char(const unsigned char* mchar, int len) #ifndef _DEBUG static #endif -Glyph32 iso8859_6_char_glyph_value (const unsigned char* prev_mchar, +Mchar32 iso8859_6_get_char_value (const unsigned char* prev_mchar, int prev_len, const unsigned char* mchar, int len) { BOOL next_affects_joining = FALSE, prev_affects_joining = FALSE; @@ -669,7 +669,7 @@ Glyph32 iso8859_6_char_glyph_value (const unsigned char* prev_mchar, char_index = get_table_index(*mchar); - /*current glyph has no transfiguration and has no ligature*/ + /*current chv has no transfiguration and has no ligature*/ if (char_index < 0 && !ISARABIC_PUNC(*mchar) && !ISARABIC_VOWEL(*mchar) && !(*mchar == TADWEEL)) { return *mchar; @@ -772,57 +772,57 @@ static const unsigned char* iso8859_6_get_next_word (const unsigned char* mstr, /*if cur_len>1, search ligature shape, * else search letter or phonetic symbol shape*/ -static Glyph32 iso8859_6_glyph_shape (const unsigned char* cur_mchar, +static Mchar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar, int cur_len, int shape_type) { - Glyph32 glyph_value = -1; + Mchar32 chv = -1; int ignore; int index; if (cur_len > 1) { if (shape_type == GLYPH_ISOLATED) - glyph_value = get_ligature (cur_mchar, cur_len, FALSE, &ignore); + chv = get_ligature (cur_mchar, cur_len, FALSE, &ignore); else if (shape_type != GLYPH_INITIAL) { /* LAM+ALEF+HAMAZ+MADDA ligature. */ if (*cur_mchar == LAM) - glyph_value = fontset_68x_get_ligature_glyph(*(cur_mchar+1), TRUE, &ignore); + chv = fontset_68x_get_ligature_char(*(cur_mchar+1), TRUE, &ignore); } } - if (glyph_value == -1 || glyph_value == 0) { + if (chv == -1 || chv == 0) { if (ISARABIC_VOWEL(*cur_mchar)){ - glyph_value = fontset_68x_get_vowel_glyph(*cur_mchar); + chv = fontset_68x_get_vowel_char(*cur_mchar); } - if (glyph_value == 0 || glyph_value == -1) { + if (chv == 0 || chv == -1) { index = get_table_index(*cur_mchar); if (index >=0) { switch (shape_type) { case GLYPH_ISOLATED: - glyph_value = shape_info[index].isolated; + chv = shape_info[index].isolated; break; case GLYPH_FINAL: - glyph_value = shape_info[index].final; + chv = shape_info[index].final; break; case GLYPH_INITIAL: - glyph_value = shape_info[index].initial; + chv = shape_info[index].initial; break; case GLYPH_MEDIAL: - glyph_value = shape_info[index].medial; + chv = shape_info[index].medial; break; } } else - glyph_value = *cur_mchar; + chv = *cur_mchar; } } - if (glyph_value == 0) - glyph_value =-1; + if (chv == 0) + chv =-1; - return glyph_value; + return chv; } static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] = @@ -839,10 +839,10 @@ static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] = // {0x00BB, 0x00AB} }; -static BOOL iso8859_6_bidi_mirror_glyph (Glyph32 glyph, Glyph32* mirrored) +static BOOL iso8859_6_bidi_mirror_char (Mchar32 chv, Mchar32* mirrored) { - return get_mirror_glyph (__mg_iso8859_68x_mirror_table, - TABLESIZE (__mg_iso8859_68x_mirror_table), glyph, mirrored); + return get_mirror_char (__mg_iso8859_68x_mirror_table, + TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored); } static CHARSETOPS CharsetOps_iso8859_6 = { @@ -851,16 +851,16 @@ static CHARSETOPS CharsetOps_iso8859_6 = { FONT_CHARSET_ISO8859_6, 0, iso8859_6_len_first_char, - iso8859_6_char_glyph_value, - iso8859_6_glyph_shape, - iso8859_6_glyph_type, + iso8859_6_get_char_value, + iso8859_6_get_shaped_char_value, + iso8859_6_char_type, sb_nr_chars_in_str, iso8859_6_is_this_charset, sb_len_first_substr, iso8859_6_get_next_word, sb_pos_first_char, - iso8859_6_bidi_glyph_type, - iso8859_6_bidi_mirror_glyph, + iso8859_6_bidi_char_type, + iso8859_6_bidi_mirror_char, #ifdef _MGCHARSET_UNICODE iso8859_6_conv_to_uc32, iso8859_6_conv_from_uc32 @@ -868,14 +868,14 @@ static CHARSETOPS CharsetOps_iso8859_6 = { }; #ifdef _DEBUG -int iso8859_6_test_glyph_value (int char_index, Glyph32 glyph_value) +int iso8859_6_test_chv (int char_index, Mchar32 chv) { int i = 0; for (i = 0; ibidi_glyph_type (glyphs[i])) != last->type){ + if ((type = charset_ops->bidi_char_type (glyphs[i])) != last->type){ link = calloc(1, sizeof(TYPERUN)); link->type = type; link->pos = i; @@ -487,7 +487,7 @@ bidi_resolveMirrorChar (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len, for (i = POS (pp); i < POS (pp) + LEN (pp); i++) { Glyph32 mirrored_ch; - if (charset_ops->bidi_mirror_glyph && charset_ops->bidi_mirror_glyph (glyphs[i], &mirrored_ch)) + if (charset_ops->bidi_mirror_char && charset_ops->bidi_mirror_char (glyphs[i], &mirrored_ch)) glyphs[i] = mirrored_ch; } } @@ -757,10 +757,10 @@ BOOL GetGlyphBIDIType (LOGFONT* log_font, Glyph32 glyph_value, DEVFONT* devfont = SELECT_DEVFONT(log_font, glyph_value); if (devfont == NULL || - devfont->charset_ops->bidi_glyph_type == NULL) + devfont->charset_ops->bidi_char_type == NULL) return FALSE; - *bidi_type = devfont->charset_ops->bidi_glyph_type (glyph_value); + *bidi_type = devfont->charset_ops->bidi_char_type (glyph_value); return TRUE; } diff --git a/src/font/charset.c b/src/font/charset.c index cb5d0dbb..0d213471 100644 --- a/src/font/charset.c +++ b/src/font/charset.c @@ -1,39 +1,39 @@ /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** charset.c: The charset operation set. -** +** ** Create date: 2000/06/13 */ @@ -57,18 +57,17 @@ static int sb_len_first_char (const unsigned char* mstr, int len) return 0; } -static Glyph32 sb_char_glyph_value (const unsigned char* pre_mchar, int pre_len, +static Mchar32 sb_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { - return (Glyph32)(*cur_mchar); + return (Mchar32)(*cur_mchar); } -static unsigned int sb_glyph_type (Glyph32 glyph_value) +static unsigned int sb_char_type (Mchar32 chv) { unsigned int ch_type = MCHAR_TYPE_UNKNOWN; - glyph_value = REAL_GLYPH(glyph_value); - switch (glyph_value) { + switch (chv) { case '\0': ch_type = MCHAR_TYPE_NUL; break; @@ -99,9 +98,9 @@ static unsigned int sb_glyph_type (Glyph32 glyph_value) } if (ch_type == MCHAR_TYPE_UNKNOWN) { - if (glyph_value < '\a') + if (chv < '\a') ch_type = MCHAR_TYPE_CTRL1; - else if (glyph_value < ' ') + else if (chv < ' ') ch_type = MCHAR_TYPE_CTRL2; else ch_type = MCHAR_TYPE_GENERIC; @@ -172,7 +171,7 @@ static const unsigned char* sb_get_next_word (const unsigned char* mstr, word_info->len ++; } } - + return mstr + word_info->len + word_info->nr_delimiters; } @@ -196,11 +195,10 @@ static int ascii_is_this_charset (const unsigned char* charset) } #ifdef _MGCHARSET_UNICODE -static Uchar32 ascii_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 ascii_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value < 128) - return glyph_value; + if (chv < 128) + return chv; else return '?'; } @@ -222,9 +220,9 @@ static CHARSETOPS CharsetOps_ascii = { FONT_CHARSET_US_ASCII, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, ascii_is_this_charset, sb_len_first_substr, @@ -263,10 +261,9 @@ static int iso8859_1_is_this_charset (const unsigned char* charset) } #ifdef _MGCHARSET_UNICODE -static Uchar32 iso8859_1_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_1_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - return glyph_value; + return chv; } static int iso8859_1_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -286,9 +283,9 @@ static CHARSETOPS CharsetOps_iso8859_1 = { FONT_CHARSET_ISO8859_1, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_1_is_this_charset, sb_len_first_substr, @@ -363,13 +360,12 @@ static unsigned short iso8859_2_unicode_map [] = 0x00FD, 0x0163, 0x02D9 }; -static Uchar32 iso8859_2_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_2_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value < 0xA1) - return glyph_value; + if (chv < 0xA1) + return chv; else - return (Uchar32) iso8859_2_unicode_map [glyph_value - 0xA1]; + return (Uchar32) iso8859_2_unicode_map [chv - 0xA1]; } static int iso8859_2_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -398,9 +394,9 @@ static CHARSETOPS CharsetOps_iso8859_2 = { FONT_CHARSET_ISO8859_2, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_2_is_this_charset, sb_len_first_substr, @@ -477,13 +473,12 @@ static unsigned short iso8859_3_unicode_map [] = 0x015D, 0x02D9 }; -static Uchar32 iso8859_3_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_3_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value < 0xA1) - return glyph_value; + if (chv < 0xA1) + return chv; else - return (Uchar32) iso8859_3_unicode_map [glyph_value - 0xA1]; + return (Uchar32) iso8859_3_unicode_map [chv - 0xA1]; } static int iso8859_3_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -511,9 +506,9 @@ static CHARSETOPS CharsetOps_iso8859_3 = { FONT_CHARSET_ISO8859_3, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_3_is_this_charset, sb_len_first_substr, @@ -590,13 +585,12 @@ static unsigned short iso8859_4_unicode_map [] = 0x016B, 0x02D9 }; -static Uchar32 iso8859_4_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_4_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value < 0xA1) - return glyph_value; + if (chv < 0xA1) + return chv; else - return (Uchar32) iso8859_4_unicode_map [glyph_value - 0xA1]; + return (Uchar32) iso8859_4_unicode_map [chv - 0xA1]; } static int iso8859_4_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -625,9 +619,9 @@ static CHARSETOPS CharsetOps_iso8859_4 = { FONT_CHARSET_ISO8859_4, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_4_is_this_charset, sb_len_first_substr, @@ -668,23 +662,21 @@ static int iso8859_5_is_this_charset (const unsigned char* charset) } #ifdef _MGCHARSET_UNICODE -static Uchar32 iso8859_5_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_5_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); + if (chv < 0xA1) + return chv; - if (glyph_value < 0xA1) - return glyph_value; - - if (glyph_value == 0xAD) + if (chv == 0xAD) return 0x00AD; /* SOFT HYPHEN */ - if (glyph_value == 0xF0) + if (chv == 0xF0) return 0x2116; /* NUMERO SIGN */ - if (glyph_value == 0xFD) + if (chv == 0xFD) return 0x00A7; /* SECTION SIGN */ - return glyph_value + (0x0401 - 0xA1); + return chv + (0x0401 - 0xA1); } static int iso8859_5_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -721,9 +713,9 @@ static CHARSETOPS CharsetOps_iso8859_5 = { FONT_CHARSET_ISO8859_5, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_5_is_this_charset, sb_len_first_substr, @@ -743,27 +735,23 @@ static CHARSETOPS CharsetOps_iso8859_5 = { #include "bidi.h" -static BOOL get_mirror_glyph (const BIDICHAR_MIRROR_MAP* map, int n, Glyph32 glyph, Glyph32* mirrored) +static BOOL get_mirror_char (const BIDICHAR_MIRROR_MAP* map, int n, Mchar32 chv, Mchar32* mirrored) { int pos, step; BOOL found = FALSE; pos = step = (n / 2) + 1; - int dfi; - dfi = DFI_IN_GLYPH(glyph); - glyph = REAL_GLYPH(glyph); - while (step > 1) { - Glyph32 cmp_glyph = map[pos].glyph; + Mchar32 cmp_char = map[pos].chv; step = (step + 1) / 2; - if (cmp_glyph < glyph) { + if (cmp_char < chv) { pos += step; if (pos > n - 1) pos = n - 1; } - else if (cmp_glyph > glyph) { + else if (cmp_char > chv) { pos -= step; if (pos < 0) pos = 0; @@ -772,14 +760,10 @@ static BOOL get_mirror_glyph (const BIDICHAR_MIRROR_MAP* map, int n, Glyph32 gly break; } - found = map[pos].glyph == glyph; + found = map[pos].chv == chv; if (mirrored){ - *mirrored = found ? map[pos].mirrored : glyph; - - /* use the same devfont index for mirror char. */ - if (dfi) - *mirrored = SET_GLYPH_DFI(*mirrored, dfi); + *mirrored = found ? map[pos].mirrored : chv; } return found; @@ -831,17 +815,16 @@ static unsigned short iso8859_7_unicode_map [] = 0x038C, 0x00BD }; -static Uchar32 iso8859_7_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_7_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value >= 0xBE && glyph_value <= 0xFE) { - return glyph_value - 0xBE + 0x038E; + if (chv >= 0xBE && chv <= 0xFE) { + return chv - 0xBE + 0x038E; } - else if (glyph_value >= 0xA1 && glyph_value <= 0xBD) { - return (Uchar32)iso8859_7_unicode_map [glyph_value - 0xA1]; + else if (chv >= 0xA1 && chv <= 0xBD) { + return (Uchar32)iso8859_7_unicode_map [chv - 0xA1]; } else { - return glyph_value; + return chv; } } @@ -876,9 +859,9 @@ static CHARSETOPS CharsetOps_iso8859_7 = { FONT_CHARSET_ISO8859_7, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_7_is_this_charset, sb_len_first_substr, @@ -953,114 +936,113 @@ static const unsigned char* iso8859_8_get_next_word (const unsigned char* mstr, word_info->len++; } } - + return mstr + word_info->len + word_info->nr_delimiters; //return sb_get_next_word(mstr, mstrlen, word_info); } static Uint32 __mg_iso8859_8_type[] = { - /*0x00~0x0f*/ - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_SS, BIDI_TYPE_BS, BIDI_TYPE_SS, + /*0x00~0x0f*/ + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_SS, BIDI_TYPE_BS, BIDI_TYPE_SS, BIDI_TYPE_WS, BIDI_TYPE_BS, BIDI_TYPE_BN, BIDI_TYPE_BN, - /*0x10~0x1f*/ - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + /*0x10~0x1f*/ + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BS, BIDI_TYPE_BS, BIDI_TYPE_BS, BIDI_TYPE_SS, - /*0x20~0x2f*/ - BIDI_TYPE_WS, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ET, - BIDI_TYPE_ET, BIDI_TYPE_ET, BIDI_TYPE_ON, BIDI_TYPE_ON, - BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ES, + /*0x20~0x2f*/ + BIDI_TYPE_WS, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ET, + BIDI_TYPE_ET, BIDI_TYPE_ET, BIDI_TYPE_ON, BIDI_TYPE_ON, + BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ES, BIDI_TYPE_CS, BIDI_TYPE_ES, BIDI_TYPE_CS, BIDI_TYPE_CS, - /*0x30~0x3f*/ - BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, - BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, - BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_CS, BIDI_TYPE_ON, + /*0x30~0x3f*/ + BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, + BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, + BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_CS, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, - /*0x40~0x4f*/ + /*0x40~0x4f*/ BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, - /*0x50~0x6f*/ + /*0x50~0x6f*/ BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, - BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON, + BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, - /*0x60~0x6f*/ + /*0x60~0x6f*/ BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, - /*0x70~0x7f*/ + /*0x70~0x7f*/ BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, - BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON, + BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN, - /*0x80~0x8f*/ - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - - /*0x90~0x9f*/ - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + /*0x80~0x8f*/ + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - /*0xa0~0xaf*/ + /*0x90~0x9f*/ + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + + /*0xa0~0xaf*/ BIDI_TYPE_CS, BIDI_TYPE_BN, BIDI_TYPE_ET, BIDI_TYPE_ET, - BIDI_TYPE_ET, BIDI_TYPE_ET, BIDI_TYPE_ON, BIDI_TYPE_ON, + BIDI_TYPE_ET, BIDI_TYPE_ET, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_ON, - /*0xb0~0xbf*/ - BIDI_TYPE_ET, BIDI_TYPE_ET, BIDI_TYPE_EN, BIDI_TYPE_EN, - BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_ON, - BIDI_TYPE_ON, BIDI_TYPE_EN, BIDI_TYPE_ON, BIDI_TYPE_ON, + /*0xb0~0xbf*/ + BIDI_TYPE_ET, BIDI_TYPE_ET, BIDI_TYPE_EN, BIDI_TYPE_EN, + BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_ON, + BIDI_TYPE_ON, BIDI_TYPE_EN, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN, - /*0xc0~0xcf*/ - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + /*0xc0~0xcf*/ + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - /*0xd0~0xdf*/ - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_ON, + /*0xd0~0xdf*/ + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_ON, - /*0xe0~0xef*/ - BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, - BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, - BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, - BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_ON, + /*0xe0~0xef*/ + BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, + BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, + BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, + BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_ON, /*0xf0~0xff*/ - BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, - BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, - BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, - BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_BN, - BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, + BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, + BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, + BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, + BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_RTL, BIDI_TYPE_BN, + BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, }; -static unsigned int iso8859_8_bidi_glyph_type (Glyph32 glyph_value) +static unsigned int iso8859_8_bidi_char_type (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - return __mg_iso8859_8_type [glyph_value]; + return __mg_iso8859_8_type [chv]; } static const BIDICHAR_MIRROR_MAP __mg_iso8859_8_mirror_table [] = @@ -1077,21 +1059,20 @@ static const BIDICHAR_MIRROR_MAP __mg_iso8859_8_mirror_table [] = // {0x00BB, 0x00AB} }; -static BOOL iso8859_8_bidi_mirror_glyph (Glyph32 glyph, Glyph32* mirrored) +static BOOL iso8859_8_bidi_mirror_char (Mchar32 chv, Mchar32* mirrored) { - return get_mirror_glyph (__mg_iso8859_8_mirror_table, - TABLESIZE (__mg_iso8859_8_mirror_table), glyph, mirrored); + return get_mirror_char (__mg_iso8859_8_mirror_table, + TABLESIZE (__mg_iso8859_8_mirror_table), chv, mirrored); } #ifdef _MGCHARSET_UNICODE -static Uchar32 iso8859_8_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_8_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value >= 0xE0 && glyph_value <= 0xFA) { - return glyph_value - 0xE0 + 0x05D0; + if (chv >= 0xE0 && chv <= 0xFA) { + return chv - 0xE0 + 0x05D0; } else { - switch (glyph_value) { + switch (chv) { case 0xAA: return 0x00D7; case 0xBA: @@ -1103,7 +1084,7 @@ static Uchar32 iso8859_8_conv_to_uc32 (Glyph32 glyph_value) case 0xFE: return 0x200F; } - return glyph_value; + return chv; } } @@ -1145,16 +1126,16 @@ static CHARSETOPS CharsetOps_iso8859_8 = { FONT_CHARSET_ISO8859_8, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_8_is_this_charset, sb_len_first_substr, iso8859_8_get_next_word, sb_pos_first_char, - iso8859_8_bidi_glyph_type, - iso8859_8_bidi_mirror_glyph, + iso8859_8_bidi_char_type, + iso8859_8_bidi_mirror_char, #ifdef _MGCHARSET_UNICODE iso8859_8_conv_to_uc32, iso8859_8_conv_from_uc32 @@ -1188,10 +1169,9 @@ static int iso8859_9_is_this_charset (const unsigned char* charset) } #ifdef _MGCHARSET_UNICODE -static Uchar32 iso8859_9_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_9_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - switch (glyph_value) { + switch (chv) { case 0xD0: return 0x011E; case 0xDD: @@ -1206,7 +1186,7 @@ static Uchar32 iso8859_9_conv_to_uc32 (Glyph32 glyph_value) return 0x015F; } - return glyph_value; + return chv; } static int iso8859_9_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -1247,9 +1227,9 @@ static CHARSETOPS CharsetOps_iso8859_9 = { FONT_CHARSET_ISO8859_9, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_9_is_this_charset, sb_len_first_substr, @@ -1326,13 +1306,12 @@ static unsigned short iso8859_10_unicode_map [] = 0x00FE, 0x0138 }; -static Uchar32 iso8859_10_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_10_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value < 0xA1) - return glyph_value; + if (chv < 0xA1) + return chv; else - return (Uchar32)iso8859_10_unicode_map [glyph_value - 0xA1]; + return (Uchar32)iso8859_10_unicode_map [chv - 0xA1]; } static int iso8859_10_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -1361,9 +1340,9 @@ static CHARSETOPS CharsetOps_iso8859_10 = { FONT_CHARSET_ISO8859_10, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_10_is_this_charset, sb_len_first_substr, @@ -1440,13 +1419,12 @@ static unsigned short iso8859_11_unicode_map [] = 0x00FE, 0x00FF }; -static Uchar32 iso8859_11_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_11_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value < 0xA1) - return glyph_value; + if (chv < 0xA1) + return chv; else - return (Uchar32) iso8859_11_unicode_map [glyph_value - 0xA1]; + return (Uchar32) iso8859_11_unicode_map [chv - 0xA1]; } static int iso8859_11_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -1474,9 +1452,9 @@ static CHARSETOPS CharsetOps_iso8859_11 = { FONT_CHARSET_ISO8859_11, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_11_is_this_charset, sb_len_first_substr, @@ -1553,13 +1531,12 @@ static unsigned short iso8859_13_unicode_map [] = 0x017E, 0x2019 }; -static Uchar32 iso8859_13_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_13_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value < 0xA1) - return glyph_value; + if (chv < 0xA1) + return chv; else - return (Uchar32) iso8859_13_unicode_map [glyph_value - 0xA1]; + return (Uchar32) iso8859_13_unicode_map [chv - 0xA1]; } static int iso8859_13_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -1587,9 +1564,9 @@ static CHARSETOPS CharsetOps_iso8859_13 = { FONT_CHARSET_ISO8859_13, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_13_is_this_charset, sb_len_first_substr, @@ -1666,13 +1643,12 @@ static unsigned short iso8859_14_unicode_map [] = 0x0177, 0x00FF }; -static Uchar32 iso8859_14_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_14_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value < 0xA1) - return glyph_value; + if (chv < 0xA1) + return chv; else - return (Uchar32) iso8859_14_unicode_map [glyph_value - 0xA1]; + return (Uchar32) iso8859_14_unicode_map [chv - 0xA1]; } static int iso8859_14_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -1700,9 +1676,9 @@ static CHARSETOPS CharsetOps_iso8859_14 = { FONT_CHARSET_ISO8859_14, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_14_is_this_charset, sb_len_first_substr, @@ -1743,10 +1719,9 @@ static int iso8859_15_is_this_charset (const unsigned char* charset) } #ifdef _MGCHARSET_UNICODE -static Uchar32 iso8859_15_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_15_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - switch (glyph_value) { + switch (chv) { case 0xA4: return 0x20AC; /* EURO SIGN */ case 0xA6: @@ -1764,7 +1739,7 @@ static Uchar32 iso8859_15_conv_to_uc32 (Glyph32 glyph_value) case 0xBE: return 0x0178; /* LATIN CAPITAL LETTER Y WITH DIAERESIS */ default: - return glyph_value; + return chv; } } @@ -1812,9 +1787,9 @@ static CHARSETOPS CharsetOps_iso8859_15 = { FONT_CHARSET_ISO8859_15, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_15_is_this_charset, sb_len_first_substr, @@ -1854,10 +1829,9 @@ static int iso8859_16_is_this_charset (const unsigned char* charset) } #ifdef _MGCHARSET_UNICODE -static Uchar32 iso8859_16_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 iso8859_16_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - switch (glyph_value) { + switch (chv) { case 0xA1: return 0x0104; case 0xA2: return 0x0105; case 0xA3: return 0x0141; @@ -1900,7 +1874,7 @@ static Uchar32 iso8859_16_conv_to_uc32 (Glyph32 glyph_value) case 0xFE: return 0x021B; } - return glyph_value; + return chv; } static int iso8859_16_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -1963,9 +1937,9 @@ static CHARSETOPS CharsetOps_iso8859_16 = { FONT_CHARSET_ISO8859_16, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, iso8859_16_is_this_charset, sb_len_first_substr, @@ -1987,7 +1961,7 @@ static CHARSETOPS CharsetOps_iso8859_16 = { | defined(_MGCHARSET_SHIFTJIS) \ | defined(_MGCHARSET_UNICODE) -static unsigned int mb_glyph_type (Glyph32 glyph_value) +static unsigned int mb_char_type (Mchar32 chv) { /* TODO: get the subtype of the char */ return MCHAR_TYPE_GENERIC; @@ -2041,7 +2015,7 @@ static int gb2312_0_len_first_char (const unsigned char* mstr, int len) return 0; } -static Glyph32 gb2312_0_char_glyph_value (const unsigned char* pre_mchar, +static Mchar32 gb2312_0_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { int area = cur_mchar [0] - 0xA1; @@ -2128,9 +2102,9 @@ static int gb2312_0_pos_first_char (const unsigned char* mstr, int mstrlen) } #ifdef _MGCHARSET_UNICODE -static Uchar32 gb2312_0_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 gb2312_0_conv_to_uc32 (Mchar32 chv) { - return (Uchar32)__mg_gbunicode_map [REAL_GLYPH(glyph_value)]; + return (Uchar32)__mg_gbunicode_map [chv]; } const unsigned char* __mg_map_uc16_to_gb (unsigned short uc16); @@ -2160,9 +2134,9 @@ static CHARSETOPS CharsetOps_gb2312_0 = { FONT_CHARSET_GB2312_0, 0, gb2312_0_len_first_char, - gb2312_0_char_glyph_value, + gb2312_0_get_char_value, NULL, - mb_glyph_type, + mb_char_type, db_nr_chars_in_str, gb2312_0_is_this_charset, gb2312_0_len_first_substr, @@ -2201,7 +2175,7 @@ static int gbk_len_first_char (const unsigned char* mstr, int len) return 0; } -static Glyph32 gbk_char_glyph_value (const unsigned char* pre_mchar, int pre_len, +static Mchar32 gbk_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { if (cur_mchar [1] > 0x7F) @@ -2286,9 +2260,9 @@ static int gbk_pos_first_char (const unsigned char* mstr, int mstrlen) } #ifdef _MGCHARSET_UNICODE -static Uchar32 gbk_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 gbk_conv_to_uc32 (Mchar32 chv) { - return (Uchar32)__mg_gbkunicode_map[REAL_GLYPH(glyph_value)]; + return (Uchar32)__mg_gbkunicode_map[chv]; } const unsigned char* __mg_map_uc16_to_gbk (unsigned short uc16); @@ -2317,9 +2291,9 @@ static CHARSETOPS CharsetOps_gbk = { FONT_CHARSET_GBK, 0, gbk_len_first_char, - gbk_char_glyph_value, + gbk_get_char_value, NULL, - mb_glyph_type, + mb_char_type, db_nr_chars_in_str, gbk_is_this_charset, gbk_len_first_substr, @@ -2366,7 +2340,7 @@ static int gb18030_0_len_first_char (const unsigned char* mstr, int len) return 0; } -static Glyph32 gb18030_0_char_glyph_value (const unsigned char* pre_mchar, +static Mchar32 gb18030_0_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { unsigned char ch1; @@ -2381,8 +2355,8 @@ static Glyph32 gb18030_0_char_glyph_value (const unsigned char* pre_mchar, ch3 = cur_mchar [2]; ch4 = cur_mchar [3]; - return ((126 * 192) + - ((ch1 - 0x81) * 12600 + (ch2 - 0x30) * 1260 + + return ((126 * 192) + + ((ch1 - 0x81) * 12600 + (ch2 - 0x30) * 1260 + (ch3 - 0x81) * 10 + (ch4 - 0x30))); } @@ -2429,7 +2403,7 @@ static int gb18030_0_len_first_substr (const unsigned char* mstr, int mstrlen) left -= 2; } else if (left >= 4) { - + ch3 = mstr [i + 2]; ch4 = mstr [i + 3]; if (ch2 >= 0x30 && ch2 <= 0x39 && ch4 >= 0x30 && ch4 <= 0x39 @@ -2460,7 +2434,7 @@ static int gb18030_0_pos_first_char (const unsigned char* mstr, int mstrlen) if (ch1 == '\0') return -1; ch2 = mstr [i + 1]; - if (ch1 >= 0x81 && ch1 <= 0xFE + if (ch1 >= 0x81 && ch1 <= 0xFE && ch2 >= 0x40 && ch2 <= 0xFE && ch2 != 0x7F) return i; @@ -2530,26 +2504,24 @@ static const unsigned char* gb18030_0_get_next_word (const unsigned char* mstr, } #ifdef _MGCHARSET_UNICODE -static Uchar32 gb18030_0_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 gb18030_0_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - /* from 0x90308130 to 0xE3329A35 */ - if (glyph_value > 63611) { + if (chv > 63611) { int m1, n1, m2, n2, m3, n3; - m1 = (glyph_value - 24192) / 12600; - n1 = (glyph_value - 24192) % 12600; + m1 = (chv - 24192) / 12600; + n1 = (chv - 24192) % 12600; m2 = n1 / 1260; n2 = n1 % 1260; m3 = n2 / 10; n3 = n2 % 10; - return ((m1 + 129 - 144) * 12600) + + return ((m1 + 129 - 144) * 12600) + (m2 * 1260) + (m3 * 10) + n3 + 65536; } - return (Uchar32)__mg_gb18030_0_unicode_map [glyph_value]; + return (Uchar32)__mg_gb18030_0_unicode_map [chv]; } int __mg_map_ucs_to_gb18030 (int wc, unsigned char* mchar); @@ -2585,9 +2557,9 @@ static CHARSETOPS CharsetOps_gb18030_0 = { FONT_CHARSET_GB18030_0, 0, gb18030_0_len_first_char, - gb18030_0_char_glyph_value, + gb18030_0_get_char_value, NULL, - mb_glyph_type, + mb_char_type, gb18030_0_nr_chars_in_str, gb18030_0_is_this_charset, gb18030_0_len_first_substr, @@ -2618,14 +2590,14 @@ static int big5_len_first_char (const unsigned char* mstr, int len) return 0; ch2 = mstr [1]; - if (ch1 >= 0xA1 && ch1 <= 0xFE && + if (ch1 >= 0xA1 && ch1 <= 0xFE && ((ch2 >=0x40 && ch2 <= 0x7E) || (ch2 >= 0xA1 && ch2 <= 0xFE))) return 2; return 0; } -static Glyph32 big5_char_glyph_value (const unsigned char* pre_mchar, int pre_len, +static Mchar32 big5_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { if (cur_mchar [1] & 0x80) @@ -2667,7 +2639,7 @@ static int big5_len_first_substr (const unsigned char* mstr, int mstrlen) if (ch1 == '\0') return sub_len; ch2 = mstr [i + 1]; - if (ch1 >= 0xA1 && ch1 <= 0xFE && + if (ch1 >= 0xA1 && ch1 <= 0xFE && ((ch2 >=0x40 && ch2 <= 0x7E) || (ch2 >= 0xA1 && ch2 <= 0xFE))) sub_len += 2; else @@ -2694,7 +2666,7 @@ static int big5_pos_first_char (const unsigned char* mstr, int mstrlen) if (ch1 == '\0') return -1; ch2 = mstr [i + 1]; - if (ch1 >= 0xA1 && ch1 <= 0xFE && + if (ch1 >= 0xA1 && ch1 <= 0xFE && ((ch2 >=0x40 && ch2 <= 0x7E) || (ch2 >= 0xA1 && ch2 <= 0xFE))) return i; @@ -2706,9 +2678,9 @@ static int big5_pos_first_char (const unsigned char* mstr, int mstrlen) } #ifdef _MGCHARSET_UNICODE -static Uchar32 big5_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 big5_conv_to_uc32 (Mchar32 chv) { - unsigned short ucs_code = __mg_big5_unicode_map [REAL_GLYPH(glyph_value)]; + unsigned short ucs_code = __mg_big5_unicode_map [chv]; if (ucs_code == 0) return '?'; @@ -2742,9 +2714,9 @@ static CHARSETOPS CharsetOps_big5 = { FONT_CHARSET_BIG5, 0, big5_len_first_char, - big5_char_glyph_value, + big5_get_char_value, NULL, - mb_glyph_type, + mb_char_type, db_nr_chars_in_str, big5_is_this_charset, big5_len_first_substr, @@ -2781,7 +2753,7 @@ static int ksc5601_0_len_first_char (const unsigned char* mstr, int len) return 0; } -static Glyph32 ksc5601_0_char_glyph_value (const unsigned char* pre_mchar, +static Mchar32 ksc5601_0_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { #if 1 @@ -2806,7 +2778,7 @@ static int ksc5601_0_is_this_charset (const unsigned char* charset) } name [i] = '\0'; - if ((strstr (name, "KSC5601") && strstr (name, "-0")) || + if ((strstr (name, "KSC5601") && strstr (name, "-0")) || (strstr (name, "EUC") && strstr (name, "KR"))) return 0; @@ -2865,9 +2837,9 @@ static int ksc5601_0_pos_first_char (const unsigned char* mstr, int mstrlen) } #ifdef _MGCHARSET_UNICODE -static Uchar32 ksc5601_0_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 ksc5601_0_conv_to_uc32 (Mchar32 chv) { - unsigned short ucs_code = __mg_ksc5601_0_unicode_map [REAL_GLYPH(glyph_value)]; + unsigned short ucs_code = __mg_ksc5601_0_unicode_map [chv]; if (ucs_code == 0) return '?'; @@ -2888,9 +2860,9 @@ static CHARSETOPS CharsetOps_ksc5601_0 = { FONT_CHARSET_EUCKR, 0, ksc5601_0_len_first_char, - ksc5601_0_char_glyph_value, + ksc5601_0_get_char_value, NULL, - mb_glyph_type, + mb_char_type, db_nr_chars_in_str, ksc5601_0_is_this_charset, ksc5601_0_len_first_substr, @@ -2928,7 +2900,7 @@ static int jisx0201_0_len_first_char (const unsigned char* mstr, int len) return 0; } -static Glyph32 jisx0201_0_char_glyph_value (const unsigned char* pre_mchar, +static Mchar32 jisx0201_0_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { if (cur_mchar [0] == 0x8E) @@ -2986,18 +2958,16 @@ static int jisx0201_0_is_this_charset (const unsigned char* charset) #ifdef _MGCHARSET_UNICODE -static Uchar32 jisx0201_0_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 jisx0201_0_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - - if (glyph_value >= 0xA1 && glyph_value <= 0xDF) - return 0xFF61 + glyph_value - 0xA1; - else if (glyph_value == 0x5C) + if (chv >= 0xA1 && chv <= 0xDF) + return 0xFF61 + chv - 0xA1; + else if (chv == 0x5C) return 0x00A5; - else if (glyph_value == 0x80) + else if (chv == 0x80) return 0x005C; - return glyph_value; + return chv; } @@ -3014,9 +2984,9 @@ static CHARSETOPS CharsetOps_jisx0201_0 = { FONT_CHARSET_JISX0201_0, 0, jisx0201_0_len_first_char, - jisx0201_0_char_glyph_value, + jisx0201_0_get_char_value, NULL, - sb_glyph_type, + sb_char_type, jisx0201_0_nr_chars_in_str, jisx0201_0_is_this_charset, sb_len_first_substr, @@ -3048,7 +3018,7 @@ static int jisx0208_0_len_first_char (const unsigned char* mstr, int len) return 0; } -static Glyph32 jisx0208_0_char_glyph_value (const unsigned char* pre_mchar, +static Mchar32 jisx0208_0_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { #if 1 @@ -3132,11 +3102,11 @@ static int jisx0208_0_pos_first_char (const unsigned char* mstr, int mstrlen) } #ifdef _MGCHARSET_UNICODE -static Uchar32 jisx0208_0_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 jisx0208_0_conv_to_uc32 (Mchar32 chv) { unsigned short ucs_code; - ucs_code = __mg_jisx0208_0_unicode_map [REAL_GLYPH(glyph_value)]; + ucs_code = __mg_jisx0208_0_unicode_map [chv]; if (ucs_code == 0) return '?'; @@ -3157,9 +3127,9 @@ static CHARSETOPS CharsetOps_jisx0208_0 = { FONT_CHARSET_JISX0208_0, 0, jisx0208_0_len_first_char, - jisx0208_0_char_glyph_value, + jisx0208_0_get_char_value, NULL, - mb_glyph_type, + mb_char_type, db_nr_chars_in_str, jisx0208_0_is_this_charset, jisx0208_0_len_first_substr, @@ -3199,17 +3169,16 @@ static int jisx0201_1_is_this_charset (const unsigned char* charset) #ifdef _MGCHARSET_UNICODE -static Uchar32 jisx0201_1_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 jisx0201_1_conv_to_uc32 (Mchar32 chv) { - glyph_value = REAL_GLYPH(glyph_value); - if (glyph_value >= 0xA1 && glyph_value <= 0xDF) - return 0xFF61 + glyph_value - 0xA1; - else if (glyph_value == 0x5C) + if (chv >= 0xA1 && chv <= 0xDF) + return 0xFF61 + chv - 0xA1; + else if (chv == 0x5C) return 0x00A5; - else if (glyph_value == 0x80) + else if (chv == 0x80) return 0x005C; - return glyph_value; + return chv; } static int jisx0201_1_conv_from_uc32 (Uchar32 wc, unsigned char* mchar) @@ -3243,9 +3212,9 @@ static CHARSETOPS CharsetOps_jisx0201_1 = { FONT_CHARSET_JISX0201_1, 0, sb_len_first_char, - sb_char_glyph_value, + sb_get_char_value, NULL, - sb_glyph_type, + sb_char_type, sb_nr_chars_in_str, jisx0201_1_is_this_charset, sb_len_first_substr, @@ -3271,14 +3240,14 @@ static int jisx0208_1_len_first_char (const unsigned char* mstr, int len) return 0; ch2 = mstr [1]; - if (((ch1 >= 0x81 && ch1 <= 0x9F) || (ch1 >= 0xE0 && ch1 <= 0xEF)) && + if (((ch1 >= 0x81 && ch1 <= 0x9F) || (ch1 >= 0xE0 && ch1 <= 0xEF)) && ((ch2 >= 0x40 && ch2 <= 0x7E) || (ch2 >= 0x80 && ch2 <= 0xFC))) return 2; return 0; } -static Glyph32 jisx0208_1_char_glyph_value (const unsigned char* pre_mchar, +static Mchar32 jisx0208_1_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { unsigned char ch1 = cur_mchar [0]; @@ -3350,7 +3319,7 @@ static int jisx0208_1_len_first_substr (const unsigned char* mstr, int mstrlen) if (ch1 == '\0') return sub_len; ch2 = mstr [i + 1]; - if (((ch1 >= 0x81 && ch1 <= 0x9F) || (ch1 >= 0xE0 && ch1 <= 0xEF)) && + if (((ch1 >= 0x81 && ch1 <= 0x9F) || (ch1 >= 0xE0 && ch1 <= 0xEF)) && ((ch2 >= 0x40 && ch2 <= 0x7E) || (ch2 >= 0x80 && ch2 <= 0xFC))) sub_len += 2; else @@ -3377,7 +3346,7 @@ static int jisx0208_1_pos_first_char (const unsigned char* mstr, int mstrlen) if (ch1 == '\0') return -1; ch2 = mstr [i + 1]; - if (((ch1 >= 0x81 && ch1 <= 0x9F) || (ch1 >= 0xE0 && ch1 <= 0xEF)) && + if (((ch1 >= 0x81 && ch1 <= 0x9F) || (ch1 >= 0xE0 && ch1 <= 0xEF)) && ((ch2 >= 0x40 && ch2 <= 0x7E) || (ch2 >= 0x80 && ch2 <= 0xFC))) return i; @@ -3389,11 +3358,11 @@ static int jisx0208_1_pos_first_char (const unsigned char* mstr, int mstrlen) } #ifdef _MGCHARSET_UNICODE -static Uchar32 jisx0208_1_conv_to_uc32 (Glyph32 glyph_value) +static Uchar32 jisx0208_1_conv_to_uc32 (Mchar32 chv) { unsigned short ucs_code; - ucs_code = __mg_jisx0208_1_unicode_map [REAL_GLYPH(glyph_value)]; + ucs_code = __mg_jisx0208_1_unicode_map [chv]; if (ucs_code == 0) return '?'; @@ -3414,9 +3383,9 @@ static CHARSETOPS CharsetOps_jisx0208_1 = { FONT_CHARSET_JISX0208_1, 0, jisx0208_1_len_first_char, - jisx0208_1_char_glyph_value, + jisx0208_1_get_char_value, NULL, - mb_glyph_type, + mb_char_type, db_nr_chars_in_str, jisx0208_1_is_this_charset, jisx0208_1_len_first_substr, @@ -3463,7 +3432,7 @@ static int utf8_len_first_char (const unsigned char* mstr, int len) return 1; } -static Glyph32 utf8_char_glyph_value (const unsigned char* pre_mchar, int pre_len, +static Mchar32 utf8_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { Uchar32 wc = *((unsigned char *)(cur_mchar++)); @@ -3559,18 +3528,16 @@ static Glyph32 utf8_char_glyph_value (const unsigned char* pre_mchar, int pre_le ? TPROP_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff) \ : UCHAR_BREAK_UNKNOWN)) -static unsigned int unicode_glyph_type (Glyph32 glyph_value) +static unsigned int unicode_char_type (Mchar32 chv) { unsigned int mchar_type = MCHAR_TYPE_UNKNOWN; unsigned int basic_type = 0, break_type = 0; - glyph_value = REAL_GLYPH(glyph_value); + basic_type = TYPE(chv); + break_type = PROP(chv); - basic_type = TYPE(glyph_value); - break_type = PROP(glyph_value); - - if (glyph_value < 0x80) - mchar_type = sb_glyph_type(glyph_value); + if (chv < 0x80) + mchar_type = sb_char_type(chv); else if (break_type == UCHAR_BREAK_CARRIAGE_RETURN) mchar_type = MCHAR_TYPE_CR; else if (break_type == UCHAR_BREAK_LINE_FEED) @@ -3579,10 +3546,10 @@ static unsigned int unicode_glyph_type (Glyph32 glyph_value) mchar_type = MCHAR_TYPE_LF; else if (break_type == UCHAR_BREAK_SPACE) mchar_type = MCHAR_TYPE_SPACE; - else if (glyph_value != 0x00AD && ISZEROWIDTHTYPE (basic_type)) + else if (chv != 0x00AD && ISZEROWIDTHTYPE (basic_type)) mchar_type = MCHAR_TYPE_ZEROWIDTH; - else if ((glyph_value >= 0x1160 && glyph_value < 0x1200) - || glyph_value == 0x200B) + else if ((chv >= 0x1160 && chv < 0x1200) + || chv == 0x200B) mchar_type = MCHAR_TYPE_ZEROWIDTH; return (break_type << 24) | (basic_type << 16) | mchar_type; @@ -3590,39 +3557,38 @@ static unsigned int unicode_glyph_type (Glyph32 glyph_value) #include "unicode-bidi-tables.h" -static unsigned int unicode_bidi_glyph_type (Glyph32 glyph_value) +static unsigned int unicode_bidi_char_type (Mchar32 chv) { - Glyph32 glyph_first = 0; - Glyph32 glyph_last = (Glyph32)TABLESIZE (__mg_unicode_bidi_char_type_map); - Glyph32 glyph_mid; + Mchar32 chv_first = 0; + Mchar32 chv_last = (Mchar32)TABLESIZE (__mg_unicode_bidi_char_type_map); + Mchar32 chv_mid; - glyph_value = REAL_GLYPH(glyph_value); - while (glyph_last >= glyph_first) { - glyph_mid = (glyph_first + glyph_last)/2; + while (chv_last >= chv_first) { + chv_mid = (chv_first + chv_last)/2; - if ((__mg_unicode_bidi_char_type_map[glyph_mid].glyph <= glyph_value) - && ((__mg_unicode_bidi_char_type_map[glyph_mid].glyph + __mg_unicode_bidi_char_type_map[glyph_mid].count) > glyph_value)) { - return __mg_unicode_bidi_char_type_map[glyph_mid].type; + if ((__mg_unicode_bidi_char_type_map[chv_mid].chv <= chv) + && ((__mg_unicode_bidi_char_type_map[chv_mid].chv + __mg_unicode_bidi_char_type_map[chv_mid].count) > chv)) { + return __mg_unicode_bidi_char_type_map[chv_mid].type; } - if (glyph_value >= (__mg_unicode_bidi_char_type_map[glyph_mid].glyph + __mg_unicode_bidi_char_type_map[glyph_mid].count)) { - glyph_first = glyph_mid + 1; + if (chv >= (__mg_unicode_bidi_char_type_map[chv_mid].chv + __mg_unicode_bidi_char_type_map[chv_mid].count)) { + chv_first = chv_mid + 1; } else { - if (glyph_value < __mg_unicode_bidi_char_type_map[glyph_mid].glyph) - glyph_last = glyph_mid - 1; + if (chv < __mg_unicode_bidi_char_type_map[chv_mid].chv) + chv_last = chv_mid - 1; else - glyph_last = glyph_mid; + chv_last = chv_mid; } } return BIDI_TYPE_LTR; } -static BOOL unicode_bidi_mirror_glyph (Glyph32 glyph, Glyph32* mirrored) +static BOOL unicode_bidi_mirror_char (Mchar32 chv, Mchar32* mirrored) { - return get_mirror_glyph (__mg_unicode_mirror_table, - TABLESIZE (__mg_unicode_mirror_table), glyph, mirrored); + return get_mirror_char (__mg_unicode_mirror_table, + TABLESIZE (__mg_unicode_mirror_table), chv, mirrored); } static int utf8_nr_chars_in_str (const unsigned char* mstr, int mstrlen) @@ -3699,7 +3665,7 @@ static const unsigned char* utf8_get_next_word (const unsigned char* mstr, if (ch_len == 0) break; - wc = utf8_char_glyph_value (NULL, 0, mchar, 0); + wc = utf8_get_char_value (NULL, 0, mchar, 0); if (wc > 0x0FFF) { if (word_info->len) return mstr + word_info->len + word_info->nr_delimiters; @@ -3816,16 +3782,16 @@ static CHARSETOPS CharsetOps_utf8 = { FONT_CHARSET_UTF8, 0, utf8_len_first_char, - utf8_char_glyph_value, + utf8_get_char_value, NULL, - unicode_glyph_type, + unicode_char_type, utf8_nr_chars_in_str, utf8_is_this_charset, utf8_len_first_substr, utf8_get_next_word, utf8_pos_first_char, - unicode_bidi_glyph_type, - unicode_bidi_mirror_glyph, + unicode_bidi_char_type, + unicode_bidi_mirror_char, NULL, utf8_conv_from_uc32, }; @@ -3854,7 +3820,7 @@ static int utf16le_len_first_char (const unsigned char* mstr, int len) return 4; } -static Glyph32 utf16le_char_glyph_value (const unsigned char* pre_mchar, +static Mchar32 utf16le_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { Uchar16 w1, w2; @@ -3949,7 +3915,7 @@ static const unsigned char* utf16le_get_next_word (const unsigned char* mstr, if (ch_len == 0) break; - wc = utf16le_char_glyph_value (NULL, 0, mchar, 0); + wc = utf16le_get_char_value (NULL, 0, mchar, 0); if (wc > 0x0FFF) { if (word_info->len) return mstr + word_info->len + word_info->nr_delimiters; @@ -4042,16 +4008,16 @@ static CHARSETOPS CharsetOps_utf16le = { FONT_CHARSET_UTF16LE, 0, utf16le_len_first_char, - utf16le_char_glyph_value, + utf16le_get_char_value, NULL, - unicode_glyph_type, + unicode_char_type, utf16le_nr_chars_in_str, utf16le_is_this_charset, utf16le_len_first_substr, utf16le_get_next_word, utf16le_pos_first_char, - unicode_bidi_glyph_type, - unicode_bidi_mirror_glyph, + unicode_bidi_char_type, + unicode_bidi_mirror_char, NULL, utf16le_conv_from_uc32 }; @@ -4080,7 +4046,7 @@ static int utf16be_len_first_char (const unsigned char* mstr, int len) return 4; } -static Glyph32 utf16be_char_glyph_value (const unsigned char* pre_mchar, +static Mchar32 utf16be_get_char_value (const unsigned char* pre_mchar, int pre_len, const unsigned char* cur_mchar, int cur_len) { Uchar16 w1, w2; @@ -4175,7 +4141,7 @@ static const unsigned char* utf16be_get_next_word (const unsigned char* mstr, if (ch_len == 0) break; - wc = utf16be_char_glyph_value (NULL, 0, mchar, 0); + wc = utf16be_get_char_value (NULL, 0, mchar, 0); if (wc > 0x0FFF) { if (word_info->len) return mstr + word_info->len + word_info->nr_delimiters; @@ -4268,16 +4234,16 @@ static CHARSETOPS CharsetOps_utf16be = { FONT_CHARSET_UTF16BE, 0, utf16be_len_first_char, - utf16be_char_glyph_value, + utf16be_get_char_value, NULL, - unicode_glyph_type, + unicode_char_type, utf16be_nr_chars_in_str, utf16be_is_this_charset, utf16be_len_first_substr, utf16be_get_next_word, utf16be_pos_first_char, - unicode_bidi_glyph_type, - unicode_bidi_mirror_glyph, + unicode_bidi_char_type, + unicode_bidi_mirror_char, NULL, utf16be_conv_from_uc32 }; @@ -4368,7 +4334,7 @@ CHARSETOPS* GetCharsetOps (const char* charset) int i; for (i = 0; i < NR_CHARSETS; i++) { - if ((*Charsets [i]->is_this_charset) + if ((*Charsets [i]->is_this_charset) ((const unsigned char*)charset) == 0) return Charsets [i]; } @@ -4401,7 +4367,7 @@ BOOL IsCompatibleCharset (const char* charset, CHARSETOPS* ops) int i; for (i = 0; i < NR_CHARSETS; i++) { - if ((*Charsets [i]->is_this_charset) + if ((*Charsets [i]->is_this_charset) ((const unsigned char*)charset) == 0) if (Charsets [i] == ops) return TRUE; @@ -4426,13 +4392,13 @@ UCharBreakType GUIAPI UCharGetBreakType(Uchar32 uc) /** The function determines the BIDI type of a UNICODE character. */ unsigned int GUIAPI UCharGetBIDIType(Uchar32 uc) { - return unicode_bidi_glyph_type(uc); + return unicode_bidi_char_type(uc); } /** The function returns the mirror character of a UNICODE character. */ BOOL GUIAPI UCharGetMirror(Uchar32 uc, Uchar32* mirrored) { - return unicode_bidi_mirror_glyph (uc, mirrored); + return unicode_bidi_mirror_char (uc, mirrored); } BOOL GUIAPI IsUCharAlnum(Uchar32 uc) @@ -4643,11 +4609,11 @@ Uchar32 UCharToUpper (Uchar32 uc) Uchar32 val = ATTTABLE (uc >> 8, uc & 0xff); if (val >= 0x1000000) { const unsigned char *p = special_case_table + val - 0x1000000; - val = utf8_char_glyph_value (NULL, 0, p, -1); + val = utf8_get_char_value (NULL, 0, p, -1); } /* Some lowercase letters, e.uc., U+000AA, FEMININE ORDINAL INDICATOR, * do not have an uppercase equivalent, in which case val will be - * zero. + * zero. */ return val ? val : uc; } @@ -4672,7 +4638,7 @@ Uchar32 GUIAPI UCharToLower (Uchar32 uc) Uchar32 val = ATTTABLE (uc >> 8, uc & 0xff); if (val >= 0x1000000) { const unsigned char *p = special_case_table + val - 0x1000000; - return utf8_char_glyph_value (NULL, 0, p, -1); + return utf8_get_char_value (NULL, 0, p, -1); } else { /* Not all uppercase letters are guaranteed to have a lowercase @@ -4691,7 +4657,7 @@ Uchar32 GUIAPI UCharToLower (Uchar32 uc) } /** - * Converts a glyph to the titlecase. + * Converts a chv to the titlecase. */ Uchar32 GUIAPI UCharToTitle (Uchar32 uc) { @@ -4708,7 +4674,7 @@ Uchar32 GUIAPI UCharToTitle (Uchar32 uc) return uc; } -/** Converts a glyph to full-width. */ +/** Converts a chv to full-width. */ Uchar32 GUIAPI UCharToFullWidth (Uchar32 uc) { if (uc == 0x20) @@ -4721,7 +4687,7 @@ Uchar32 GUIAPI UCharToFullWidth (Uchar32 uc) return uc; } -/** Converts a glyph to single-width. */ +/** Converts a chv to single-width. */ Uchar32 GUIAPI UCharToSingleWidth (Uchar32 uc) { if (uc == 0x3000) @@ -4790,7 +4756,7 @@ static const struct UCharMap kana_small_to_full_size_table [] = { { /*ョ*/ 0xFF6E, /*ヨ*/ 0xFF96}, }; -/** Converts a glyph to full-size Kana. */ +/** Converts a chv to full-size Kana. */ Uchar32 GUIAPI UCharToFullSizeKana (Uchar32 uc) { unsigned int lower = 0; @@ -4869,7 +4835,7 @@ static const struct UCharMap kana_full_size_to_small_table [] = { { /*ヨ*/ 0xFF95, /*ョ*/ 0xFF6E}, }; -/** Converts a glyph to small Kana. */ +/** Converts a chv to small Kana. */ Uchar32 GUIAPI UCharToSmallKana (Uchar32 uc) { unsigned int lower = 0; @@ -4896,7 +4862,7 @@ Uchar32 GUIAPI UCharToSmallKana (Uchar32 uc) } #endif // VincentWei: use kana_small_to_full_size_table instead -/** Converts a glyph to small Kana. */ +/** Converts a chv to small Kana. */ Uchar32 GUIAPI UCharToSmallKana (Uchar32 uc) { unsigned int lower = 0; diff --git a/src/font/freetype2.c b/src/font/freetype2.c index 0bd38e0f..705594df 100644 --- a/src/font/freetype2.c +++ b/src/font/freetype2.c @@ -272,7 +272,7 @@ get_font_descent (LOGFONT* logfont, DEVFONT* devfont) static int load_or_search_glyph (FTINSTANCEINFO* ft_inst_info, FT_Face* face, - FT_ULong uni_char, int glyph_type) + FT_ULong uni_char, int char_type) { /* no need to lock/unlock in this function */ @@ -281,10 +281,10 @@ load_or_search_glyph (FTINSTANCEINFO* ft_inst_info, FT_Face* face, int ft_load_flags = FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; //setting load_flags - if (glyph_type == DEVFONTGLYPHTYPE_MONOBMP) + if (char_type == DEVFONTGLYPHTYPE_MONOBMP) ft_load_flags |= FT_LOAD_TARGET_MONO; else { - if (glyph_type == DEVFONTGLYPHTYPE_SUBPIXEL + if (char_type == DEVFONTGLYPHTYPE_SUBPIXEL && ft_inst_info->ft_lcdfilter != FT_LCD_FILTER_NONE) ft_load_flags |= FT_LOAD_TARGET_LCD; else diff --git a/src/font/rawbitmap.c b/src/font/rawbitmap.c index 67545327..021c4d2a 100644 --- a/src/font/rawbitmap.c +++ b/src/font/rawbitmap.c @@ -211,7 +211,7 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont, glyph_value = REAL_GLYPH(glyph_value); if (glyph_value >= RBFONT_INFO_P (devfont)->nr_glyphs) - glyph_value = devfont->charset_ops->def_glyph_value; + glyph_value = devfont->charset_ops->def_char_value; bitmap_size = ((RBFONT_INFO_P (devfont)->width + 7) >> 3) * RBFONT_INFO_P (devfont)->height; diff --git a/src/font/test/arabic/shape_test.c b/src/font/test/arabic/shape_test.c index 2cd691da..10831028 100644 --- a/src/font/test/arabic/shape_test.c +++ b/src/font/test/arabic/shape_test.c @@ -101,7 +101,7 @@ static int test_correctness () if (index < 0) /* not a letter.*/ continue; - glyph_value = iso8859_6_char_glyph_value (NULL, 0, c, 1); + glyph_value = iso8859_6_get_char_value (NULL, 0, c, 1); fprintf (stderr, "%x 's glyph value = %x\n", *c, glyph_value); if (!iso8859_6_test_glyph_value (index, glyph_value)) { diff --git a/src/font/textops.c b/src/font/textops.c index 1240d9d0..a682088b 100644 --- a/src/font/textops.c +++ b/src/font/textops.c @@ -256,7 +256,7 @@ int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32, return 0; else { if (dest) { - glyph_value = devfont->charset_ops->char_glyph_value(NULL, 0, mchar, n); + glyph_value = devfont->charset_ops->get_char_value(NULL, 0, mchar, n); if(devfont->charset_ops->conv_to_uc32) uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value); else @@ -371,7 +371,7 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32, } } else { - glyph_value = devfont->charset_ops->char_glyph_value (NULL, 0, mstr, left); + glyph_value = devfont->charset_ops->get_char_value (NULL, 0, mstr, left); if (devfont->charset_ops->conv_to_uc32) uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value); else diff --git a/src/font/unicode-bidi-tables.h b/src/font/unicode-bidi-tables.h index 89781be4..4ad6bb68 100644 --- a/src/font/unicode-bidi-tables.h +++ b/src/font/unicode-bidi-tables.h @@ -43,7 +43,7 @@ typedef struct _bidichar_type_map { Uint32 type; // Type of Unicode characters - Glyph32 glyph; // Starting index of Unicode character + Uchar32 chv; // Starting index of Unicode character Uint8 count; // Total number of Unicode characters of same type starting from glyphn } BIDICHAR_TYPE_MAP; diff --git a/src/include/bidi.h b/src/include/bidi.h index a87de113..85f6dbc6 100644 --- a/src/include/bidi.h +++ b/src/include/bidi.h @@ -62,8 +62,8 @@ extern "C" { typedef struct _TYPERUN TYPERUN; typedef struct _BIDICHAR_MIRROR_MAP { - Glyph32 glyph; - Glyph32 mirrored; + Mchar32 chv; + Mchar32 mirrored; } BIDICHAR_MIRROR_MAP; Glyph32* __mg_charset_bidi_glyphs_reorder (const CHARSETOPS* charset_ops, diff --git a/src/include/devfont.h b/src/include/devfont.h index 6c340266..0fa38861 100644 --- a/src/include/devfont.h +++ b/src/include/devfont.h @@ -133,6 +133,11 @@ static inline long get_opened_file_size (FILE* fp) return size; } +typedef unsigned int Mchar32; +#define IS_MBCHV(chv) ((chv) & 0x80000000) +#define SET_MBCHV(chv) ((chv) | 0x80000000) +#define REAL_CHV(chv) ((chv) & 0x7FFFFFFF) + /** The character set operation structure. */ struct _CHARSETOPS { @@ -146,34 +151,33 @@ struct _CHARSETOPS const char* name; /** Default character. */ - Glyph32 def_glyph_value; + Mchar32 def_char_value; - /** The method to get the length of the first character function. */ + /** The method to get the length of the first character. */ int (*len_first_char) (const unsigned char* mstr, int mstrlen); - /** The method to get character offset function. */ - Glyph32 (*char_glyph_value) (const unsigned char* pre_mchar, int pre_len, - const unsigned char* cur_mchar, int cur_len); + /** The method to get the character index. */ + Mchar32 (*get_char_value) (const unsigned char* pre_mchar, int pre_len, + const unsigned char* cur_mchar, int cur_len); - /** The method to get the require shape type glyph value. */ - Glyph32 (*glyph_shape) (const unsigned char* cur_mchar, int cur_len, int shape_type); + /** The method to get the require shape type of a mchar. */ + Mchar32 (*get_shaped_char_value) (const unsigned char* cur_mchar, int cur_len, + int shape_type); - /** The method to get the type of one glyph. */ - unsigned int (*glyph_type) (Glyph32 glyph_value); + /** The method to get the type of one character. */ + unsigned int (*char_type) (Mchar32 chv); /** The method to get character number in the string function. */ int (*nr_chars_in_str) (const unsigned char* mstr, int mstrlen); - /** The method to judge the \a charset is belong to the character set - * function. - */ + /** The method to judge a given charset name is belong to the character set */ int (*is_this_charset) (const unsigned char* charset); /** The method to get the length of the first substring. */ int (*len_first_substr) (const unsigned char* mstr, int mstrlen); /** The method to get next word in the specitied length string function. */ - const unsigned char* (*get_next_word) (const unsigned char* mstr, + const unsigned char* (*get_next_word) (const unsigned char* mstr, int strlen, WORDINFO* word_info); /** The method to get the position of the first character in the @@ -181,16 +185,15 @@ struct _CHARSETOPS */ int (*pos_first_char) (const unsigned char* mstr, int mstrlen); - /** The method to get the BIDI type of one glyph. */ - unsigned int (*bidi_glyph_type) (Glyph32 glyph_value); + /** The method to get the BIDI type of one character. */ + unsigned int (*bidi_char_type) (Mchar32 chv); - /** Get mirrored glyph - */ - BOOL (*bidi_mirror_glyph) (Glyph32 glyph, Glyph32* mirrored); + /** Get mirrored character */ + BOOL (*bidi_mirror_char) (Mchar32 chv, Mchar32* mirrored); #ifdef _MGCHARSET_UNICODE - /** The method to convert \a mchar to 32 bit UNICODE function. */ - Uchar32 (*conv_to_uc32) (Glyph32 glyph_value); + /** The method to convert a mchar32 value to 32 bit UNICODE function. */ + Uchar32 (*conv_to_uc32) (Mchar32 chv); /** The method to convert \a wc to multily byte character function. */ int (*conv_from_uc32) (Uchar32 wc, unsigned char* mchar); @@ -229,7 +232,7 @@ struct _FONTOPS int (*get_font_descent) (LOGFONT* logfont, DEVFONT* devfont); /** The method to judge the glyph is exist function. */ - BOOL (*is_glyph_existed) (LOGFONT* logfont, DEVFONT* devfont, + BOOL (*is_glyph_existed) (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_value); /** The method to get character advance function. */ @@ -241,16 +244,16 @@ struct _FONTOPS Glyph32 galph_value, int* px, int* py, int* pwidth, int* pheight); /** The method to get mono-bitmap function. */ - const void* (*get_glyph_monobitmap) (LOGFONT* logfont, DEVFONT* devfont, + const void* (*get_glyph_monobitmap) (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale); /** The method to get grey bitmap, pitch and scale function */ - const void* (*get_glyph_greybitmap) (LOGFONT* logfont, DEVFONT* devfont, + const void* (*get_glyph_greybitmap) (LOGFONT* logfont, DEVFONT* devfont, Glyph32 galph_value, SIZE* sz, int* pitch, unsigned short* scale); /** The method to get the pre-rendered bitmap of one glyph. */ - int (*get_glyph_prbitmap) (LOGFONT* logfont, DEVFONT* devfont, - Glyph32 glaph_value, BITMAP *bmp); + int (*get_glyph_prbitmap) (LOGFONT* logfont, DEVFONT* devfont, + Glyph32 glyph_value, BITMAP *bmp); /* The method to preproccess start string output fuction, call this * function before output a string, can be NULL. @@ -258,7 +261,7 @@ struct _FONTOPS void (*start_str_output) (LOGFONT* logfont, DEVFONT* devfont); /** The method to instance new device font function, can be NULL. */ - DEVFONT* (*new_instance) (LOGFONT* logfont, DEVFONT* devfont, + DEVFONT* (*new_instance) (LOGFONT* logfont, DEVFONT* devfont, BOOL need_sbc_font); /** The method to delete instance of device font function, can be NULL. */ @@ -267,13 +270,20 @@ struct _FONTOPS int (*is_rotatable) (LOGFONT* logfont, DEVFONT* devfont, int rot_desired); /** The method to load data of a devfont from font file - * FIXME real_fontname: return real name in file by a char point - **/ - //void* (*load_font_data) (char* fontname, char* filename, char* real_fontname); + * FIXME real_fontname: return real name in file by a char point + */ void* (*load_font_data) (DEVFONT* devfont, const char* fontname, const char* filename); /** The method to unload data of a devfont*/ void (*unload_font_data) (DEVFONT* devfont, void* data); + + /** + * The method to get the glyph value according to the character value. + * If it is NULL, the glyph value will be equal to the character value. + * + * Since 3.4.0. + */ + Glyph32 (*get_glyph_value) (LOGFONT* logfont, DEVFONT* devfont, Mchar32 chv); }; typedef struct { diff --git a/src/include/glyph.h b/src/include/glyph.h index eb6ae288..b31d86f9 100644 --- a/src/include/glyph.h +++ b/src/include/glyph.h @@ -46,6 +46,7 @@ extern "C" { #endif /* __cplusplus */ Glyph32 _gdi_select_glyph_dfi(LOGFONT* lf, Glyph32 gv); +Glyph32 _gdi_get_glyph_value(LOGFONT* lf, Mchar32 chv); #ifdef __cplusplus } diff --git a/src/newgdi/bidi.c b/src/newgdi/bidi.c index 2913bc50..3f425a26 100644 --- a/src/newgdi/bidi.c +++ b/src/newgdi/bidi.c @@ -63,7 +63,7 @@ static Glyph32* _gdi_get_glyphs_string(PDC pdc, const unsigned char* text, int i = 0; int len_cur_char; int left_bytes = text_len; - unsigned int glyph_type; + unsigned int char_type; Glyph32 glyph_value; DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0]; DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1]; @@ -77,14 +77,14 @@ static Glyph32* _gdi_get_glyphs_string(PDC pdc, const unsigned char* text, len_cur_char = mbc_devfont->charset_ops->len_first_char ((const unsigned char*)text, left_bytes); if (len_cur_char > 0) { - glyph_value = mbc_devfont->charset_ops->char_glyph_value + glyph_value = mbc_devfont->charset_ops->get_char_value (prev_mchar, prev_len, text, left_bytes); logical_glyphs[i++] = _gdi_select_glyph_dfi(pdc->pLogFont, glyph_value); - glyph_type = (*mbc_devfont->charset_ops->glyph_type) + char_type = (*mbc_devfont->charset_ops->char_type) (glyph_value); - if (!(glyph_type & MCHAR_TYPE_NOSPACING_MARK)){ + if (!(char_type & MCHAR_TYPE_NOSPACING_MARK)){ prev_mchar = text; prev_len = len_cur_char; } @@ -101,7 +101,7 @@ static Glyph32* _gdi_get_glyphs_string(PDC pdc, const unsigned char* text, ((const unsigned char*)text, left_bytes); if (len_cur_char > 0) { - glyph_value = sbc_devfont->charset_ops->char_glyph_value + glyph_value = sbc_devfont->charset_ops->get_char_value (NULL, 0, text, left_bytes); logical_glyphs[i++] = glyph_value; text += len_cur_char; @@ -118,12 +118,12 @@ static Glyph32* _gdi_get_glyphs_string(PDC pdc, const unsigned char* text, return logical_glyphs; } -static unsigned int inline get_glyph_type(LOGFONT* logfont, Glyph32 glyph_value) +static unsigned int inline get_char_type(LOGFONT* logfont, Glyph32 glyph_value) { if (IS_MBC_GLYPH (glyph_value)) - return logfont->devfonts[1]->charset_ops->glyph_type(glyph_value); + return logfont->devfonts[1]->charset_ops->char_type(glyph_value); else - return logfont->devfonts[0]->charset_ops->glyph_type(glyph_value); + return logfont->devfonts[0]->charset_ops->char_type(glyph_value); } static int inline get_glyph_advance_in_dc (PDC pdc, Glyph32 glyph_value) @@ -139,7 +139,7 @@ static int jump_vowels_ltr (PDC pdc, Glyph32* glyphs, int glyph_num, Glyph32* bi int cur_advance = 0; for (i=0; ipLogFont, glyphs[i]))) + if (!check_vowel(get_char_type (pdc->pLogFont, glyphs[i]))) return i; cur_advance = get_glyph_advance_in_dc (pdc, glyphs[i]); if (cur_advance > max_advance) @@ -156,7 +156,7 @@ static int output_visual_glyphs_ltr (PDC pdc, Glyph32* visual_glyphs, { int i = 0; int j = 0; - unsigned int glyph_type; + unsigned int char_type; Glyph32 glyph_value; Glyph32 biggest_vowel = 0; @@ -179,8 +179,8 @@ static int output_visual_glyphs_ltr (PDC pdc, Glyph32* visual_glyphs, if (vowel_num < nr_glyphs - i) { glyph_value = *(visual_glyphs); - glyph_type = get_glyph_type (pdc->pLogFont, glyph_value); - if (!cb_one_glyph (context, glyph_value, glyph_type)){ + char_type = get_char_type (pdc->pLogFont, glyph_value); + if (!cb_one_glyph (context, glyph_value, char_type)){ goto end; } outed_num++; @@ -193,8 +193,8 @@ static int output_visual_glyphs_ltr (PDC pdc, Glyph32* visual_glyphs, /*first output the biggest vowel*/ if (vowel_num) { - glyph_type = get_glyph_type (pdc->pLogFont, biggest_vowel); - if (!cb_one_glyph (context, biggest_vowel, glyph_type)){ + char_type = get_char_type (pdc->pLogFont, biggest_vowel); + if (!cb_one_glyph (context, biggest_vowel, char_type)){ goto end; } outed_num++; @@ -208,8 +208,8 @@ static int output_visual_glyphs_ltr (PDC pdc, Glyph32* visual_glyphs, glyph_value = *(visual_glyphs - j); if (glyph_value != biggest_vowel) { - glyph_type = get_glyph_type (pdc->pLogFont, glyph_value); - if (!cb_one_glyph (context, glyph_value, glyph_type)){ + char_type = get_char_type (pdc->pLogFont, glyph_value); + if (!cb_one_glyph (context, glyph_value, char_type)){ goto end; } outed_num++; @@ -233,7 +233,7 @@ static int output_vowels_rtl (PDC pdc, Glyph32* end_glyph, int left_num, { int i = 0; Glyph32 glyph_value; - unsigned int glyph_type; + unsigned int char_type; int old_text_align = pdc->ta_flags; int old_bkmode = pdc->bkmode; @@ -242,10 +242,10 @@ static int output_vowels_rtl (PDC pdc, Glyph32* end_glyph, int left_num, *outed_num = 0; for (i=0; ipLogFont, glyph_value); + char_type = get_char_type (pdc->pLogFont, glyph_value); - if (check_vowel(glyph_type)) { - if (cb_one_glyph(context, glyph_value, glyph_type)) { + if (check_vowel(char_type)) { + if (cb_one_glyph(context, glyph_value, char_type)) { (*outed_num) ++; } } @@ -263,23 +263,23 @@ static int output_unowned_vowels_rtl (PDC pdc, Glyph32* end_glyph, int left_num, int i = 0; Glyph32 glyph_value = INV_GLYPH_VALUE; Glyph32 biggest_vowel = INV_GLYPH_VALUE; - unsigned int glyph_type; + unsigned int char_type; int cur_advance = 0; int max_advance = 0; int bkmode = pdc->bkmode; int old_text_align = pdc->ta_flags; *outed_num = 0; - if (!check_vowel(get_glyph_type (pdc->pLogFont, *end_glyph))) + if (!check_vowel(get_char_type (pdc->pLogFont, *end_glyph))) return 0; pdc->ta_flags = (old_text_align & ~TA_RIGHT) | TA_LEFT; for (i=0; ipLogFont, glyph_value); + char_type = get_char_type (pdc->pLogFont, glyph_value); - if (!check_vowel(glyph_type)) + if (!check_vowel(char_type)) break; cur_advance = get_glyph_advance_in_dc (pdc, glyph_value); @@ -292,8 +292,8 @@ static int output_unowned_vowels_rtl (PDC pdc, Glyph32* end_glyph, int left_num, /*output the biggest_vowel*/ if(max_advance){ - glyph_type = get_glyph_type (pdc->pLogFont, biggest_vowel); - if (cb_one_glyph(context, biggest_vowel, glyph_type)){ + char_type = get_char_type (pdc->pLogFont, biggest_vowel); + if (cb_one_glyph(context, biggest_vowel, char_type)){ (*outed_num) ++; } } @@ -306,8 +306,8 @@ static int output_unowned_vowels_rtl (PDC pdc, Glyph32* end_glyph, int left_num, glyph_value = *end_glyph--; if (glyph_value != biggest_vowel) { - glyph_type = get_glyph_type (pdc->pLogFont, glyph_value); - if (cb_one_glyph(context, glyph_value, glyph_type)) + char_type = get_char_type (pdc->pLogFont, glyph_value); + if (cb_one_glyph(context, glyph_value, char_type)) { (*outed_num) ++; } @@ -322,7 +322,7 @@ static int output_visual_glyphs_rtl (PDC pdc, Glyph32* visual_glyphs, int nr_glyphs, CB_ONE_GLYPH cb_one_glyph, void* context) { int cur = nr_glyphs - 1; - unsigned int glyph_type; + unsigned int char_type; Glyph32 glyph_value; int vowel_num; int outed_vowel_num; @@ -339,10 +339,10 @@ static int output_visual_glyphs_rtl (PDC pdc, Glyph32* visual_glyphs, while (cur >= 0) { glyph_value = visual_glyphs[cur]; - glyph_type = get_glyph_type (pdc->pLogFont, glyph_value); + char_type = get_char_type (pdc->pLogFont, glyph_value); /*output the letter*/ - if (!cb_one_glyph(context, glyph_value, glyph_type)){ + if (!cb_one_glyph(context, glyph_value, char_type)){ return outed_glyph_num; } outed_glyph_num ++; @@ -380,7 +380,7 @@ static int _gdi_output_glyphs_direct(PDC pdc, const unsigned char* text, int text_len, CB_ONE_GLYPH cb_one_glyph, void* context, BOOL if_break, BOOL if_draw) { - unsigned int glyph_type; + unsigned int char_type; Glyph32 glyph_value; DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0]; DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1]; @@ -404,7 +404,7 @@ static int _gdi_output_glyphs_direct(PDC pdc, const unsigned char* text, len_cur_char = mbc_devfont->charset_ops->len_first_char ((const unsigned char*)text, left_bytes); if (len_cur_char > 0) { - glyph_value = mbc_devfont->charset_ops->char_glyph_value + glyph_value = mbc_devfont->charset_ops->get_char_value (prev_mchar, prev_len, text, left_bytes); glyph_value = _gdi_select_glyph_dfi(pdc->pLogFont, glyph_value); @@ -416,16 +416,16 @@ static int _gdi_output_glyphs_direct(PDC pdc, const unsigned char* text, ((const unsigned char*)text, left_bytes); if (len_cur_char > 0) { - glyph_value = sbc_devfont->charset_ops->char_glyph_value + glyph_value = sbc_devfont->charset_ops->get_char_value (NULL, 0, text, left_bytes); } else break; do_glyph: if (IS_MBC_GLYPH (glyph_value)) - glyph_type = mbc_devfont->charset_ops->glyph_type (glyph_value); + char_type = mbc_devfont->charset_ops->char_type (glyph_value); else - glyph_type = sbc_devfont->charset_ops->glyph_type (glyph_value); + char_type = sbc_devfont->charset_ops->char_type (glyph_value); if(if_break){ DRAWTEXTEX2_CTXT _txt; @@ -436,7 +436,7 @@ do_glyph: _txt.nFormat = ctxt->nFormat; _txt.only_extent = TRUE; _txt.tab_width = ctxt->tab_width; - if (!cb_one_glyph(&_txt, glyph_value, glyph_type)){ + if (!cb_one_glyph(&_txt, glyph_value, char_type)){ break; } line_width += _txt.advance; @@ -446,7 +446,7 @@ do_glyph: } if(if_draw) { - if (!cb_one_glyph(ctxt, glyph_value, glyph_type)){ + if (!cb_one_glyph(ctxt, glyph_value, char_type)){ break; } } @@ -468,7 +468,7 @@ Glyph32* _gdi_bidi_reorder (PDC pdc, const unsigned char* text, int text_len, DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1]; Glyph32 *logical_glyphs = NULL; - if (mbc_devfont && mbc_devfont->charset_ops->bidi_glyph_type) { + if (mbc_devfont && mbc_devfont->charset_ops->bidi_char_type) { logical_glyphs = _gdi_get_glyphs_string (pdc, text, text_len, nr_glyphs); if (*nr_glyphs > 0) __mg_charset_bidi_glyphs_reorder (mbc_devfont->charset_ops, @@ -482,7 +482,7 @@ int _gdi_reorder_text (PDC pdc, const unsigned char* text, int text_len, BOOL direction, CB_ONE_GLYPH cb_one_glyph, void* context) { int i = 0; - unsigned int glyph_type; + unsigned int char_type; Glyph32 glyph_value; DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0]; DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1]; @@ -491,7 +491,7 @@ int _gdi_reorder_text (PDC pdc, const unsigned char* text, int text_len, int nr_glyphs = 0; Glyph32 *logical_glyphs = NULL; - if (mbc_devfont->charset_ops->bidi_glyph_type) { + if (mbc_devfont->charset_ops->bidi_char_type) { logical_glyphs = _gdi_bidi_reorder (pdc, text, text_len, &nr_glyphs); if (!logical_glyphs || nr_glyphs <= 0) @@ -523,27 +523,27 @@ int _gdi_reorder_text (PDC pdc, const unsigned char* text, int text_len, else { if (!direction) { /* right to left, reverse text.*/ for (i = text_len - 1; i >= 0; i--) { - if (!(glyph_value = sbc_devfont->charset_ops->char_glyph_value + if (!(glyph_value = sbc_devfont->charset_ops->get_char_value (NULL, 0, text + i, 1))) return (text_len-i-1); - glyph_type = sbc_devfont->charset_ops->glyph_type + char_type = sbc_devfont->charset_ops->char_type (glyph_value); - if (!cb_one_glyph (context, glyph_value, glyph_type)) + if (!cb_one_glyph (context, glyph_value, char_type)) break; } } else { for (i = 0; i < text_len; i++) { - if (!(glyph_value = sbc_devfont->charset_ops->char_glyph_value + if (!(glyph_value = sbc_devfont->charset_ops->get_char_value (NULL, 0, text + i, 1))) return i; - glyph_type = sbc_devfont->charset_ops->glyph_type + char_type = sbc_devfont->charset_ops->char_type (glyph_value); - if(!cb_one_glyph (context, glyph_value, glyph_type)) + if(!cb_one_glyph (context, glyph_value, char_type)) break; } } @@ -558,7 +558,7 @@ _gdi_get_glyphs_string_charbreak(PDC pdc, const unsigned char* text, int i = 0; int len_cur_char; int left_bytes = text_len; - unsigned int glyph_type; + unsigned int char_type; Glyph32 glyph_value; DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0]; DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1]; @@ -581,16 +581,16 @@ _gdi_get_glyphs_string_charbreak(PDC pdc, const unsigned char* text, else len_cur_char = 0; if (len_cur_char > 0) { - glyph_value = mbc_devfont->charset_ops->char_glyph_value + glyph_value = mbc_devfont->charset_ops->get_char_value (prev_mchar, prev_len, text, left_bytes); prev_mchar = text; prev_len = len_cur_char; logical_glyphs[i++] = _gdi_select_glyph_dfi(pdc->pLogFont, glyph_value); - glyph_type = (*mbc_devfont->charset_ops->glyph_type) + char_type = (*mbc_devfont->charset_ops->char_type) (glyph_value); - if (!(glyph_type & MCHAR_TYPE_NOSPACING_MARK)){ + if (!(char_type & MCHAR_TYPE_NOSPACING_MARK)){ prev_mchar = text; } else{ @@ -607,7 +607,7 @@ _gdi_get_glyphs_string_charbreak(PDC pdc, const unsigned char* text, ((const unsigned char*)text, left_bytes); if (len_cur_char > 0) { - glyph_value = sbc_devfont->charset_ops->char_glyph_value + glyph_value = sbc_devfont->charset_ops->get_char_value (NULL, 0, text, left_bytes); logical_glyphs[i++] = glyph_value; line_width += _gdi_get_glyph_advance (pdc, logical_glyphs[i-1], @@ -825,7 +825,7 @@ _gdi_output_glyphs_direct_sbc_rtol_break(PDC pdc, const unsigned char* text, DRAWTEXTEX2_CTXT* ctxt = (DRAWTEXTEX2_CTXT*)context; int nr_glyphs = 0; int i = 0; - unsigned int glyph_type; + unsigned int char_type; Glyph32 glyph_value; DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0]; @@ -846,13 +846,13 @@ _gdi_output_glyphs_direct_sbc_rtol_break(PDC pdc, const unsigned char* text, if(ctxt->nCount <= 0) return 0; for (i = ctxt->nCount - 1; i >= 0; i--) { - glyph_value = sbc_devfont->charset_ops->char_glyph_value + glyph_value = sbc_devfont->charset_ops->get_char_value (NULL, 0, text + i, 1); - glyph_type = sbc_devfont->charset_ops->glyph_type + char_type = sbc_devfont->charset_ops->char_type (glyph_value); - if(!cb_one_glyph (context, glyph_value, glyph_type)) + if(!cb_one_glyph (context, glyph_value, char_type)) break; } return nr_glyphs; @@ -868,7 +868,7 @@ int _gdi_reorder_text_break (PDC pdc, const unsigned char* text, int nr_glyphs = text_len; Glyph32 *logical_glyphs = NULL; - if (mbc_devfont->charset_ops->bidi_glyph_type){ + if (mbc_devfont->charset_ops->bidi_char_type){ logical_glyphs = _gdi_get_glyphs_string_break(pdc, text, text_len, &nr_glyphs, context); @@ -1009,16 +1009,16 @@ int GUIAPI GetGlyphsExtentPoint( PDC pdc = dc_HDC2PDC(hdc); PLOGFONT log_font = pdc->pLogFont; DEVFONT* devfont = NULL; - unsigned int glyph_type = 0; + unsigned int char_type = 0; size->cx = 0; size->cy = 0; while(i < nr_glyphs){ devfont = SELECT_DEVFONT(log_font, glyphs[i]); - glyph_type = devfont->charset_ops->glyph_type(glyphs[i]); + char_type = devfont->charset_ops->char_type(glyphs[i]); - if (check_zero_width (glyph_type)) { + if (check_zero_width (char_type)) { adv_x = adv_y = 0; } else { @@ -1058,7 +1058,7 @@ int GUIAPI GetGlyphsExtent( int i = 0; int advance = 0; int adv_x, adv_y; - unsigned int glyph_type; + unsigned int char_type; Glyph32 glyph_value = INV_GLYPH_VALUE; PDC pdc = dc_HDC2PDC(hdc); PLOGFONT log_font = pdc->pLogFont; @@ -1068,9 +1068,9 @@ int GUIAPI GetGlyphsExtent( size->cy = 0; while (i < nr_glyphs) { devfont = SELECT_DEVFONT(log_font, glyphs[i]); - glyph_type = devfont->charset_ops->glyph_type(glyphs[i]); + char_type = devfont->charset_ops->char_type(glyphs[i]); - if (check_zero_width (glyph_type)) { + if (check_zero_width (char_type)) { adv_x = adv_y = 0; } else { @@ -1361,7 +1361,7 @@ void GUIAPI BIDIGetTextRangesLog2Vis(LOGFONT* log_font, *nr_ranges = 0; /* it is not bidi string. */ if (!log_font->devfonts[1] || (log_font->devfonts[1] && - !log_font->devfonts[1]->charset_ops->bidi_glyph_type)) { + !log_font->devfonts[1]->charset_ops->bidi_char_type)) { *ranges = NULL; return; } @@ -1457,7 +1457,7 @@ int GUIAPI BIDIGetTextVisualGlyphs(LOGFONT* log_font, glyphs, glyphs_map); if (nr_glyphs > 0 && mbc_devfont - && mbc_devfont->charset_ops->bidi_glyph_type) { + && mbc_devfont->charset_ops->bidi_char_type) { __mg_charset_bidi_glyphs_reorder (mbc_devfont->charset_ops, *glyphs, nr_glyphs, -1, *glyphs_map, bidi_reverse_map); @@ -1472,7 +1472,7 @@ Glyph32* GUIAPI BIDILogGlyphs2VisGlyphs(LOGFONT* log_font, DEVFONT* mbc_devfont = log_font->devfonts[1]; if (nr_glyphs > 0 && mbc_devfont - && mbc_devfont->charset_ops->bidi_glyph_type) { + && mbc_devfont->charset_ops->bidi_char_type) { __mg_charset_bidi_glyphs_reorder (mbc_devfont->charset_ops, glyphs, nr_glyphs, -1, glyphs_map, bidi_reverse_map); @@ -1490,7 +1490,7 @@ BOOL GUIAPI BIDILogGlyphs2VisGlyphsEx(LOGFONT* log_font, DEVFONT* mbc_devfont = log_font->devfonts[1]; if (nr_glyphs > 0 && mbc_devfont - && mbc_devfont->charset_ops->bidi_glyph_type) { + && mbc_devfont->charset_ops->bidi_char_type) { __mg_charset_bidi_glyphs_reorder (mbc_devfont->charset_ops, glyphs, nr_glyphs, pel, extra, cb_reorder_extra); @@ -1510,7 +1510,7 @@ void GUIAPI BIDIGetLogicalEmbedLevelsEx(LOGFONT* log_font, if (*embedding_levels == NULL) *embedding_levels = malloc(nr_glyphs * sizeof (Uint8)); - if (mbc_devfont && mbc_devfont->charset_ops->bidi_glyph_type) { + if (mbc_devfont && mbc_devfont->charset_ops->bidi_char_type) { __mg_charset_bidi_get_embeddlevels (mbc_devfont->charset_ops, glyphs, nr_glyphs, pel, *embedding_levels, 0); } @@ -1528,7 +1528,7 @@ void GUIAPI BIDIGetVisualEmbedLevelsEx(LOGFONT* log_font, if (*embedding_levels == NULL) *embedding_levels = malloc(nr_glyphs * sizeof (Uint8)); - if (mbc_devfont && mbc_devfont->charset_ops->bidi_glyph_type) { + if (mbc_devfont && mbc_devfont->charset_ops->bidi_char_type) { __mg_charset_bidi_get_embeddlevels (mbc_devfont->charset_ops, glyphs, nr_glyphs, pel, *embedding_levels, 1); } diff --git a/src/newgdi/drawtext.c b/src/newgdi/drawtext.c index f24a6b3e..ec02fda6 100644 --- a/src/newgdi/drawtext.c +++ b/src/newgdi/drawtext.c @@ -100,14 +100,14 @@ static inline BOOL is_utf16_logfont (PDC pdc) #endif static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value, - unsigned int glyph_type) + unsigned int char_type) { DRAWTEXTEX2_CTXT* ctxt = (DRAWTEXTEX2_CTXT*)context; int adv_x = 0, adv_y = 0; BBOX bbox; int bkmode; - switch (glyph_type & GLYPHTYPE_MCHAR_MASK) { + switch (char_type & GLYPHTYPE_MCHAR_MASK) { case MCHAR_TYPE_ZEROWIDTH: case MCHAR_TYPE_CR: adv_x = adv_y = 0; diff --git a/src/newgdi/drawtext.h b/src/newgdi/drawtext.h index 1b0a1633..f190d8bf 100644 --- a/src/newgdi/drawtext.h +++ b/src/newgdi/drawtext.h @@ -89,7 +89,7 @@ void _gdi_calc_glyphs_size_from_two_points (PDC pdc, int x0, int y0, int x1, int y1, SIZE* size); typedef BOOL (*CB_ONE_GLYPH) (void* context, Glyph32 glyph_value, - unsigned int glyph_type); + unsigned int char_type); int _gdi_output_visual_glyphs(PDC pdc, Glyph32* visual_glyphs, int nr_glyphs, BOOL direction, CB_ONE_GLYPH cb_one_glyph, void* context); diff --git a/src/newgdi/glyph-old.c b/src/newgdi/glyph-old.c index 3a93f529..46fb6178 100644 --- a/src/newgdi/glyph-old.c +++ b/src/newgdi/glyph-old.c @@ -1785,7 +1785,7 @@ int _gdi_draw_one_glyph (PDC pdc, Glyph32 glyph_value, BOOL direction, logfont = pdc->pLogFont; devfont = SELECT_DEVFONT (logfont, glyph_value); - glyph_bmptype = devfont->font_ops->get_glyph_type (logfont, devfont) + glyph_bmptype = devfont->font_ops->get_char_type (logfont, devfont) & DEVFONTGLYPHTYPE_MASK_BMPTYPE; // VincentWei: only use auto bold when the weight of devfont does not diff --git a/src/newgdi/glyph-unicode.c b/src/newgdi/glyph-unicode.c index 06931751..a08d4a1d 100644 --- a/src/newgdi/glyph-unicode.c +++ b/src/newgdi/glyph-unicode.c @@ -316,14 +316,16 @@ static int get_next_glyph(struct glyph_break_ctxt* gbctxt, ((const unsigned char*)mstr, mstr_len); if (mclen > 0) { - *gv = gbctxt->mbc_devfont->charset_ops->char_glyph_value + Mchar32 chv = gbctxt->mbc_devfont->charset_ops->get_char_value (NULL, 0, (Uint8*)mstr, mclen); - *gv = _gdi_select_glyph_dfi(gbctxt->lf, *gv); if (gbctxt->mbc_devfont->charset_ops->conv_to_uc32) - *uc = gbctxt->mbc_devfont->charset_ops->conv_to_uc32(*gv); + *uc = gbctxt->mbc_devfont->charset_ops->conv_to_uc32(chv); else - *uc = REAL_GLYPH(*gv); + *uc = chv; + + chv = SET_MBCHV(chv); + *gv = _gdi_get_glyph_value(gbctxt->lf, chv); } } @@ -332,12 +334,15 @@ static int get_next_glyph(struct glyph_break_ctxt* gbctxt, ((const unsigned char*)mstr, mstr_len); if (mclen > 0) { - *gv = gbctxt->sbc_devfont->charset_ops->char_glyph_value + Mchar32 chv = gbctxt->sbc_devfont->charset_ops->get_char_value (NULL, 0, (Uint8*)mstr, mclen); + if (gbctxt->sbc_devfont->charset_ops->conv_to_uc32) - *uc = gbctxt->sbc_devfont->charset_ops->conv_to_uc32(*gv); + *uc = gbctxt->sbc_devfont->charset_ops->conv_to_uc32(chv); else - *uc = REAL_GLYPH(*gv); + *uc = chv; + + *gv = _gdi_get_glyph_value(gbctxt->lf, chv); } } diff --git a/src/newgdi/glyph.c b/src/newgdi/glyph.c index 2a5c2d9a..ec5e6419 100644 --- a/src/newgdi/glyph.c +++ b/src/newgdi/glyph.c @@ -87,7 +87,7 @@ Glyph32 GUIAPI GetGlyphValue (LOGFONT* logfont, const char* mchar, ((const unsigned char*)mchar, mchar_len); if (len_cur_char > 0) { - gv = mbc_devfont->charset_ops->char_glyph_value + gv = mbc_devfont->charset_ops->get_char_value ((Uint8*)pre_mchar, pre_len, (Uint8*)mchar, mchar_len); dfi = 1; @@ -109,14 +109,14 @@ Glyph32 GUIAPI GetGlyphValue (LOGFONT* logfont, const char* mchar, ((const unsigned char*)mchar, mchar_len); if (len_cur_char > 0) { - gv = sbc_devfont->charset_ops->char_glyph_value + gv = sbc_devfont->charset_ops->get_char_value (NULL, 0, (Uint8*)mchar, mchar_len); } return gv; } -Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar, +Glyph32 GUIAPI GetShapedGlyph (LOGFONT* logfont, const char* mchar, int mchar_len, GLYPHSHAPETYPE shape_type) { int len_cur_char; @@ -133,11 +133,11 @@ Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar, int i, dfi; DEVFONT* df; - if (mbc_devfont->charset_ops->glyph_shape) - glyph_value = mbc_devfont->charset_ops->glyph_shape( + if (mbc_devfont->charset_ops->get_shaped_char_value) + glyph_value = mbc_devfont->charset_ops->get_shaped_char_value( (const unsigned char*)mchar, mchar_len, shape_type); else - glyph_value = mbc_devfont->charset_ops->char_glyph_value + glyph_value = mbc_devfont->charset_ops->get_char_value (NULL, 0, (Uint8*)mchar, len_cur_char); dfi = 1; @@ -158,11 +158,11 @@ Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar, ((const unsigned char*)mchar, mchar_len); if (len_cur_char > 0) { - if (sbc_devfont->charset_ops->glyph_shape) - glyph_value = sbc_devfont->charset_ops->glyph_shape( + if (sbc_devfont->charset_ops->get_shaped_char_value) + glyph_value = sbc_devfont->charset_ops->get_shaped_char_value( (const unsigned char*)mchar, mchar_len, shape_type); else - glyph_value = sbc_devfont->charset_ops->char_glyph_value + glyph_value = sbc_devfont->charset_ops->get_char_value (NULL, 0, (Uint8*)mchar, len_cur_char); } @@ -176,8 +176,8 @@ BOOL GUIAPI GetMirrorGlyph (LOGFONT* logfont, Glyph32 gv, *mirrored = INV_GLYPH_VALUE; DEVFONT* devfont = SELECT_DEVFONT(logfont, gv); - if (devfont->charset_ops->bidi_mirror_glyph) { - return devfont->charset_ops->bidi_mirror_glyph(gv, mirrored); + if (devfont->charset_ops->bidi_mirror_char) { + return devfont->charset_ops->bidi_mirror_char(gv, mirrored); } return FALSE; @@ -187,7 +187,7 @@ int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value, int* adv_x, int* adv_y) { int advance; - int glyph_type; + int char_type; PDC pdc = dc_HDC2PDC(hdc); DEVFONT* devfont = SELECT_DEVFONT(pdc->pLogFont, glyph_value); @@ -196,8 +196,8 @@ int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value, coor_LP2SP (pdc, &x, &y); pdc->rc_output = pdc->DevRC; - glyph_type = devfont->charset_ops->glyph_type (glyph_value); - if (check_zero_width(glyph_type)) { + char_type = devfont->charset_ops->char_type (glyph_value); + if (check_zero_width(char_type)) { if (adv_x) *adv_x = 0; if (adv_y) *adv_y = 0; advance = 0; @@ -223,7 +223,7 @@ unsigned int GUIAPI GetGlyphType (LOGFONT* logfont, Glyph32 glyph_value) /* get the relative device font */ DEVFONT* devfont = SELECT_DEVFONT(logfont, glyph_value); glyph_value = REAL_GLYPH (glyph_value); - return devfont->charset_ops->glyph_type (glyph_value); + return devfont->charset_ops->char_type (glyph_value); } int GUIAPI GetGlyphInfo (LOGFONT* logfont, Glyph32 glyph_value, @@ -236,16 +236,16 @@ int GUIAPI GetGlyphInfo (LOGFONT* logfont, Glyph32 glyph_value, /* get glyph type */ if (glyph_info->mask & GLYPH_INFO_TYPE) - glyph_info->glyph_type = devfont->charset_ops->glyph_type (glyph_value); + glyph_info->char_type = devfont->charset_ops->char_type (glyph_value); /* get glyph type */ if (glyph_info->mask & GLYPH_INFO_BIDI_TYPE) { - if (devfont->charset_ops->bidi_glyph_type) { - glyph_info->bidi_glyph_type - = devfont->charset_ops->bidi_glyph_type (glyph_value); + if (devfont->charset_ops->bidi_char_type) { + glyph_info->bidi_char_type + = devfont->charset_ops->bidi_char_type (glyph_value); } else { - glyph_info->bidi_glyph_type = BIDI_TYPE_INVALID; + glyph_info->bidi_char_type = BIDI_TYPE_INVALID; } } @@ -2962,3 +2962,35 @@ Glyph32 _gdi_select_glyph_dfi(LOGFONT* lf, Glyph32 gv) return SET_GLYPH_DFI(gv, dfi); } +Glyph32 _gdi_get_glyph_value(LOGFONT* lf, Mchar32 chv) +{ + Glyph32 gv = INV_GLYPH_VALUE; + int i, dfi = 0; + DEVFONT* df; + + if (IS_MBCHV(chv)) { + for (i = 1; i < MAXNR_DEVFONTS; i++) { + if ((df = lf->devfonts[i])) { + if (df->font_ops->get_glyph_value) + gv = df->font_ops->get_glyph_value(lf, df, chv); + else + gv = REAL_CHV(chv); + + if (df->font_ops->is_glyph_existed(lf, df, gv)) { + dfi = i; + break; + } + } + } + } + + if (dfi == 0) { + if (REAL_CHV(chv) < 0x80) + dfi = 0; + else + dfi = 1; + } + + return SET_GLYPH_DFI(gv, dfi); +} + diff --git a/src/newgdi/tabbedtextout.c b/src/newgdi/tabbedtextout.c index db0c87c7..d4f42f2a 100644 --- a/src/newgdi/tabbedtextout.c +++ b/src/newgdi/tabbedtextout.c @@ -116,14 +116,14 @@ typedef struct _TABBEDTEXTOUT_CTXT } TABBEDTEXTOUT_CTXT; static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value, - unsigned int glyph_type) + unsigned int char_type) { TABBEDTEXTOUT_CTXT* ctxt = (TABBEDTEXTOUT_CTXT*)context; int adv_x, adv_y; BBOX bbox; int bkmode = ctxt->pdc->bkmode; - switch (glyph_type & GLYPHTYPE_MCHAR_MASK) { + switch (char_type & GLYPHTYPE_MCHAR_MASK) { case MCHAR_TYPE_ZEROWIDTH: adv_x = adv_y = 0; break; @@ -196,13 +196,13 @@ typedef struct _TABBEDTEXTOUTEX_CTXT } TABBEDTEXTOUTEX_CTXT; static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value, - unsigned int glyph_type) + unsigned int char_type) { TABBEDTEXTOUTEX_CTXT* ctxt = (TABBEDTEXTOUTEX_CTXT*)context; int adv_x, adv_y; int tab_pos = ctxt->nTabOrig; - switch (glyph_type & GLYPHTYPE_MCHAR_MASK) { + switch (char_type & GLYPHTYPE_MCHAR_MASK) { case MCHAR_TYPE_ZEROWIDTH: adv_x = adv_y = 0; break; @@ -533,7 +533,7 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text, size->cx = size->cy = 0; /* This function does not support BIDI */ - if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_glyph_type) + if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_char_type) return -1; _gdi_start_new_line (pdc); @@ -566,11 +566,11 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text, } if (devfont) { - int glyph_type; + int char_type; - glyph_value = devfont->charset_ops->char_glyph_value + glyph_value = devfont->charset_ops->get_char_value (NULL, 0, (const unsigned char*)text, len_cur_char); - glyph_type = devfont->charset_ops->glyph_type (glyph_value); + char_type = devfont->charset_ops->char_type (glyph_value); if (devfont == mbc_devfont) { int i, dfi; @@ -589,7 +589,7 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text, glyph_value = SET_GLYPH_DFI(glyph_value, dfi); } - switch (glyph_type & GLYPHTYPE_MCHAR_MASK) { + switch (char_type & GLYPHTYPE_MCHAR_MASK) { case MCHAR_TYPE_ZEROWIDTH: case MCHAR_TYPE_VOWEL: break; diff --git a/src/newgdi/textout.c b/src/newgdi/textout.c index 3edce224..505729f0 100644 --- a/src/newgdi/textout.c +++ b/src/newgdi/textout.c @@ -106,16 +106,16 @@ typedef struct _DRAW_GLYPHS_CTXT { int advance; } DRAW_GLYPHS_CTXT; -static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, unsigned int glyph_type) +static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, unsigned int char_type) { DRAW_GLYPHS_CTXT* ctxt = (DRAW_GLYPHS_CTXT*)context; int adv_x, adv_y; int bkmode; - if (check_zero_width(glyph_type)) { + if (check_zero_width(char_type)) { adv_x = adv_y = 0; } - else if (check_vowel(glyph_type)) { + else if (check_vowel(char_type)) { bkmode = GetBkMode (ctxt->hdc); //SetBkMode (ctxt->hdc, BM_TRANSPARENT); DrawGlyph (ctxt->hdc, ctxt->x, ctxt->y, glyph_value, &adv_x, &adv_y); @@ -163,16 +163,16 @@ typedef struct _TEXTOUT_CTXT } TEXTOUT_CTXT; static BOOL cb_textout (void* context, Glyph32 glyph_value, - unsigned int glyph_type) + unsigned int char_type) { TEXTOUT_CTXT* ctxt = (TEXTOUT_CTXT*)context; int adv_x, adv_y; int bkmode; - if (check_zero_width (glyph_type)) { + if (check_zero_width (char_type)) { adv_x = adv_y = 0; } - else if (check_vowel(glyph_type)) { + else if (check_vowel(char_type)) { if (!ctxt->only_extent) { bkmode = ctxt->pdc->bkmode; //ctxt->pdc->bkmode = BM_TRANSPARENT; @@ -326,7 +326,7 @@ typedef struct _TEXTOUTOMITTED_CTXT Uint32 max_extent; } TEXTOUTOMITTED_CTXT; -static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int glyph_type) +static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int char_type) { TEXTOUTOMITTED_CTXT* ctxt = (TEXTOUTOMITTED_CTXT*)context; int adv_x, adv_y; @@ -334,10 +334,10 @@ static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int //BBOX bbox; int bkmode = ctxt->pdc->bkmode; - if (check_zero_width(glyph_type)) { + if (check_zero_width(char_type)) { adv_x = adv_y = 0; } - else if (check_vowel(glyph_type)) { + else if (check_vowel(char_type)) { //ctxt->pdc->bkmode = BM_TRANSPARENT; _gdi_draw_one_glyph (ctxt->pdc, glyph_value, (ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT, @@ -463,7 +463,7 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len, size->cx = size->cy = 0; /* This function does not support BIDI */ - if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_glyph_type) + if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_char_type) return -1; _gdi_start_new_line(pdc); @@ -482,7 +482,7 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len, int i, dfi; DEVFONT* df; - glyph_value = (*mbc_devfont->charset_ops->char_glyph_value)(NULL, + glyph_value = (*mbc_devfont->charset_ops->get_char_value)(NULL, 0, (const unsigned char*)text, 0); dfi = 1; @@ -505,7 +505,7 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len, if ((len_cur_char = sbc_devfont->charset_ops->len_first_char ((const unsigned char*)text, left_bytes)) > 0) { - glyph_value = (*sbc_devfont->charset_ops->char_glyph_value)( + glyph_value = (*sbc_devfont->charset_ops->get_char_value)( NULL, 0, (const unsigned char*)text, 0); advance_cur_char = _gdi_get_glyph_advance (pdc, glyph_value, (pdc->ta_flags & TA_X_MASK) == TA_LEFT,