diff -u -r hanterm-xf331-p7/charproc.c p7x/charproc.c --- hanterm-xf331-p7/charproc.c Tue Dec 30 13:28:51 1997 +++ p7x/charproc.c Tue Feb 3 15:31:01 1998 @@ -131,6 +131,15 @@ int englift; int eng_ascent; int eng_descent; +#if !defined(NO_PATCH_HDRAWIMAGESTRING_BUG) /* by hanmaum 1998.2.3 */ +extern int font_ks_mode; +#endif +#if !defined(NO_PATCH_FONT_JOHABNZ) /* by hanmaum 1998.2.3 */ +extern int font_no_zero_width_char; +extern int font_minus_width_char_byte1; +extern int font_minus_width_char_byte2; +BOOL check_font_no_zero_width_char(); +#endif #endif #ifndef HANGUL @@ -4374,7 +4383,7 @@ if (flags & BOLD) { currentGC = NormalBoldGC(screen); #ifdef HANGUL - currentHGC = NormalGC(screen); + currentHGC = NormalHGC(screen); #endif } else { currentGC = NormalGC(screen); @@ -5158,10 +5167,16 @@ if( strstr(charset_registry,"KSC5601.1987-0") != NULL || strstr(charset_registry,"ksc5601.1987-0") != NULL ) { /* wansung font */ +#if !defined(NO_PATCH_HDRAWIMAGESTRING_BUG) /* by hanmaum 1998.2.3 */ + font_ks_mode = 0; +#endif convert_code_to_font = convert_ks_to_ksfont; } else if( strstr(charset_registry,"ksc5601.1987-1") != NULL || strstr(charset_registry,"KSC5601.1987-1") != NULL ) { /* wansung font */ +#if !defined(NO_PATCH_HDRAWIMAGESTRING_BUG) /* by hanmaum 1998.2.3 */ + font_ks_mode = 't'; +#endif convert_code_to_font = convert_ks_to_ks1font; } else if( strstr(charset_registry,"johab8") != NULL || strstr(charset_registry,"JOHAB8") != NULL) { @@ -5169,6 +5184,9 @@ } else if( strstr(charset_registry,"johab") != NULL || strstr(charset_registry,"JOHAB") != NULL) { /* johab font */ +#if !defined(NO_PATCH_FONT_JOHABNZ) /* by hanmaum 1998.3 */ + check_font_no_zero_width_char(hfs); +#endif convert_code_to_font = convert_ks_to_johabfont; } else { /* default */ @@ -5570,3 +5588,36 @@ #endif screen->cursoroutlineGC = new_cursoroutlineGC; } + +#if !defined(NO_PATCH_FONT_JOHABNZ) /* by hanmaum 1998.3 */ +/* +* Check whether the given johab font doesn't have zero width character +*/ +BOOL check_font_no_zero_width_char(hfs) + XFontStruct *hfs; +{ + if (hfs != NULL && hfs->per_char != NULL + && hfs->per_char[1].width != 0) { + register int i; + int char_num; + int minus_width = - hfs->per_char[1].width; + + char_num = (hfs->max_byte1 - hfs->min_byte1 + 1) + * (hfs->max_char_or_byte2 - hfs->min_char_or_byte2 + 1); + + for (i = char_num-1; i >= 0; i--) { + if (hfs->per_char[i].width == minus_width) { + font_no_zero_width_char = 1; + font_minus_width_char_byte1 = i + / (hfs->max_char_or_byte2 - hfs->min_char_or_byte2 + 1) + + hfs->min_byte1; + font_minus_width_char_byte2 = i + % (hfs->max_char_or_byte2 - hfs->min_char_or_byte2 + 1) + + hfs->min_char_or_byte2; + return TRUE; + } + } + } + return FALSE; +} +#endif diff -u -r hanterm-xf331-p7/hangul.c p7x/hangul.c --- hanterm-xf331-p7/hangul.c Tue Dec 30 14:52:43 1997 +++ p7x/hangul.c Tue Feb 3 15:35:19 1998 @@ -11,6 +11,15 @@ #include "xterm.h" #include +#if !defined(NO_PATCH_HDRAWIMAGESTRING_BUG) /* by hanmaum 1998.2.3 */ +extern int font_ks_mode; +#endif +#if !defined(NO_PATCH_FONT_JOHABNZ) /* by hanmaum 1998.2.3 */ +extern int font_no_zero_width_char; +extern int font_minus_width_char_byte1; +extern int font_minus_width_char_byte2; +#endif + int (*convert_3_to_code)(int f, int m, int l, unsigned char *des); int (*convert_code_to_font)(unsigned char *, XChar2b *, int); @@ -511,7 +520,6 @@ char *p; XGCValues values; - while (len > 0) { if (*str & 0x80) { if(screen->code == C_WANSUNG) @@ -521,9 +529,44 @@ for (p = str; len > 1 && (*p & 0x80); p += 2, len -= 2) ; n = convert_code_to_font((unsigned char *)str, buf, (int)(p - str)); if(n) { +#if !defined(NO_PATCH_HDRAWIMAGESTRING_BUG) /* by hanmaum 1998.2.3 */ + if (font_ks_mode == -1) { +#if !defined(NO_PATCH_HDRAWIMAGESTRING_FILL) /* by hanmaum 1998.2.3 */ + int hlen = (p-str)/2; + static XChar2b buf2[TEXT_BUF_SIZE]; + register int i; +/* static variable has zeros initially. + for (i = 0; i < hlen; i++) buf2[i].byte1 = buf2[i].byte2 = 0; +*/ + XDrawImageString16(d, w, hgc, x, y, buf2, hlen); +#else + int width, ascent, descent; + + width = (p - str) * FontWidth(screen); + ascent = (screen->ascent > screen->fnt_hangul->ascent) + ? screen->ascent : screen->fnt_hangul->ascent; + descent = (screen->descent > screen->fnt_hangul->descent) + ? screen->descent : screen->fnt_hangul->descent; + + XGetGCValues(d, hgc, GCBackground, &values); + XSetForeground(d, fillgc, values.background); + XFillRectangle(d, w, fillgc, x, y - ascent, + width, ascent + descent); +#endif + + XDrawString16(d, w, hgc, x, y, buf, n); + } + else +#endif XDrawImageString16(d, w, hgc, x, y, buf, n); -#if defined(DGUX_XSERVER) || defined(DGUX) + +/* end of modification */ +/***** by hanmaum 1998.2.3 + The below workaround is not needed if you apply the above buf2 patch by me + #if defined(DGUX_XSERVER) || defined(DGUX) +*****/ +#if defined(NO_PATCH_HDRAWIMAGESTRING_BUG) /* by hanmaum 1998.2.3 */ /* * In DGUX XServer, XDrawImageString16() with hangul johab fonts which * uses ASCENT area does not work. @@ -540,6 +583,9 @@ XDrawString16(d, w, hgc, x, y, buf, n); #endif width = (p - str) * FontWidth(screen); +#if !defined(NO_PATCH_HDRAWIMAGESTRING_FILL) /* by hanmaum 1998.2.3 */ + if (font_ks_mode != -1) { +#endif if (screen->ascent > screen->fnt_hangul->ascent) { XGetGCValues(d, hgc, GCBackground, &values); XSetForeground(d, fillgc, values.background); @@ -555,9 +601,13 @@ screen->descent - screen->fnt_hangul->descent); } +#if !defined(NO_PATCH_HDRAWIMAGESTRING_FILL) /* by hanmaum 1998.2.3 */ + } +#endif x += width; str = p; } + if (len <= 0) break; } p = str; #ifdef LINE_DRAW @@ -623,6 +673,7 @@ x += (p - str) * FontWidth(screen); str = p; } + if (len <= 0) break; } p = str; #ifdef LINE_DRAW @@ -1519,6 +1570,13 @@ /* ¤¡,¤» À϶§ Ưº°Ã³¸® */ break; } +#if !defined(NO_PATCH_FONT_JOHABNZ) /* by hanmaum 1998.2.3 */ + if (i > 0 && font_no_zero_width_char != 0) { + des[i].byte1 = font_minus_width_char_byte1; + des[i].byte2 = font_minus_width_char_byte2; + i++; + } +#endif des[i].byte1 = ind >> 8; des[i].byte2 = ind; i++; @@ -1527,14 +1585,27 @@ ind = l * 4 + lcon_map[m] + (l < 18 ? 397 : 393); /* l == 18 À϶§ ¾Æ¹«¹Þħµµ ¾Æ´Ï±â¶§¹®¿¡ Ưº° ó¸® */ +#if !defined(NO_PATCH_FONT_JOHABNZ) /* by hanmaum 1998.2.3 */ + if (i > 0 && font_no_zero_width_char != 0) { + des[i].byte1 = font_minus_width_char_byte1; + des[i].byte2 = font_minus_width_char_byte2; + i++; + } +#endif des[i].byte1 = ind >> 8; des[i].byte2 = ind; i++; } if (f != 1 && m == 2 && l == 1) { /* initial sound only? */ +#if !defined(NO_PATCH_FONT_JOHABNZ) /* by hanmaum 1998.2.3 */ + if (font_no_zero_width_char == 0) { +#endif des[i].byte1 = 0; /* dummy for no zero width */ des[i].byte2 = 0; i++; +#if !defined(NO_PATCH_FONT_JOHABNZ) /* by hanmaum 1998.2.3 */ + } +#endif } return i; } diff -u -r hanterm-xf331-p7/main.c p7x/main.c --- hanterm-xf331-p7/main.c Sun Dec 28 16:14:12 1997 +++ p7x/main.c Tue Feb 3 15:31:01 1998 @@ -1048,6 +1048,19 @@ Widget toplevel; Bool waiting_for_initial_map; +/* by hanmaum for X server which has some problems with zero width char font +/* : 1998.2.3 */ +#if defined(HANGUL) +#if !defined(NO_PATCH_HDRAWIMAGESTRING_BUG) /* by hanmaum 1998.2.3 */ +int font_ks_mode = -1; +#endif +#if !defined(NO_PATCH_FONT_JOHABNZ) /* by hanmaum 1998.2.3 */ +int font_no_zero_width_char = 0; +int font_minus_width_char_byte1 = 0; +int font_minus_width_char_byte2 = 0; +#endif +#endif + /* * DeleteWindow(): Action proc to implement ICCCM delete_window. */