diff -U 3 -H -d -r -N -x .git -x .svn -- gnuplot-4.6.0/src/gplt_x11.c gnuplot-4.6.0.fonts2/src/gplt_x11.c --- gnuplot-4.6.0/src/gplt_x11.c 2011-12-28 23:00:37.000000000 +0100 +++ gnuplot-4.6.0.fonts2/src/gplt_x11.c 2012-03-15 12:10:52.600531888 +0100 @@ -104,15 +104,16 @@ * patches by Masahito Yamaga */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include #include #include #include #include #include #include -#ifdef USE_X11_MULTIBYTE -# include -#endif #include #include "syscfg.h" @@ -122,6 +123,12 @@ #include "gplt_x11.h" #include "version.h" +#ifdef USE_X11_MULTIBYTE +# include +# include +# include +#endif + #ifdef EXPORT_SELECTION # undef EXPORT_SELECTION #endif /* EXPORT SELECTION */ @@ -482,7 +489,7 @@ static char *FallbackFont = "fixed"; #ifdef USE_X11_MULTIBYTE static char *FallbackFontMB = - "mbfont:*-medium-r-normal--14-*;*-medium-r-normal--16-*"; + "mbfont:*-medium-r-normal--14-*,*-medium-r-normal--16-*"; # define FontSetSep ';' static int usemultibyte = 0; static int multibyte_fonts_usable=1; @@ -499,8 +506,8 @@ static int gpXGetFontascent __PROTO((XFontStruct *cfont)); enum set_encoding_id encoding = S_ENC_DEFAULT; /* EAM - mirrored from core code by 'QE' */ -static char default_font[64] = { '\0' }; -static char default_encoding[16] = { '\0' }; +static char default_font[256] = { '\0' }; +static char default_encoding[64] = { '\0' }; #define Nwidths 10 static unsigned int widths[Nwidths] = { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -2110,6 +2117,8 @@ /* Save the request default font */ c = &(buffer[strlen(buffer)-1]); while (*c <= ' ') *c-- = '\0'; + if (strlen(&buffer[2]) == 0) + break; strncpy(default_font, &buffer[2], strlen(&buffer[2])+1); FPRINTF((stderr, "gnuplot_x11: exec_cmd() set default_font to \"%s\"\n", default_font)); break; @@ -5389,7 +5398,7 @@ } #else if (first_time) { - fprintf(stderr,"gnuplot_x11: Some character sets not available\n"); + FPRINTF(("gnuplot_x11: Some character sets not available\n")); first_time = FALSE; } while (n_miss-- > 0) @@ -5484,6 +5493,18 @@ } #ifdef USE_X11_MULTIBYTE + if ((!fontname || !(*fontname)) && multibyte_fonts_usable) { + const char * codeset = nl_langinfo(CODESET); + if (strcasestr(codeset, "UTF-8")) { + const char* utf8 = "mbfont:-*-sazanami*mincho-medium-r-normal--16-* \ +-*-mincho-medium-r-normal--16-*,-*-verdana-medium-r-normal--16-* \ +-*-dejavu*sans-medium-r-normal--16-*,-*-medium-r-normal--16-*"; + strncpy(default_font, utf8, strlen(utf8)+1); + } + } +#endif + +#ifdef USE_X11_MULTIBYTE if (fontname && strncmp(fontname, "mbfont:", 7) == 0) { if (multibyte_fonts_usable) { usemultibyte = 1; diff -U 3 -H -d -r -N -x .git -x .svn -- gnuplot-4.6.0/src/variable.c gnuplot-4.6.0.fonts2/src/variable.c --- gnuplot-4.6.0/src/variable.c 2011-12-28 23:00:37.000000000 +0100 +++ gnuplot-4.6.0.fonts2/src/variable.c 2012-03-15 12:10:52.600531888 +0100 @@ -282,6 +282,8 @@ { "$`kpsexpand '$TEXMFDIST'`/fonts/type1!" }, #endif /* Linux paths */ + { "/usr/share/fonts/Type1" }, + { "/usr/share/fonts/truetype" }, { "/usr/X11R6/lib/X11/fonts/Type1" }, { "/usr/X11R6/lib/X11/fonts/truetype" }, /* HP-UX */