OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / main-x11.c
index 52be9f1..e481042 100644 (file)
@@ -126,7 +126,7 @@ char *XSetIMValues(XIM, ...); /* Hack for XFree86 4.0 */
 #include <X11/Xatom.h>
 #endif /* __MAKEDEPEND__ */
 
-
+#include <iconv.h>
 /*
  * Include some helpful X11 code.
  */
@@ -1665,8 +1665,21 @@ static errr Infofnt_text_std(int x, int y, cptr str, int len)
                                 Infokfnt->info, Infofnt->wid * 2);
 #else
 #ifdef USE_FONTSET
+
+               iconv_t cd = iconv_open("UTF-8", "EUC-JP");
+               size_t inlen = len;
+               size_t outlen = len * 2;
+               char *kanji = malloc(outlen);
+               char *sp; char *kp = kanji;
+               char sbuf[1024];
+               my_strcpy(sbuf, str, sizeof(sbuf));
+               sp = sbuf;
+               iconv(cd, &sp, &inlen, &kp, &outlen);
+               iconv_close(cd);
+
                XmbDrawImageString(Metadpy->dpy, Infowin->win, Infofnt->info,
-                                  Infoclr->gc, x, y, str, len);
+                               Infoclr->gc, x, y, kanji, kp-kanji);
+               free(kanji);
 #else
                XDrawImageString(Metadpy->dpy, Infowin->win, Infoclr->gc,
                                 x, y, str, len);
@@ -2290,8 +2303,9 @@ static bool paste_x11_send_text(XSelectionRequestEvent *rq)
        char buf[1024];
        char *list[1000];
        co_ord max, min;
-       int x,y,l,n;
-       byte a;
+       TERM_LEN x,y;
+       int l,n;
+       TERM_COLOR a;
        char c;
 
        /* Too old, or incorrect call. */
@@ -3082,7 +3096,7 @@ static errr Term_wipe_x11(int x, int y, int n)
 /*
  * Draw some textual characters.
  */
-static errr Term_text_x11(int x, int y, int n, byte a, cptr s)
+static errr Term_text_x11(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, cptr s)
 {
        /* Draw the text */
        Infoclr_set(clr[a]);
@@ -3103,14 +3117,14 @@ static errr Term_text_x11(int x, int y, int n, byte a, cptr s)
 /*
  * Draw some graphical characters.
  */
-static errr Term_pict_x11(int x, int y, int n, const byte *ap, const char *cp, const byte *tap, const char *tcp)
+static errr Term_pict_x11(TERM_LEN x, TERM_LEN y, int n, const TERM_COLOR *ap, const char *cp, const TERM_COLOR *tap, const char *tcp)
 {
        int i, x1, y1;
 
-       byte a;
+       TERM_COLOR a;
        char c;
 
-       byte ta;
+       TERM_COLOR ta;
        char tc;
 
        int x2, y2;