]> Savannah Git Hosting - enscript.git/commitdiff

Savannah Git Hosting - enscript.git/commitdiff

git git@sv / enscript.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a356d34)
Flexible encoding and support of locale paper size
2018年1月23日 14:26:47 +0000 (15:26 +0100)
2018年3月17日 22:17:12 +0000 (18:17 -0400)
as well paper size names known by ghostscript

Signed-off-by: Werner Fink <werner@suse.de>
Signed-off-by: James Cloos <cloos@jhcloos.com>

diff --git a/configure.ac b/configure.ac
index d8659a5fa2107687a62f2aa34c9eb7ef03b8f9bf..dbb84d2f365c29b409da79716603398ce5c45f21 100644 (file)
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,23 @@ AC_ARG_WITH(media,
MEDIA=$ac_cv_value_media
AC_SUBST(MEDIA)
+dnl Define the default input encoding.
+AC_ARG_WITH(encoding,
+[ --with-encoding(=ENCODING) use input encoding (ENCODING), default is latin1],
+ if test "X$withval" != "Xno"; then
+ if test "X$withval" = "Xyes"; then
+ ac_cv_value_encoding='latin1'
+ else
+ ac_cv_value_encoding=$withval
+ fi
+ else
+ ac_cv_value_encoding=${ENCODING-latin1}
+ fi,
+ ac_cv_value_encoding=${ENCODING-latin1}
+)
+ENCODING=$ac_cv_value_encoding
+AC_SUBST(ENCODING)
+
dnl Find the printer spooler command.
AC_CHECK_PROG(SPOOLER, lpr, lpr)
@@ -142,6 +159,7 @@ echo ""
echo "Option Change with configure's option Current value"
echo "---------------------------------------------------------"
echo "Media --with-media=MEDIA $MEDIA"
+echo "Encoding --with-encoding=ENCODING $ENCODING"
echo "Spooler --with-spooler=SPOOLER $SPOOLER"
echo "PS level --with-ps-level=LEVEL $PSLEVEL"
echo ""
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 3ab98ce3ef15ddb689ddedd01658daa977299f6f..c533c387d8fb2f51cc5f73d3a21069b4d9c35eda 100644 (file)
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -35,6 +35,7 @@ EXTRA_DIST = ChangeLog.old enscript.cfg.in $(pkgdata_DATA) \
Makefile-encodings make-encoding.pl
do_subst = sed -e 's%@DATADIR@%$(datadir)%g' \
+ -e 's%@encoding@%@ENCODING@%g' \
-e 's%@media@%@MEDIA@%g' \
-e 's%@BINDIR@%$(bindir)%g' \
-e 's%@spooler@%@SPOOLER@%g' \
diff --git a/lib/enscript.cfg.in b/lib/enscript.cfg.in
index 837613ba7456111b97fe22b629b81fe716e7f236..10adb3ef26f850a00c8442764d6924f7807edb7c 100644 (file)
--- a/lib/enscript.cfg.in
+++ b/lib/enscript.cfg.in
@@ -40,7 +40,7 @@ AppendCtrlD: 0
Clean7Bit: 1
# Default input encoding.
-DefaultEncoding: latin1
+DefaultEncoding: @encoding@
# Default fancy header.
DefaultFancyHeader: enscript
@@ -94,6 +94,38 @@ Media: Letter 612 792 38 24 574 768
Media: A4dj 595 842 24 50 571 818
Media: Letterdj 612 792 24 40 588 768
+# Define ghostscript page names and their sizes
+Media: letter 612 792 24 24 574 768
+Media: note 540 720 24 24 516 696
+Media: legal 612 1008 24 24 588 984
+Media: a0 2380 3368 24 24 2356 3344
+Media: a1 1684 2380 24 24 1660 2356
+Media: a2 1190 1684 24 24 1166 1660
+Media: a3 842 1190 24 24 818 1166
+Media: a4 595 842 24 24 571 818
+Media: a5 421 595 24 24 397 571
+Media: a6 297 421 24 24 273 397
+Media: a7 210 297 24 24 186 273
+Media: a8 148 210 24 24 124 186
+Media: a9 105 148 24 24 81 124
+Media: a10 74 105 24 24 50 81
+Media: b0 2836 4008 24 24 2812 3984
+Media: b1 2004 2836 24 24 1980 2812
+Media: b2 1418 2004 24 24 1394 1980
+Media: b3 1002 1418 24 24 978 1394
+Media: b4 709 1002 24 24 685 978
+Media: b5 501 709 24 24 477 685
+Media: archE 2592 3456 24 24 2568 3432
+Media: archD 1728 2592 24 24 1704 2568
+Media: archC 1296 1728 24 24 1272 1704
+Media: archB 864 1296 24 24 840 1272
+Media: archA 648 864 24 24 624 840
+Media: flsa 612 936 24 24 588 912
+Media: flse 612 936 24 24 588 912
+Media: halfletter 396 612 24 24 372 588
+Media: 11x17 792 1224 24 24 768 1200
+Media: ledger 1224 792 24 24 1200 768
+
# Spooler option to suppress the job header.
NoJobHeaderSwitch: -h
diff --git a/src/main.c b/src/main.c
index a9175db83a82dd5600411c25eab29e7d641a6424..de6bc338c384caae73f72b6d447f095a6b8c7593 100644 (file)
--- a/src/main.c
+++ b/src/main.c
@@ -24,6 +24,8 @@
#include "gsint.h"
#include "getopt.h"
+#include <locale.h>
+#include <limits.h>
/*
* Prototypes for static functions.
@@ -956,6 +958,10 @@ main (int argc, char *argv[])
*/
#if HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
+#endif
+ setlocale (LC_CTYPE, "");
+#ifdef LC_PAPER
+ setlocale (LC_PAPER, "");
#endif
#endif
#if ENABLE_NLS
diff --git a/src/util.c b/src/util.c
index a3814c1b37bf5456807fab6a4908338a384cb06d..4fca6e4ddc12aed0717c9a75031bb8aa6d2b03a1 100644 (file)
--- a/src/util.c
+++ b/src/util.c
@@ -171,6 +171,16 @@ read_config (char *path, char *file)
{
token2 = GET_TOKEN (NULL);
CHECK_TOKEN ();
+#ifdef LC_PAPER
+ if (!strcasecmp("LC_PAPER", token2))
+ {
+ unsigned int paperheight = (unsigned int)nl_langinfo(_NL_PAPER_HEIGHT);
+ if (paperheight && paperheight == 279)
+ token2 = "letter";
+ else
+ token2 = "a4";
+ }
+#endif
xfree (media_name);
media_name = xstrdup (token2);
}
enscript
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /