Ключевые слова:rus, patch, postscript, (найти похожие документы)
Date: Thu, 07 Nov 2002 15:15:01 +0500
From: Fedor Zuev <[email protected]>
Newsgroups: ftn.ru.linux
Subject: русские буквы в EPS из Gnuplot
AVT>Когда Gnuplot графики на экране рисует, то русские буквы нормально выводится.
AVT>Перерисовываю график в EPS-формат, открываю его при помощи gv, русские буквы
AVT>"шифруются", то есть, в EPS одна кодировка, gv предполагает какую-то другую.
AVT>Вопрос: как правильно в гнуплоте использовать кириллические шрифты?
Патчить гнуплот.
Примерно так
-----------------cut gnuplot-koi8r.diff----
diff -urwBb gnuplot-3.7.1p1/docs/gnuplot.doc gnuplot-3.7.1p1.diff/docs/gnuplot.doc
- --- gnuplot-3.7.1p1/docs/gnuplot.doc Wed Oct 27 19:10:16 1999
+++ gnuplot-3.7.1p1.diff/docs/gnuplot.doc Sat Sep 15 03:04:11 2001
@@ -3689,7 +3689,8 @@
The `set encoding` command selects a character encoding. Valid values are
`default`, which tells a terminal to use its default; `iso_8859_1` (known in
the PostScript world as `ISO-Latin1`), which is used on many Unix workstations
- and with MS-Windows; `cp850`, for OS/2; and `cp437`, for MS-DOS.
+ and with MS-Windows; `koi8r`, popular Unix cyrillic encoding; `cp850`, for
+ OS/2; and `cp437`, for MS-DOS.
Syntax:
set encoding {<value>}
diff -urwBb gnuplot-3.7.1p1/docs/gnuplot.texi gnuplot-3.7.1p1.diff/docs/gnuplot.texi
- --- gnuplot-3.7.1p1/docs/gnuplot.texi Wed Oct 27 19:54:42 1999
+++ gnuplot-3.7.1p1.diff/docs/gnuplot.texi Sat Sep 15 03:03:26 2001
@@ -4986,10 +4986,11 @@
@opindex encoding
-The @ref{encoding} command selects a character encoding. Valid values are
-`default`, which tells a terminal to use its default; `iso_8859_1` (known in
-the PostScript world as `ISO-Latin1`), which is used on many Unix workstations
-and with MS-Windows; `cp850`, for OS/2; and `cp437`, for MS-DOS.
+The @ref{encoding} command selects a character encoding. Valid values
+are `default`, which tells a terminal to use its default; `iso_8859_1`
+(known in the PostScript world as `ISO-Latin1`), which is used on many
+Unix workstations and with MS-Windows; `koi8r`, popular Unix cyrillic
+encoding; `cp850`, for OS/2; and `cp437`, for MS-DOS.
Syntax:
@example
diff -urwBb gnuplot-3.7.1p1/set.c gnuplot-3.7.1p1.diff/set.c
- --- gnuplot-3.7.1p1/set.c Thu Aug 19 23:36:35 1999
+++ gnuplot-3.7.1p1.diff/set.c Sat Sep 15 01:32:11 2001
@@ -133,7 +133,7 @@
TBOOLEAN parametric = FALSE;
double pointsize = 1.0;
int encoding;
-char *encoding_names[] = { "default", "iso_8859_1", "cp437", "cp850", NULL };
+char *encoding_names[] = { "default", "iso_8859_1", "cp437", "koi8r" "cp850", NULL
};
TBOOLEAN polar = FALSE;
TBOOLEAN hidden3d = FALSE;
TBOOLEAN label_contours = TRUE; /* different linestyles are used for contours when
set */
@@ -1149,11 +1149,14 @@
} else if (almost_equals(c_token,"cp4$37")) {
c_token++;
encoding = ENCODING_CP_437;
+ } else if (almost_equals(c_token,"koi$8r")) {
+ c_token++;
+ encoding = ENCODING_KOI8_R;
} else if (almost_equals(c_token,"cp8$50")) {
c_token++;
encoding = ENCODING_CP_850;
} else {
- int_error("expecting one of 'default', 'iso_8859_1', 'cp437' or 'cp850'",
c_token);
+ int_error("expecting one of 'default', 'iso_8859_1', 'cp437','koi8r' or
'cp850'", c_token);
}
} else
return(FALSE); /* no command match */
diff -urwBb gnuplot-3.7.1p1/setshow.h gnuplot-3.7.1p1.diff/setshow.h
- --- gnuplot-3.7.1p1/setshow.h Sun Oct 4 05:17:47 1998
+++ gnuplot-3.7.1p1.diff/setshow.h Sat Sep 15 01:35:20 2001
@@ -179,7 +179,8 @@
#define ENCODING_DEFAULT 0
#define ENCODING_ISO_8859_1 1
#define ENCODING_CP_437 2
-#define ENCODING_CP_850 3 /* JFi */
+#define ENCODING_KOI8_R 3
+#define ENCODING_CP_850 4 /* JFi */
extern int encoding;
extern char *encoding_names[];
diff -urwBb gnuplot-3.7.1p1/term/post.trm gnuplot-3.7.1p1.diff/term/post.trm
- --- gnuplot-3.7.1p1/term/post.trm Thu Aug 19 23:16:33 1999
+++ gnuplot-3.7.1p1.diff/term/post.trm Sat Sep 15 01:40:19 2001
@@ -513,6 +513,9 @@
case ENCODING_CP_437:
recode = "reencodeCP437 def\n";
break;
+ case ENCODING_KOI8_R:
+ recode = "reencodeKOI8R def\n";
+ break;
case ENCODING_CP_850 :
recode = "reencodeCP850 def\n";
break;
@@ -765,6 +768,54 @@
"] def\n",
NULL };
+/* encoding for code page koi8r */
+/* */
+/* version 1.0: - Mainly letters are mapped. The following positions */
+/* (JFi) are left blank (undefined): */
+/* -- first 32 positions, */
+/* -- frame characters, */
+/* -- a few special characters. */
+/* */
+static char GPFAR * GPFAR PS_koi8r_encoding[] = {
+"/reencodeKOI8R {\n",
+"dup dup findfont dup length dict begin\n",
+"{ 1 index /FID ne { def }{ pop pop } ifelse } forall\n",
+"currentdict /CharStrings known {\n",
+"\tCharStrings /Idieresis known {\n",
+"\t\t/Encoding KOI8REncoding def } if\n} if\n",
+"currentdict end definefont\n",
+"} def\n",
+"/KOI8REncoding [\n",
+"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef",
+"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef",
+"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef",
+"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef",
+"/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright\n",
+"/parenleft/parenright/asterisk/plus/comma/minus/period/slash\n",
+"/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon\n",
+"/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N\n",
+"/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright\n",
+"/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m\n",
+"/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde/.notdef\n",
+"/.notdef/.notdef/.notdef/.notdef/guillmotleft/guillmotright/afii61352/.notdef",
+"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef",
+"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef",
+"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef",
+"/space/exclamdown/cent/afii10071/currency/yen/brokenbar/section",
+"/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron",
+"/degree/plusminus/twosuperior/afii10023/acute/mu/paragraph/bullet",
+"/cedilla/dotlessi/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown",
+"/afii10096/afii10065/afii10066/afii10088/afii10069/afii10070/afii10086/afii10068",
+"/afii10087/afii10074/afii10075/afii10076/afii10077/afii10078/afii10079/afii10080",
+"/afii10081/afii10097/afii10082/afii10083/afii10084/afii10085/afii10072/afii10067",
+"/afii10094/afii10093/afii10073/afii10090/afii10095/afii10091/afii10089/afii10092",
+"/afii10048/afii10017/afii10018/afii10040/afii10021/afii10022/afii10038/afii10020",
+"/afii10039/afii10026/afii10027/afii10028/afii10029/afii10030/afii10031/afii10032",
+"/afii10033/afii10049/afii10034/afii10035/afii10036/afii10037/afii10024/afii10019",
+"/afii10046/afii10045/afii10025/afii10042/afii10047/afii10043/afii10041/afii10044",
+"] def\n",
+NULL };
+
/* encoding for code page 850 */
/* */
/* version 1.0: - Mainly letters are mapped. The following positions */
@@ -859,6 +911,11 @@
fprintf(gpoutfile,"%s",PS_cp_437_encoding[i]);
}
}
+ if (uses_fonts && (encoding == ENCODING_KOI8_R)) { /* FZ */
+ for (i=0; PS_koi8r_encoding[i] != NULL; i++) {
+ fprintf(gpoutfile,"%s",PS_koi8r_encoding[i]);
+ }
+ }
if (uses_fonts && (encoding == ENCODING_CP_850)) { /* JFi */
for (i=0; PS_cp_850_encoding[i] != NULL; i++) {
fprintf(gpoutfile,"%s",PS_cp_850_encoding[i]);