forked from pool/gnuplot
011db28dee
Update to gnuplot 5.0.0 OBS-URL: https://build.opensuse.org/request/show/282275 OBS-URL: https://build.opensuse.org/package/show/Publishing/gnuplot?expand=0&rev=59
97 lines
3.2 KiB
Diff
97 lines
3.2 KiB
Diff
diff -p -u -r ../gnuplot-5.0.0.orig/src/gplt_x11.c src/gplt_x11.c
|
|
--- ../gnuplot-5.0.0.orig/src/gplt_x11.c 2014-12-15 05:24:07.000000000 +0100
|
|
+++ src/gplt_x11.c 2015-01-21 08:49:39.558763938 +0100
|
|
@@ -103,15 +103,16 @@ static char *RCSid() { return RCSid("$Id
|
|
* patches by Masahito Yamaga <ma@yama-ga.com>
|
|
*/
|
|
|
|
+#ifndef _GNU_SOURCE
|
|
+#define _GNU_SOURCE
|
|
+#endif
|
|
+#include <string.h>
|
|
#include <X11/Xos.h>
|
|
#include <X11/Xlib.h>
|
|
#include <X11/Xresource.h>
|
|
#include <X11/Xutil.h>
|
|
#include <X11/Xatom.h>
|
|
#include <X11/keysym.h>
|
|
-#ifdef USE_X11_MULTIBYTE
|
|
-# include <X11/Xlocale.h>
|
|
-#endif
|
|
#include <X11/XKBlib.h> /* for XkbKeycodeToKeysym */
|
|
|
|
#include <assert.h>
|
|
@@ -122,6 +123,12 @@ static char *RCSid() { return RCSid("$Id
|
|
#include "gplt_x11.h"
|
|
#include "version.h"
|
|
|
|
+#ifdef USE_X11_MULTIBYTE
|
|
+# include <locale.h>
|
|
+# include <langinfo.h>
|
|
+# include <X11/Xlocale.h>
|
|
+#endif
|
|
+
|
|
#ifdef EXPORT_SELECTION
|
|
# undef EXPORT_SELECTION
|
|
#endif /* EXPORT SELECTION */
|
|
@@ -523,8 +530,8 @@ static char *gpFallbackFont __PROTO((voi
|
|
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[196] = { '\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] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
@@ -2287,6 +2294,8 @@ exec_cmd(plot_struct *plot, char *comman
|
|
/* 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;
|
|
@@ -5757,7 +5766,7 @@ XFontStruct *gpXLoadQueryFont (Display *
|
|
}
|
|
#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)
|
|
@@ -5912,6 +5921,18 @@ char *fontname;
|
|
}
|
|
|
|
#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 -p -u -r ../gnuplot-5.0.0.orig/src/variable.c src/variable.c
|
|
--- ../gnuplot-5.0.0.orig/src/variable.c 2013-07-03 00:19:09.000000000 +0200
|
|
+++ src/variable.c 2015-01-21 08:47:20.056751038 +0100
|
|
@@ -282,6 +282,8 @@ static const struct path_table fontpath_
|
|
{ "$`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 */
|