forked from pool/transfig
156 lines
5.1 KiB
Plaintext
156 lines
5.1 KiB
Plaintext
|
---
|
||
|
fig2dev/dev/genps.c | 26 +++++++++++++++++++++++---
|
||
|
fig2dev/dev/genpstex.c | 8 ++++++--
|
||
|
fig2dev/dev/gensvg.c | 8 +++++---
|
||
|
fig2dev/fig2ps2tex.csh | 2 +-
|
||
|
fig2dev/getopt.c | 10 ++++++++++
|
||
|
transfig/transfig.c | 2 ++
|
||
|
6 files changed, 47 insertions(+), 9 deletions(-)
|
||
|
|
||
|
--- fig2dev/dev/genps.c
|
||
|
+++ fig2dev/dev/genps.c 2016-09-22 12:48:10.157220393 +0000
|
||
|
@@ -48,6 +48,7 @@
|
||
|
#include <pwd.h>
|
||
|
#endif
|
||
|
#include <locale.h>
|
||
|
+#include <langinfo.h>
|
||
|
|
||
|
/* for the xpm package */
|
||
|
#ifdef HAVE_X11_XPM_H
|
||
|
@@ -787,8 +788,9 @@ genps_start(F_compound *objects)
|
||
|
fprintf(tfp, "%s\n", SPLINE_PS);
|
||
|
#ifdef I18N
|
||
|
if (support_i18n && iso_text_exist(objects)) {
|
||
|
- char *libdir, *locale;
|
||
|
+ char *libdir, *locale, *codeset;
|
||
|
char localefile[512], str[512];
|
||
|
+ size_t llen;
|
||
|
FILE *fp;
|
||
|
libdir = getenv("FIG2DEV_LIBDIR");
|
||
|
#ifdef I18N_DATADIR
|
||
|
@@ -796,16 +798,34 @@ genps_start(F_compound *objects)
|
||
|
libdir = I18N_DATADIR;
|
||
|
#endif
|
||
|
locale = setlocale(LC_CTYPE, NULL);
|
||
|
+ llen = strcspn(locale, ".@");
|
||
|
+ codeset = nl_langinfo(CODESET);
|
||
|
if (locale == NULL) {
|
||
|
fprintf(stderr, "fig2dev: LANG not defined; assuming C locale\n");
|
||
|
locale = "C";
|
||
|
}
|
||
|
- sprintf(localefile, "%s/%s.ps", libdir, locale);
|
||
|
+ snprintf(localefile, sizeof(localefile)-1, "%s/%s.ps", libdir, locale);
|
||
|
/* get filename like ``/usr/local/lib/fig2dev/japanese.ps'' */
|
||
|
fp = fopen(localefile, "rb");
|
||
|
if (fp == NULL) {
|
||
|
fprintf(stderr, "fig2dev: can't open file: %s\n", localefile);
|
||
|
- } else {
|
||
|
+ }
|
||
|
+ if (fp == NULL && strlen(locale) != llen) {
|
||
|
+ locale[llen] = '\0';
|
||
|
+ /* get filename like ``/usr/local/lib/fig2dev/de_DE.ps'' */
|
||
|
+ snprintf(localefile, sizeof(localefile)-1, "%s/%s.ps", libdir, locale);
|
||
|
+ fp = fopen(localefile, "rb");
|
||
|
+ if (fp == NULL)
|
||
|
+ fprintf(stderr, "fig2dev: B can't open file: %s\n", localefile);
|
||
|
+ }
|
||
|
+ if (fp == NULL && codeset) {
|
||
|
+ /* get filename like ``/usr/local/lib/fig2dev/ISO-8859-9.ps'' */
|
||
|
+ snprintf(localefile, sizeof(localefile)-1, "%s/%s.ps", libdir, codeset);
|
||
|
+ fp = fopen(localefile, "rb");
|
||
|
+ if (fp == NULL)
|
||
|
+ fprintf(stderr, "fig2dev: C can't open file: %s\n", localefile);
|
||
|
+ }
|
||
|
+ if (fp) {
|
||
|
while (fgets(str, sizeof(str), fp)) {
|
||
|
if (strstr(str, "CompositeRoman")) enable_composite_font = true;
|
||
|
fputs(str, tfp);
|
||
|
--- fig2dev/dev/genpstex.c
|
||
|
+++ fig2dev/dev/genpstex.c 2016-09-22 12:51:47.193159929 +0000
|
||
|
@@ -37,6 +37,7 @@
|
||
|
* Jose Alberto.
|
||
|
*/
|
||
|
|
||
|
+#include <sys/stat.h>
|
||
|
#include "fig2dev.h"
|
||
|
#include "object.h"
|
||
|
#include "texfonts.h"
|
||
|
@@ -53,10 +54,13 @@ extern void
|
||
|
genps_spline(F_spline *s),
|
||
|
genlatex_option(char opt, char *optarg),
|
||
|
genlatex_text(F_text *t),
|
||
|
- genps_text(F_text *t);
|
||
|
+ genps_text(F_text *t),
|
||
|
+ genpdf_option(char opt, char *optarg),
|
||
|
+ genpdf_start(F_compound *objects);
|
||
|
extern int
|
||
|
genlatex_end(void),
|
||
|
- genps_end(void);
|
||
|
+ genps_end(void),
|
||
|
+ genpdf_end(void);
|
||
|
|
||
|
extern void genpdf_option(char opt, char *optarg); /* genpdf.c */
|
||
|
extern void genpdf_start(F_compound *objects); /* genpdf.c */
|
||
|
--- fig2dev/dev/gensvg.c
|
||
|
+++ fig2dev/dev/gensvg.c 2016-09-22 12:54:57.341602013 +0000
|
||
|
@@ -800,9 +800,11 @@ gensvg_text(F_text *t)
|
||
|
x, y, degrees(t->angle));
|
||
|
x = y = 0;
|
||
|
}
|
||
|
- fprintf(tfp, "<text xml:space=\"preserve\" x=\"%d\" y=\"%d\" fill=\"#%6.6x\" font-family=\"%s\" "\
|
||
|
- "font-style=\"%s\" font-weight=\"%s\" font-size=\"%d\" text-anchor=\"%s\">",
|
||
|
- x, y, rgbColorVal(t->color), family[t->font / 4],
|
||
|
+ fprintf(tfp,
|
||
|
+ "<text xml:space=\"preserve\" x=\"%d\" y=\"%d\" fill=\"#%6.6x\" font-family=\"%s\" ",
|
||
|
+ x, y, rgbColorVal(t->color), family[t->font / 4]);
|
||
|
+ fprintf(tfp,
|
||
|
+ "font-style=\"%s\" font-weight=\"%s\" font-size=\"%d\" text-anchor=\"%s\">",
|
||
|
( (t->font % 2 == 0 || t->font >31) ? "normal" : "italic"),
|
||
|
( (t->font % 4 < 2 || t->font >31) ? "normal" : "bold"), (int) (ceil(t->size * 12 * mag)),
|
||
|
anchor[t->type]);
|
||
|
--- fig2dev/fig2ps2tex.csh
|
||
|
+++ fig2dev/fig2ps2tex.csh 2016-09-22 12:58:21.805775751 +0000
|
||
|
@@ -21,7 +21,7 @@
|
||
|
#
|
||
|
# 2016-07-07 Thomas Loimer
|
||
|
# * use here-document, instead of echo
|
||
|
-
|
||
|
+set echo_style=bsd
|
||
|
set bbox = `grep "^%%BoundingBox:" $1`
|
||
|
|
||
|
set xsp = `echo "3k $bbox[4] $bbox[2] - 72 / p" | dc`
|
||
|
--- fig2dev/getopt.c
|
||
|
+++ fig2dev/getopt.c 2016-09-22 13:00:51.710970183 +0000
|
||
|
@@ -45,6 +45,7 @@ static char sccsfid[] = "@(#) getopt.c 5
|
||
|
#define EMSG ""
|
||
|
#define ENDARGS "--"
|
||
|
|
||
|
+#ifndef __GLIBC__
|
||
|
/*
|
||
|
* get option letter from argument vector
|
||
|
*/
|
||
|
@@ -89,3 +90,12 @@ fig_getopt(int nargc, char **nargv, char
|
||
|
}
|
||
|
return(optc); /* dump back option letter */
|
||
|
}
|
||
|
+#else
|
||
|
+#include <unistd.h>
|
||
|
+int
|
||
|
+fig_getopt(int nargc, char * const nargv[], const char *ostr)
|
||
|
+{
|
||
|
+ return getopt(nargc, nargv, ostr);
|
||
|
+}
|
||
|
+#endif
|
||
|
+
|
||
|
--- transfig/transfig.c
|
||
|
+++ transfig/transfig.c 2016-09-22 13:02:04.917599987 +0000
|
||
|
@@ -26,6 +26,8 @@
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
+#include <string.h>
|
||
|
+#include <unistd.h>
|
||
|
#include "transfig.h"
|
||
|
|
||
|
extern void sysmv(char *file); /* sys.c */
|