summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2018-07-14 13:43:35 +0200
committerDidier Raboud <odyx@debian.org>2018-07-11 11:29:27 +0200
commite558ccd54310b60ccf73ce98280b26df38ed42ce (patch)
treeff80dddaf431b2e548183af90114a7d1b70b4fce /filter
parent8dffdabb54892e19aaf8c400e7127115e8b4a1ca (diff)
New upstream version 1.20.4
Diffstat (limited to 'filter')
-rw-r--r--filter/braille/drivers/common/fr-braille.po69
-rwxr-xr-xfilter/braille/drivers/generic/brftoembosser.in27
-rwxr-xr-xfilter/braille/drivers/index/imageubrltoindexv3.in5
-rwxr-xr-xfilter/braille/drivers/index/imageubrltoindexv4.in5
-rw-r--r--filter/braille/drivers/index/index.defs74
-rw-r--r--filter/braille/drivers/index/index.sh.in53
-rw-r--r--filter/braille/drivers/index/indexv3.sh.in11
-rw-r--r--filter/braille/drivers/index/indexv4.sh.in14
-rwxr-xr-xfilter/braille/drivers/index/textbrftoindexv3.in39
-rw-r--r--filter/braille/filters/braille.defs90
-rwxr-xr-xfilter/braille/filters/brftopagedbrf.in19
-rw-r--r--filter/braille/filters/cups-braille.sh.in95
-rwxr-xr-xfilter/braille/filters/imagetobrf.in6
-rw-r--r--filter/braille/filters/liblouis1.defs.gen.in1
-rw-r--r--filter/braille/filters/musicxmltobrf.in6
-rwxr-xr-xfilter/braille/filters/texttobrf.in122
-rw-r--r--filter/braille/filters/vectortobrf.in6
-rw-r--r--filter/gstoraster.c40
-rw-r--r--filter/pdftoopvp/OPVPOutputDev.cxx2
-rw-r--r--filter/pdftopdf/pdftopdf.cc22
-rw-r--r--filter/pdftopdf/pdftopdf_processor.cc2
-rw-r--r--filter/pdftopdf/pdftopdf_processor.h3
22 files changed, 429 insertions, 282 deletions
diff --git a/filter/braille/drivers/common/fr-braille.po b/filter/braille/drivers/common/fr-braille.po
index 3f0181d4f..81da3c1ec 100644
--- a/filter/braille/drivers/common/fr-braille.po
+++ b/filter/braille/drivers/common/fr-braille.po
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015, 2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015, 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,7 @@ msgid "Braille embosser"
msgstr "Embosseuse braille"
msgid "A4 Tractor Feed"
-msgstr "A4 Traction papier"
+msgstr "A4 papier listing"
msgid "Yes"
msgstr "Oui"
@@ -41,7 +41,7 @@ msgid "Braille transcription"
msgstr "Transcription Braille"
msgid "None"
-msgstr "Aucune"
+msgstr "Aucun(e)"
msgid "Additional Braille transcription (2)"
msgstr "Transcription Braille additionnelle (2)"
@@ -67,6 +67,9 @@ msgstr "Par défaut pour la langue grade 2"
msgid "Default for language grade 3"
msgstr "Par défaut pour la langue grade 3"
+msgid "Default hyphenation rules for language"
+msgstr "Règles de césure par défaut pour la langue"
+
msgid "Text dot distance"
msgstr "Distance points texte"
@@ -112,6 +115,33 @@ msgstr "Marge graphique gauche"
msgid "Graphical right margin"
msgstr "Marge graphique droite"
+msgid "Braille Page Number"
+msgstr "Numéro de page braille"
+
+msgid "Print Page Number"
+msgstr "Numéro de page noir"
+
+msgid "Top Margin"
+msgstr "Marge en haut"
+
+msgid "Bottom Margin"
+msgstr "Marge en bas"
+
+msgid "Top Inline"
+msgstr "Intégré en haut"
+
+msgid "Bottom Inline"
+msgstr "Intégré en bas"
+
+msgid "Print Page Separator"
+msgstr "Montrer les séparations de pages"
+
+msgid "Print Page Number in Separator"
+msgstr "Indiquer le numéro de page dans la séparation"
+
+msgid "Prefix Print Page Number with Braille Page Number"
+msgstr "Préfixer le numéro de page noir avec le numéro de page braille"
+
msgid "Image conversion"
msgstr "Conversion d'image"
@@ -190,32 +220,23 @@ msgstr "11.03.2 ou supérieur"
msgid "12.01.3 or above"
msgstr "12.01.3 ou supérieur"
-msgid "Page folding"
-msgstr "Recto-Verso"
-
-msgid "Single-sided"
-msgstr "Recto seul"
-
-msgid "Double-sided"
-msgstr "Recto-Verso"
-
-msgid "Single-sided z-folding"
-msgstr "Recto seul, pliage Z"
+msgid "Double-Sided Printing"
+msgstr "Impression recto-verso"
-msgid "Double-sided z-folding"
-msgstr "Recto-Verso, pliage Z"
+msgid "Off"
+msgstr "Désactivé"
-msgid "Single-sided sideways z-folding"
-msgstr "Recto seul paysage, pliage Z"
+msgid "Long Edge (Standard)"
+msgstr "Bord long (standard)"
-msgid "Double-sided sideways z-folding"
-msgstr "Recto-Verso paysage, pliage Z"
+msgid "Z-Folding"
+msgstr "Pliage accordéon"
-msgid "Double-sided saddle stitch 4 pages"
-msgstr "Recto-Verso cahier 4 pages"
+msgid "Sideways Folding"
+msgstr "Pliage paysage"
-msgid "Single-sided saddle stitch 4 pages"
-msgstr "Recto cahier 4 pages"
+msgid "Saddle Stich 4 pages"
+msgstr "Cahier 4 pages"
msgid "Firmware Braille Table"
msgstr "Table Braille Firmware"
diff --git a/filter/braille/drivers/generic/brftoembosser.in b/filter/braille/drivers/generic/brftoembosser.in
index d2aea9648..029b3ec08 100755
--- a/filter/braille/drivers/generic/brftoembosser.in
+++ b/filter/braille/drivers/generic/brftoembosser.in
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2015, 2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015, 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -47,33 +47,14 @@ fi
SENDFF=$(getOption SendFF)
SENDSUB=$(getOption SendSUB)
-TOPMARGIN=$(getOptionNumber TopMargin)
-LEFTMARGIN=$(getOptionNumber LeftMargin)
-
echo "INFO: Writing text to generic embosser" >&2
while [ $NB -gt 0 ]
do
- # Produce top margin
- if [ -n "$TOPMARGIN" ]; then
- while [ $TOPMARGIN -gt 0 ]
- do
- echo
- TOPMARGIN=$(($TOPMARGIN - 1))
- done
- fi
- LEFTSPACES=""
- if [ -n "$LEFTMARGIN" ]; then
- while [ $LEFTMARGIN -gt 0 ]
- do
- LEFTSPACES="$LEFTSPACES "
- LEFTMARGIN=$(($LEFTMARGIN - 1))
- done
- fi
-
< "$FILE" \
- sed -e "s/^/$LEFTSPACES/" \
- -e 's/^$/'$'\015''/' \
+ sed -e 's/^$/'$'\015''/' \
+ -e 's/'$'\302'$'\240''/ /g' \
+ -e 's/'$'\240''/ /g' \
-e 's/\([^'$'\015'']\)$/\1'$'\015''/'
if [ "$SENDFF" = True ]
diff --git a/filter/braille/drivers/index/imageubrltoindexv3.in b/filter/braille/drivers/index/imageubrltoindexv3.in
index 8294ff1b9..7e14f95a5 100755
--- a/filter/braille/drivers/index/imageubrltoindexv3.in
+++ b/filter/braille/drivers/index/imageubrltoindexv3.in
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2015-2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -34,9 +34,6 @@ NB=$4
OPTIONS=$5
FILE=$6
-# Disable margins, they are done by imagemagick before this
-NOMARGIN=1
-
. @CUPS_DATADIR@/braille/indexv3.sh
printf "$INIT"
diff --git a/filter/braille/drivers/index/imageubrltoindexv4.in b/filter/braille/drivers/index/imageubrltoindexv4.in
index b2b24d5c4..0afc1b230 100755
--- a/filter/braille/drivers/index/imageubrltoindexv4.in
+++ b/filter/braille/drivers/index/imageubrltoindexv4.in
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2015-2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -34,9 +34,6 @@ NB=$4
OPTIONS=$5
FILE=$6
-# Disable margins, they are done by imagemagick before this
-NOMARGIN=1
-
. @CUPS_SERVERBIN@/filter/indexv4.sh
printf "$INIT"
diff --git a/filter/braille/drivers/index/index.defs b/filter/braille/drivers/index/index.defs
index 7a4e41fa8..615b1630a 100644
--- a/filter/braille/drivers/index/index.defs
+++ b/filter/braille/drivers/index/index.defs
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2015-2016 Samuel Thibault <samuel.thibault@ens-lyon.org>
+// Copyright (c) 2015-2016, 2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -39,10 +39,6 @@ MediaSize 120x120
ColorDevice no
Group "Index/Index support"
- Option "IndexFolding/Page folding" PickOne AnySetup 10
- Choice "Single/Single-sided" ""
- *Choice "Double/Double-sided" ""
-
Option "IndexMultipleImpact/Multiple Impact" PickOne AnySetup 10
*Choice "1" ""
Choice "2" ""
@@ -55,71 +51,3 @@ Group "Braille"
Choice "2/User-defined Table 2" ""
Choice "3/User-defined Table 3" ""
Choice "4/User-defined Table 4" ""
-
-Option "TopMargin/Top margin" PickOne AnySetup 10
- Choice "0" ""
- Choice "1" ""
- *Choice "2" ""
- Choice "3" ""
- Choice "4" ""
- Choice "5" ""
- Choice "6" ""
- Choice "7" ""
- Choice "8" ""
- Choice "9" ""
- Choice "10" ""
-
-Option "BottomMargin/Bottom margin" PickOne AnySetup 10
- Choice "0" ""
- Choice "1" ""
- *Choice "2" ""
- Choice "3" ""
- Choice "4" ""
- Choice "5" ""
- Choice "6" ""
- Choice "7" ""
- Choice "8" ""
- Choice "9" ""
- Choice "10" ""
-
-Option "InnerMargin/Inner margin" PickOne AnySetup 10
- Choice "0" ""
- Choice "1" ""
- *Choice "2" ""
- Choice "3" ""
- Choice "4" ""
- Choice "5" ""
- Choice "6" ""
- Choice "7" ""
- Choice "8" ""
- Choice "9" ""
- Choice "10" ""
-
-Option "OuterMargin/Outer margin" PickOne AnySetup 10
- Choice "0" ""
- Choice "1" ""
- *Choice "2" ""
- Choice "3" ""
- Choice "4" ""
- Choice "5" ""
- Choice "6" ""
- Choice "7" ""
- Choice "8" ""
- Choice "9" ""
- Choice "10" ""
-
-Option "PageNumber/Page Number" PickOne AnySetup 10
- Choice "None/None" ""
- Choice "Top/Top-middle" ""
- Choice "TopLeft/Top-left" ""
- Choice "TopRight/Top-right" ""
- Choice "Bottom/Bottom-middle" ""
- Choice "BottomLeft/Bottom-left" ""
- Choice "BottomRight/Bottom-right" ""
-
-UIConstraints "*TopMargin 0 *PageNumber Top"
-UIConstraints "*TopMargin 0 *PageNumber TopLeft"
-UIConstraints "*TopMargin 0 *PageNumber TopRight"
-UIConstraints "*BottomMargin 0 *PageNumber Bottom"
-UIConstraints "*BottomMargin 0 *PageNumber BottomLeft"
-UIConstraints "*BottomMargin 0 *PageNumber BottomRight"
diff --git a/filter/braille/drivers/index/index.sh.in b/filter/braille/drivers/index/index.sh.in
index e300313a2..76163a47a 100644
--- a/filter/braille/drivers/index/index.sh.in
+++ b/filter/braille/drivers/index/index.sh.in
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015-2016 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2016, 2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -25,10 +25,20 @@
. @CUPS_DATADIR@/braille/cups-braille.sh
FIRMWARE=$(getOptionNumber IndexFirmwareVersion)
-FOLDING=$(getOption IndexFolding)
+[ $? = 0 ] || exit 1
+DUPLEX=$(getOption Duplex)
+[ -n "$DUPLEX" ] || DUPLEX=None
+ZFOLDING=$(getOption ZFolding)
+[ -n "$ZFOLDING" ] || ZFOLDING=False
+SIDEWAYS=$(getOption SideWays)
+[ -n "$SIDEWAYS" ] || SIDEWAYS=False
+SADDLESTITCH=$(getOption SaddleStitch)
+[ -n "$SADDLESTITCH" ] || SADDLESTITCH=False
TABLE=$(getOptionNumber IndexTable)
+[ $? = 0 ] || exit 1
MULTIPLEIMPACT=$(getOptionNumber IndexMultipleImpact)
-PAGENUMBER=$(getOption PageNumber)
+[ $? = 0 ] || exit 1
+HWPAGENUMBER=$(getOption HardwarePageNumber)
# Convert from 100th of mm to Inch fraction
mmToIndexIn () {
@@ -82,17 +92,25 @@ commonOptions() {
INIT+=,MI$MULTIPLEIMPACT
- # Support page folding
- case "$FOLDING" in
- Single) INIT+=,DP1 ;;
- Double) INIT+=,DP2 ;;
- SingleZ) INIT+=,DP5 ;;
- DoubleZ) INIT+=,DP3 ;;
- DoubleS) INIT+=,DP4 ;;
- SingleSZ) INIT+=,DP7 ;;
- DoubleSZ) INIT+=,DP6 ;;
- SingleS) INIT+=,DP8 ;;
- *) printf "ERROR: unsupported '%s' page folding\n" "$FOLDING" >&2 ; exit 1 ;;
+ case "$DUPLEX" in
+ None|DuplexNoTumble) ;;
+ *) printf "ERROR: duplex mode %s is not supported\n" "$DUPLEX" >&2 ; exit 1;;
+ esac
+
+ case "$DUPLEX,$ZFOLDING,$SADDLESTITCH,$SIDEWAYS" in
+ None,False,False,False) INIT+=,DP1 ;; # Single Sided
+ DuplexNoTumble,False,False,False) INIT+=,DP2 ;; # Double Sided
+
+ DuplexNoTumble,True,False,False) INIT+=,DP3 ;; # Double Sided z-folding
+ None,True,False,False) INIT+=,DP5 ;; # Single Sided z-folding
+
+ DuplexNoTumble,False,True,False) INIT+=,DP4 ;; # Double Sided Saddle Stitch
+ None,False,True,False) INIT+=,DP8 ;; # Single Sided Saddle Stitch
+
+ DuplexNoTumble,True,False,True) INIT+=,DP6 ;; # Double Sided z-folding sideways
+ None,True,False,True) INIT+=,DP7 ;; # Single Sided z-folding sideways
+
+ *) printf "ERROR: unsupported page folding: duplex=%s z-folding=%s sideways=%s saddlestich=%s\n" "$DUPLEX" "$ZFOLDING" "$SIDEWAYS" "$SADDLESTITCH" >&2 ; exit 1 ;;
esac
# Configure dots spacing
@@ -109,15 +127,16 @@ commonOptions() {
*) printf "ERROR: unsupported '%s' graphic dot distance\n" "$GRAPHICDOTDISTANCE" >&2 ; exit 1 ;;
esac
- case "$PAGENUMBER" in
- None) INIT+=,PN0 ;;
+ # Currently unused, implemented in software
+ case "$HWPAGENUMBER" in
+ None|'') INIT+=,PN0 ;;
Top) INIT+=,PN1 ;;
TopLeft) INIT+=,PN2 ;;
TopRight) INIT+=,PN3 ;;
Bottom) INIT+=,PN4 ;;
BottomLeft) INIT+=,PN5 ;;
BottomRight) INIT+=,PN6 ;;
- *) echo "ERROR: unsupported $PAGENUMBER page number" >&2 ; exit 1 ;;
+ *) printf "ERROR: unsupported %s page number\n" "$HWPAGENUMBER" >&2 ; exit 1 ;;
esac
echo "$INIT"
diff --git a/filter/braille/drivers/index/indexv3.sh.in b/filter/braille/drivers/index/indexv3.sh.in
index 0597b3c6e..afc8d79cf 100644
--- a/filter/braille/drivers/index/indexv3.sh.in
+++ b/filter/braille/drivers/index/indexv3.sh.in
@@ -32,20 +32,15 @@ then
# Firmware 10.30 and above support temporary parameters
INIT=$'\033'D
- if [ -z "$NOMARGIN" ]
- then
- # Configure margins
- INIT+=TM$TOPMARGIN,BM$BOTTOMMARGIN,IM$INNERMARGIN,OM$OUTERMARGIN
- else
- # disable margins
- INIT+=TM0,BM0,IM0,OM0
- fi
+ # Margins are implemented in software
+ INIT+=TM0,BI0
# Trying to disable banner page seems to pose problems
#INIT+=,BP
# Common options
INIT+="$(commonOptions)"
+ [ $? = 0 ] || exit 1
# Paper size
case "$PAPERLENGTH" in
diff --git a/filter/braille/drivers/index/indexv4.sh.in b/filter/braille/drivers/index/indexv4.sh.in
index 358680ed6..6b01dfc3a 100644
--- a/filter/braille/drivers/index/indexv4.sh.in
+++ b/filter/braille/drivers/index/indexv4.sh.in
@@ -29,21 +29,15 @@ then
# Firmware 10.30 and above support temporary parameters
INIT=$'\033'D
- if [ -z "$NOMARGIN" ]
- then
- # Configure margins
- INIT+=TM$TOPMARGIN,BI$INNERMARGIN
- else
- # disable margins
- INIT+=TM0,BI0
- fi
-
+ # Margins are implemented in software
+ INIT+=TM0,BI0
# Common options
INIT+="$(commonOptions)"
+ [ $? = 0 ] || exit 1
# Paper size
- INIT+=,CH$TEXTWIDTH,LP$TEXTHEIGHT
+ INIT+=,CH$PRINTABLETEXTWIDTH,LP$PRINTABLETEXTHEIGHT
case $LINESPACING in
500) INIT+=,LS50 ;;
diff --git a/filter/braille/drivers/index/textbrftoindexv3.in b/filter/braille/drivers/index/textbrftoindexv3.in
index 8ec0a1fb7..2e9e431cb 100755
--- a/filter/braille/drivers/index/textbrftoindexv3.in
+++ b/filter/braille/drivers/index/textbrftoindexv3.in
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2015-2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -57,12 +57,17 @@ then
else
cat "$FILE"
fi | (
- while IFS=$'\n' read -r LINE
+ IFS=$'\n' read -r LINE
+ EOF=$?
+ while [ "$EOF" = 0 -o -n "$LINE" ]
do
# Strip CRs
LINE=${LINE//$'\015'}
# Ignore SUBs
LINE=${LINE//$'\032'}
+ # Turn non-breakable spaces into spaces
+ LINE=${LINE//$'\302'$'\240'/ }
+ LINE=${LINE//$'\240'/ }
# Interpret FFs
while [ -n "$LINE" -a -z "${LINE/#$'\014'*}" ]
@@ -74,15 +79,13 @@ then
# Make sure there is nothing else we don't process
if [ -n "$LINE" ]
then
- if [ -z "${LINE/*[$'\001'-$'\037'$'\177']*}" ]
+ if [ -z "${LINE/*[$'\000'-$'\037'$'\177']*}" ]
then
echo "ERROR: unsupported control character in BRF file" >&2
- exit 1
fi
if [ -z "${LINE/*[$'\200'-$'\377']*}" ]
then
echo "ERROR: unsupported non-ASCII character in BRF file" >&2
- exit 1
fi
fi
@@ -99,12 +102,32 @@ then
then
# Enter transparent mode for $CHARS characters
printf "\\033\\\\\\x$(printf %02x $CHARS)\\x00"
- # Echo those $CHARS characters
- printf %s "$LINE" | tr " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_{}|~\`abcdefghijklmnopqrstuvwxyz" "\\0V tSQW"$'\004'"gvAT@DP"$'\024'"d"$'\002\006'"\"bB&fF\$a\`Cw4q"$'\020\001\003\021'"1!"$'\023'"3#"$'\022'"2"$'\005\007\025'"5%"$'\027'"7'"$'\026'"6EGrUueRcs0pRsc0"$'\020\001\003\021'"1!"$'\023'"3#"$'\022'"2"$'\005\007\025'"5%"$'\027'"7'"$'\026'"6EGrUue"
+ # Echo those $CHARS characters.
+ # First normalize BRF characters (`a-z{|}~ are non-standard).
+ # Drop unicode patterns with dots 7 or 8 in case the liblouis table happened to erroneously emit one
+ # Drop remaining erroneous multibyte characters
+ # Drop remaining erroneous 1-byte characters
+ # Then turn it into Index 6dots sequences.
+ printf %s "$LINE" | \
+ tr "\`a-z{|}~" "@A-Z\\[\\\\]_" | \
+ sed -e 's/[⡀⡁⡂⡃⡄⡅⡆⡇⡈⡉⡊⡋⡌⡍⡎⡏⡐⡑⡒⡓⡔⡕⡖⡗⡘⡙⡚⡛⡜⡝⡞⡟⡠⡡⡢⡣⡤⡥⡦⡧⡨⡩⡪⡫⡬⡭⡮⡯⡰⡱⡲⡳⡴⡵⡶⡷⡸⡹⡺⡻⡼⡽⡾⡿⢀⢁⢂⢃⢄⢅⢆⢇⢈⢉⢊⢋⢌⢍⢎⢏⢐⢑⢒⢓⢔⢕⢖⢗⢘⢙⢚⢛⢜⢝⢞⢟⢠⢡⢢⢣⢤⢥⢦⢧⢨⢩⢪⢫⢬⢭⢮⢯⢰⢱⢲⢳⢴⢵⢶⢷⢸⢹⢺⢻⢼⢽⢾⢿⣀⣁⣂⣃⣄⣅⣆⣇⣈⣉⣊⣋⣌⣍⣎⣏⣐⣑⣒⣓⣔⣕⣖⣗⣘⣙⣚⣛⣜⣝⣞⣟⣠⣡⣢⣣⣤⣥⣦⣧⣨⣩⣪⣫⣬⣭⣮⣯⣰⣱⣲⣳⣴⣵⣶⣷⣸⣹⣺⣻⣼⣽⣾⣿]/ /g' | \
+ sed -e "s/[^] \!\"#$%&'()*+,.\\/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\\\^_[-]/ /g" | \
+ tr "\000-\037\177\200-\377" " " | \
+ tr " \!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[\\\\\\]^_" "\\0V tSQW"$'\004'"gvAT@DP"$'\024'"d"$'\002\006'"\"bB&fF\$a\`Cw4q"$'\020\001\003\021'"1!"$'\023'"3#"$'\022'"2"$'\005\007\025'"5%"$'\027'"7'"$'\026'"6EGrUueRcs0p"
fi
- printf "\\r\\n"
+ if [ "$EOF" = 0 ]
+ then
+ printf "\\r\\n"
+ fi
+ IFS=$'\n' read -r LINE
+ EOF=$?
done
)
+ if [ $? != 0 ]
+ then
+ printf '\032'
+ exit 1
+ fi
else
# not software-translated, send to printer as such
echo "INFO: Writing text to Index embosser" >&2
diff --git a/filter/braille/filters/braille.defs b/filter/braille/filters/braille.defs
index 43d93de30..5047e84ba 100644
--- a/filter/braille/filters/braille.defs
+++ b/filter/braille/filters/braille.defs
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2015, 2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+// Copyright (c) 2015, 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -42,3 +42,91 @@ Option "LineSpacing/Line spacing" PickOne AnySetup 10
Choice "550/5.5mm" ""
Choice "750/7.5mm" ""
Choice "1000/10.0mm" ""
+
+Option "TopMargin/Top margin" PickOne AnySetup 10
+ Choice "0" ""
+ Choice "1" ""
+ *Choice "2" ""
+ Choice "3" ""
+ Choice "4" ""
+ Choice "5" ""
+ Choice "6" ""
+ Choice "7" ""
+ Choice "8" ""
+ Choice "9" ""
+ Choice "10" ""
+
+Option "BottomMargin/Bottom margin" PickOne AnySetup 10
+ Choice "0" ""
+ Choice "1" ""
+ *Choice "2" ""
+ Choice "3" ""
+ Choice "4" ""
+ Choice "5" ""
+ Choice "6" ""
+ Choice "7" ""
+ Choice "8" ""
+ Choice "9" ""
+ Choice "10" ""
+
+Option "LeftMargin/Left margin" PickOne AnySetup 10
+ Choice "0" ""
+ Choice "1" ""
+ *Choice "2" ""
+ Choice "3" ""
+ Choice "4" ""
+ Choice "5" ""
+ Choice "6" ""
+ Choice "7" ""
+ Choice "8" ""
+ Choice "9" ""
+ Choice "10" ""
+
+Option "RightMargin/Right margin" PickOne AnySetup 10
+ Choice "0" ""
+ Choice "1" ""
+ *Choice "2" ""
+ Choice "3" ""
+ Choice "4" ""
+ Choice "5" ""
+ Choice "6" ""
+ Choice "7" ""
+ Choice "8" ""
+ Choice "9" ""
+ Choice "10" ""
+
+Option "BraillePageNumber/Braille Page Number" PickOne AnySetup 10
+ Choice "None/None" ""
+ Choice "TopMargin/Top Margin" ""
+ Choice "TopInline/Top Inline" ""
+ *Choice "BottomMargin/Bottom Margin" ""
+ Choice "BottomInline/Bottom Inline" ""
+
+Option "PrintPageNumber/Print Page Number" PickOne AnySetup 10
+ Choice "None/None" ""
+ *Choice "TopMargin/Top Margin" ""
+ Choice "TopInline/Top Inline" ""
+ Choice "BottomMargin/Bottom Margin" ""
+ Choice "BottomInline/Bottom Inline" ""
+
+Option "PageSeparator/Print Page Separator" PickOne AnySetup 10
+ *Choice "True/Yes" ""
+ Choice "False/No" ""
+
+Option "PageSeparatorNumber/Print Page Number in Separator" PickOne AnySetup 10
+ *Choice "True/Yes" ""
+ Choice "False/No" ""
+
+Option "ContinuePages/Prefix Print Page Number with Braille Page Number" PickOne AnySetup 10
+ Choice "True/Yes" ""
+ *Choice "False/No" ""
+
+UIConstraints "*TopMargin 0 *BraillePageNumber TopMargin"
+UIConstraints "*TopMargin 0 *PrintPageNumber TopMargin"
+UIConstraints "*BottomMargin 0 *BraillePageNumber BottomMargin"
+UIConstraints "*BottomMargin 0 *PrintPageNumber BottomMargin"
+
+UIConstraints "*BraillePageNumber TopMargin *PrintPageNumber TopInline"
+UIConstraints "*BraillePageNumber BottomMargin *PrintPageNumber BottomInline"
+UIConstraints "*BraillePageNumber TopInline *PrintPageNumber TopMargin"
+UIConstraints "*BraillePageNumber BottomInline *PrintPageNumber BottomMargin"
diff --git a/filter/braille/filters/brftopagedbrf.in b/filter/braille/filters/brftopagedbrf.in
index 322b56dfe..d9873a182 100755
--- a/filter/braille/filters/brftopagedbrf.in
+++ b/filter/braille/filters/brftopagedbrf.in
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2015-2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -121,9 +121,11 @@ else
fi | (
P=1
DOPRINT=$(doprint $P)
- while IFS=$'\n' read -r LINE
+ IFS=$'\n' read -r LINE
+ EOF=$?
+ while [ "$EOF" = 0 -o -n "$LINE" ]
do
- while [ -z "${LINE/*$'\014'*}" ]
+ while [ -n "$LINE" -a -z "${LINE/*$'\014'*}" ]
do
# Possibly print before FF
HEAD=${LINE%%$'\014'*}
@@ -138,7 +140,16 @@ fi | (
done
# Remainder of line
- [ $DOPRINT == 0 ] || printf "%s\n" "$LINE"
+ if [ "$EOF" = 0 ]
+ then
+ NL="\n"
+ else
+ NL=""
+ fi
+ [ $DOPRINT == 0 ] || printf "%s$NL" "$LINE"
+
+ IFS=$'\n' read -r LINE
+ EOF=$?
done
)
diff --git a/filter/braille/filters/cups-braille.sh.in b/filter/braille/filters/cups-braille.sh.in
index bc6c5d747..47fda21a8 100644
--- a/filter/braille/filters/cups-braille.sh.in
+++ b/filter/braille/filters/cups-braille.sh.in
@@ -187,10 +187,18 @@ MARGIN_TOP=$(points2mm "$HWMARGIN_TOP")
MARGIN_BOTTOM=$(points2mm "$HWMARGIN_BOTTOM")
# Margins requested by user
-PAGE_LEFT=$(points2mm $(getOptionNumber page-left))
-PAGE_RIGHT=$(points2mm $(getOptionNumber page-right))
-PAGE_TOP=$(points2mm $(getOptionNumber page-top))
-PAGE_BOTTOM=$(points2mm $(getOptionNumber page-bottom))
+PAGE_LEFT=$(getOptionNumber page-left)
+[ "$?" = 0 ] || exit 1
+PAGE_LEFT=$(points2mm $PAGE_LEFT)
+PAGE_RIGHT=$(getOptionNumber page-right)
+[ "$?" = 0 ] || exit 1
+PAGE_RIGHT=$(points2mm $PAGE_RIGHT)
+PAGE_TOP=$(getOptionNumber page-top)
+[ "$?" = 0 ] || exit 1
+PAGE_TOP=$(points2mm $PAGE_TOP)
+PAGE_BOTTOM=$(getOptionNumber page-bottom)
+[ "$?" = 0 ] || exit 1
+PAGE_BOTTOM=$(points2mm $PAGE_BOTTOM)
[ -n "$PAGE_LEFT" -a "$MARGIN_LEFT" -le "$PAGE_LEFT" ] || PAGE_LEFT=$MARGIN_LEFT
[ -n "$PAGE_RIGHT" -a "$MARGIN_RIGHT" -le "$PAGE_RIGHT" ] || PAGE_RIGHT=$MARGIN_RIGHT
@@ -211,6 +219,7 @@ echo "DEBUG: printable area is ${PRINTABLEWIDTH}x${PRINTABLEHEIGHT}" >&2
#
TEXTDOTDISTANCE=$(getOptionNumber TextDotDistance)
+[ "$?" = 0 ] || exit 1
case "$TEXTDOTDISTANCE" in
220) TEXTCELLDISTANCE=310 ;;
250) TEXTCELLDISTANCE=350 ;;
@@ -222,40 +231,60 @@ case "$TEXTDOTDISTANCE" in
esac
TEXTDOTS=$(getOptionNumber TextDots)
+[ "$?" = 0 ] || exit 1
LINESPACING=$(getOptionNumber LineSpacing)
+[ "$?" = 0 ] || exit 1
# Cell dimension, including spacing
TEXTCELLWIDTH=$(( $TEXTDOTDISTANCE + $TEXTCELLDISTANCE ))
TEXTCELLHEIGHT=$(( $TEXTDOTDISTANCE * ($TEXTDOTS / 2 - 1) + $LINESPACING ))
+# Compute number of printable cells according to page width and height
+PRINTABLETEXTWIDTH=$(( ($PRINTABLEWIDTH + $TEXTCELLDISTANCE) / $TEXTCELLWIDTH ))
+PRINTABLETEXTHEIGHT=$(( ($PRINTABLEHEIGHT + $LINESPACING) / $TEXTCELLHEIGHT ))
+
if [ "$(getOption TopMargin)" = "" ]
then
# No margin
- TEXTAREAWIDTH=$PRINTABLEWIDTH
- TEXTAREAHEIGHT=$PRINTABLEHEIGHT
+ TEXTWIDTH=$PRINTABLETEXTWIDTH
+ TEXTHEIGHT=$PRINTABLETEXTHEIGHT
else
# Margins in cells
TOPMARGIN=$(getOptionNumber TopMargin)
+ [ "$?" = 0 ] || exit 1
BOTTOMMARGIN=$(getOptionNumber BottomMargin)
- if [ "$(getOption InnerMargin)" = "" ]
- then
- LEFTMARGIN=$(getOptionNumber LeftMargin)
- RIGHTMARGIN=$(getOptionNumber RightMargin)
- WIDTHMARGIN=$(( $LEFTMARGIN + $RIGHTMARGIN ))
- else
- INNERMARGIN=$(getOptionNumber InnerMargin)
- OUTERMARGIN=$(getOptionNumber OuterMargin)
- WIDTHMARGIN=$(( $INNERMARGIN + $OUTERMARGIN ))
- fi
-
- # Subtract margins from printable area
- TEXTAREAWIDTH=$(( $PRINTABLEWIDTH - $WIDTHMARGIN * $TEXTCELLWIDTH ))
- TEXTAREAHEIGHT=$(( $PRINTABLEHEIGHT - ($TOPMARGIN + $BOTTOMMARGIN) * $TEXTCELLHEIGHT ))
+ [ "$?" = 0 ] || exit 1
+ LEFTMARGIN=$(getOptionNumber LeftMargin)
+ [ "$?" = 0 ] || exit 1
+ RIGHTMARGIN=$(getOptionNumber RightMargin)
+ [ "$?" = 0 ] || exit 1
+ TEXTWIDTH=$(( $PRINTABLETEXTWIDTH - $LEFTMARGIN - $RIGHTMARGIN ))
+ TEXTHEIGHT=$(( $PRINTABLETEXTHEIGHT - $TOPMARGIN - $BOTTOMMARGIN ))
fi
-# Compute number of printable cells according to page width and height
-TEXTWIDTH=$(( ($TEXTAREAWIDTH + $TEXTCELLDISTANCE) / $TEXTCELLWIDTH ))
-TEXTHEIGHT=$(( ($TEXTAREAHEIGHT + $LINESPACING) / $TEXTCELLHEIGHT ))
+# Filter that adds top and left margins on the fly, to be used while producing
+# BRF output.
+addmargins() {
+ NEWPAGE=""
+ if [ -n "$TOPMARGIN" ]; then
+ for I in $(seq 1 $TOPMARGIN) ; do
+ NEWPAGE="$NEWPAGE"$'\r'$'\n'
+ done
+ fi
+ NEWPAGESED=${NEWPAGE//$'\n'/\\$'\n'}
+ LEFTSPACES=""
+ if [ -n "$LEFTMARGIN" ]; then
+ for I in $(seq 1 $LEFTMARGIN) ; do
+ LEFTSPACES="$LEFTSPACES "
+ done
+ fi
+
+ echo -n "$NEWPAGE"
+ sed -e '$s/ $//' \
+ -e "s/^\( \?\)\([^ ]\)/\1$LEFTSPACES\2/" \
+ -e "s/ / $NEWPAGESED/"
+ echo -n " "
+}
#
# Graphic spacing
@@ -263,6 +292,7 @@ TEXTHEIGHT=$(( ($TEXTAREAHEIGHT + $LINESPACING) / $TEXTCELLHEIGHT ))
# Compute number of printable cells according to page size
GRAPHICDOTDISTANCE=$(getOptionNumber GraphicDotDistance)
+[ "$?" = 0 ] || exit 1
# This is the total area we will send to the embosser
TOTALGRAPHICWIDTH=$(( ( ($PRINTABLEWIDTH - 160) / $GRAPHICDOTDISTANCE ) / 2 * 2 ))
@@ -336,7 +366,7 @@ getOptionLibLouis () {
if [ -n "$GRADE" ]; then
if grep -q "^#+grade:$GRADE$" $table || \
- ( [ "$GRADE" = 0 ] && grep -q "^#+contraction:no" $table ) \
+ ( [ "$GRADE" = 0 ] && ( grep -q "^#+contraction:no" $table || grep -q "^#+type:computer" $table ) ) \
then
printf "DEBUG: %s has correct grade %s\n" "$name" "$GRADE" >&2
score=$((score + 10))
@@ -379,8 +409,9 @@ getOptionLibLouis () {
elif [ -f "$TABLESDIR/$LANGUAGE.tbl" ]; then
printf "%s" "$LANGUAGE.tbl"
else
- printf "WARN: Could not find $OPTION table with locale %s\n" "$LOCALE" >&2
+ printf "ERROR: Could not find $OPTION table with locale %s\n" "$LOCALE" >&2
printf None
+ exit 1
fi
;;
Locale-g[0-3])
@@ -403,6 +434,16 @@ getOptionLibLouis () {
printf None
exit 1
;;
+ HyphLocale)
+ if [ -f "$TABLESDIR/hyph_$LOCALE.dic" ]; then
+ printf "%s" "hyph_$LOCALE.dic"
+ elif [ -f "$TABLESDIR/hyph_$LANGUAGE.dic" ]; then
+ printf "%s" "hyph_$LANGUAGE.dic"
+ else
+ printf "WARN: Could not find $OPTION hyphenation table with locale %s\n" "$LOCALE" >&2
+ printf None
+ fi
+ ;;
*)
[ -f "$TABLESDIR/$VALUE".utb ] && VALUE="$VALUE".utb
[ -f "$TABLESDIR/$VALUE".ctb ] && VALUE="$VALUE".ctb
@@ -418,9 +459,13 @@ getOptionLibLouis () {
}
LIBLOUIS1=$(getOptionLibLouis LibLouis)
+[ "$?" = 0 ] || exit 1
LIBLOUIS2=$(getOptionLibLouis LibLouis2)
+[ "$?" = 0 ] || exit 1
LIBLOUIS3=$(getOptionLibLouis LibLouis3)
+[ "$?" = 0 ] || exit 1
LIBLOUIS4=$(getOptionLibLouis LibLouis4)
+[ "$?" = 0 ] || exit 1
echo "DEBUG: Table1 $LIBLOUIS1" >&2
echo "DEBUG: Table2 $LIBLOUIS2" >&2
diff --git a/filter/braille/filters/imagetobrf.in b/filter/braille/filters/imagetobrf.in
index 5339c8536..9fd303976 100755
--- a/filter/braille/filters/imagetobrf.in
+++ b/filter/braille/filters/imagetobrf.in
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2015-2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -117,9 +117,9 @@ echo "INFO: Converting image" 1>&2
if [ -z "$FILE" ]
then
printf "DEBUG: Calling %s from stdin\n" "$RENDER_CALL" 1>&2
- $RENDER_CALL | sed -e '/^\(Width\|X\|Y\): [0-9]*$/,/^$/d'
+ $RENDER_CALL | sed -e '/^\(Width\|X\|Y\): [0-9]*$/,/^$/d' | addmargins
else
printf "DEBUG: Calling %s on '%s'\n" "$RENDER_CALL" "$FILE" 1>&2
- $RENDER_CALL < "$FILE" | sed -e '/^\(Width\|X\|Y\): [0-9]*$/,/^$/d'
+ $RENDER_CALL < "$FILE" | sed -e '/^\(Width\|X\|Y\): [0-9]*$/,/^$/d' | addmargins
fi
echo "INFO: Ready" >&2
diff --git a/filter/braille/filters/liblouis1.defs.gen.in b/filter/braille/filters/liblouis1.defs.gen.in
index aab3ff388..ae7480327 100644
--- a/filter/braille/filters/liblouis1.defs.gen.in
+++ b/filter/braille/filters/liblouis1.defs.gen.in
@@ -34,6 +34,7 @@ echo ' Choice "Locale-g0/Default for language grade 0" ""'
echo ' Choice "Locale-g1/Default for language grade 1" ""'
echo ' Choice "Locale-g2/Default for language grade 2" ""'
echo ' Choice "Locale-g3/Default for language grade 3" ""'
+echo ' Choice "HyphLocale/Default hyphenation rules for language" ""'
(
for i in $TABLESDIR/*.utb $TABLESDIR/*.ctb
diff --git a/filter/braille/filters/musicxmltobrf.in b/filter/braille/filters/musicxmltobrf.in
index ff1c3521d..f498a5cf0 100644
--- a/filter/braille/filters/musicxmltobrf.in
+++ b/filter/braille/filters/musicxmltobrf.in
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -48,9 +48,9 @@ echo "INFO: Translating MusicXML" >&2
printf "DEBUG: Calling $CONVERT | $TRANSLATE on '%s'\n" "$FILE" >&2
if [ -z "$FILE" ]
then
- $CONVERT | $TRANSLATE
+ $CONVERT | $TRANSLATE | addmargins
else
- < "$FILE" $CONVERT | $TRANSLATE
+ < "$FILE" $CONVERT | $TRANSLATE | addmargins
fi
echo "INFO: Ready" >&2
diff --git a/filter/braille/filters/texttobrf.in b/filter/braille/filters/texttobrf.in
index acdf8b9b7..b0429d3be 100755
--- a/filter/braille/filters/texttobrf.in
+++ b/filter/braille/filters/texttobrf.in
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2015-2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -41,17 +41,6 @@ FILE=$6
####################
LIBLOUIS_CONFIG=""
-# number of cells per line
-LIBLOUIS_CONFIG+=" -CcellsPerLine=$TEXTWIDTH -ClinesPerPage=$TEXTHEIGHT -CbraillePages=yes"
-
-# input encoding
-if [ "$CHARSET" = utf-8 ]
-then
- LIBLOUIS_CONFIG+=" -CinputTextEncoding=UTF8"
-else
- LIBLOUIS_CONFIG+=" -CinputTextEncoding=ascii8"
-fi
-
echo "DEBUG: Input content type: $CONTENT_TYPE" >&2
# FIXME CONTENT_TYPE contains original document, not document passed as parameter ?!!
@@ -137,12 +126,14 @@ then
LIBLOUIS_TOOL="file2brl"
dumptofile
CONVERT="unzip -p $FILE content.xml"
+ CHARSET=utf-8
checkTool unzip unzip "translating LibreOffice/OpenOffice OpenDocument files"
;;
application/vnd.openxmlformats-officedocument*)
LIBLOUIS_TOOL="file2brl"
dumptofile
CONVERT="unzip -p $FILE word/document.xml"
+ CHARSET=utf-8
checkTool unzip unzip "translating MS-Word docx files"
;;
text/rtf|application/rtf)
@@ -153,6 +144,7 @@ then
application/pdf|application/vnd.cups-pdf-banner)
LIBLOUIS_TOOL="file2brl -p"
CONVERT="pdftotext -raw - -"
+ CHARSET=utf-8
checkTool pdftotext poppler "translating PDF files"
;;
*)
@@ -160,7 +152,91 @@ then
exit 1
;;
esac
- RENDER_CALL="$LIBLOUIS_TOOL -CliteraryTextTable=en-us-brf.dis,$LIBLOUIS_TABLES,braille-patterns.cti $LIBLOUIS_CONFIG"
+
+ #
+ # text encoding
+ #
+ if [ "$CHARSET" = utf-8 ]
+ then
+ LIBLOUIS_CONFIG+=" -CinputTextEncoding=UTF8"
+ else
+ LIBLOUIS_CONFIG+=" -CinputTextEncoding=ascii8"
+ fi
+
+ #
+ # Page numbers options
+ #
+ BRAILLEPAGENUMBER=$(getOption BraillePageNumber)
+ case "$BRAILLEPAGENUMBER" in
+ None) LIBLOUIS_CONFIG+=" -CbraillePages=no";;
+ TopMargin) LIBLOUIS_CONFIG+=" -CbraillePages=yes -CbraillePageNumberAt=top -CpageNumberTopSeparateLine=yes";;
+ BottomMargin) LIBLOUIS_CONFIG+=" -CbraillePages=yes -CbraillePageNumberAt=bottom -CpageNumberBottomSeparateLine=yes";;
+ TopInline) LIBLOUIS_CONFIG+=" -CbraillePages=yes -CbraillePageNumberAt=top -CpageNumberTopSeparateLine=no";;
+ BottomInline) LIBLOUIS_CONFIG+=" -CbraillePages=yes -CbraillePageNumberAt=bottom -CpageNumberBottomSeparateLine=no";;
+ *)
+ printf "ERROR: Unknown braille page number option '%s'\n" "$BRAILLEPAGENUMBER" >&2
+ exit 1
+ ;;
+ esac
+
+ PRINTPAGENUMBER=$(getOption PrintPageNumber)
+ case "$PRINTPAGENUMBER" in
+ None) LIBLOUIS_CONFIG+=" -CprintPages=no";;
+ TopMargin) LIBLOUIS_CONFIG+=" -CprintPages=yes -CprintPageNumberAt=top -CpageNumberTopSeparateLine=yes";;
+ BottomMargin) LIBLOUIS_CONFIG+=" -CprintPages=yes -CprintPageNumberAt=bottom -CpageNumberBottomSeparateLine=yes";;
+ TopInline) LIBLOUIS_CONFIG+=" -CprintPages=yes -CprintPageNumberAt=top -CpageNumberTopSeparateLine=no";;
+ BottomInline) LIBLOUIS_CONFIG+=" -CprintPages=yes -CprintPageNumberAt=bottom -CpageNumberBottomSeparateLine=no";;
+ *)
+ printf "ERROR: Unknown print page number option '%s'\n" "$PRINTPAGENUMBER" >&2
+ exit 1
+ ;;
+ esac
+
+ # Page numbering in top or bottom margin actually reduce the given margin
+ if [ "$BRAILLEPAGENUMBER" = TopMargin -o "$PRINTPAGENUMBER" = TopMargin ]
+ then
+ TOPMARGIN=$((TOPMARGIN - 1))
+ TEXTHEIGHT=$((TEXTHEIGHT + 1))
+ fi
+ if [ "$BRAILLEPAGENUMBER" = BottomMargin -o "$PRINTPAGENUMBER" = BottomMargin ]
+ then
+ BOTTOMMARGIN=$((BOTTOMMARGIN - 1))
+ TEXTHEIGHT=$((TEXTHEIGHT + 1))
+ fi
+
+ PAGESEPARATOR=$(getOption PageSeparator)
+ case "$PAGESEPARATOR" in
+ True|true) LIBLOUIS_CONFIG+=" -CpageSeparator=yes";;
+ False|false) LIBLOUIS_CONFIG+=" -CpageSeparator=no";;
+ *)
+ printf "ERROR: Unknown page separator option '%s'\n" "$PAGESEPARATOR" >&2
+ exit 1
+ ;;
+ esac
+
+ PAGESEPARATORNUMBER=$(getOption PageSeparatorNumber)
+ case "$PAGESEPARATORNUMBER" in
+ True|true) LIBLOUIS_CONFIG+=" -CpageSeparatorNumber=yes";;
+ False|false) LIBLOUIS_CONFIG+=" -CpageSeparatorNumber=no";;
+ *)
+ printf "ERROR: Unknown page separator number option '%s'\n" "$PAGESEPARATORNUMBER" >&2
+ exit 1
+ ;;
+ esac
+
+ CONTINUEPAGES=$(getOption ContinuePages)
+ case "$CONTINUEPAGES" in
+ True|true) LIBLOUIS_CONFIG+=" -CcontinuePages=yes";;
+ False|false) LIBLOUIS_CONFIG+=" -CcontinuePages=no";;
+ *)
+ printf "ERROR: Unknown page separator number option '%s'\n" "$CONTINUEPAGES" >&2
+ exit 1
+ ;;
+ esac
+
+ LIBLOUIS_CONFIG+=" -CcellsPerLine=$TEXTWIDTH -ClinesPerPage=$TEXTHEIGHT "
+
+ RENDER_CALL="$LIBLOUIS_TOOL -Chyphenate=yes -CliteraryTextTable=en-us-brf.dis,$LIBLOUIS_TABLES,braille-patterns.cti $LIBLOUIS_CONFIG"
elif type lou_translate > /dev/null
then
# Only liblouis, but better than nothing
@@ -173,6 +249,7 @@ then
fi
else
# No translation, only text rendering
+ printf "WARN: No braille table translation was selected\n" >&2
setupTextRendering
fi
@@ -180,32 +257,39 @@ fi
cd $TMPDIR
echo "INFO: Reformating text" >&2
+(
+set -o pipefail
+set -e
if [ -z "$CONVERT" ]
then
printf "DEBUG: Calling $RENDER_CALL on '%s'\n" "$FILE" >&2
if [ -z "$FILE" ]
then
- $RENDER_CALL 2> /dev/null
+ $RENDER_CALL 2> /dev/null | addmargins
else
- < "$FILE" $RENDER_CALL 2> /dev/null
+ < "$FILE" $RENDER_CALL 2> /dev/null | addmargins
fi
elif [ -z "$TRANSLATE" ]
then
printf "DEBUG: Calling $CONVERT | $RENDER_CALL on '%s'\n" "$FILE" >&2
if [ -z "$FILE" ]
then
- $CONVERT | $RENDER_CALL 2> /dev/null
+ $CONVERT | $RENDER_CALL 2> /dev/null | addmargins
else
- < "$FILE" $CONVERT | $RENDER_CALL 2> /dev/null
+ < "$FILE" $CONVERT | $RENDER_CALL 2> /dev/null | addmargins
fi
else
printf "DEBUG: Calling $CONVERT | $RENDER_CALL | $TRANSLATE on '%s'\n" "$FILE" >&2
if [ -z "$FILE" ]
then
- $CONVERT | $RENDER_CALL 2> /dev/null | $TRANSLATE
+ $CONVERT | $RENDER_CALL 2> /dev/null | $TRANSLATE | addmargins
else
- < "$FILE" $CONVERT | $RENDER_CALL 2> /dev/null | $TRANSLATE
+ < "$FILE" $CONVERT | $RENDER_CALL 2> /dev/null | $TRANSLATE | addmargins
fi
fi
+) || {
+ printf "ERROR: text conversion pipeline $CONVERT | $RENDER_CALL | $TRANSLATE | addmargins failed\n" >&2
+ exit 1
+}
echo "INFO: Ready" >&2
diff --git a/filter/braille/filters/vectortobrf.in b/filter/braille/filters/vectortobrf.in
index 4ed4cd206..feaef086b 100644
--- a/filter/braille/filters/vectortobrf.in
+++ b/filter/braille/filters/vectortobrf.in
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -64,9 +64,9 @@ echo "INFO: Converting image" 1>&2
if [ -z "$FILE" ]
then
printf "DEBUG: Calling %s and %s from stdin\n" "$GS_CALL" "$RENDER_CALL" 1>&2
- $GS_CALL - | sed -e '/-noantialias/d' | $RENDER_CALL | sed -e '/^\(Width\|X\|Y\): [0-9]*$/,/^$/d'
+ $GS_CALL - | sed -e '/-noantialias/d' | $RENDER_CALL | sed -e '/^\(Width\|X\|Y\): [0-9]*$/,/^$/d' | addmargins
else
printf "DEBUG: Calling %s and %s on '%s'\n" "$GS_CALL" "$RENDER_CALL" "$FILE" 1>&2
- $GS_CALL "$FILE" | sed -e '/-noantialias/d' | $RENDER_CALL | sed -e '/^\(Width\|X\|Y\): [0-9]*$/,/^$/d'
+ $GS_CALL "$FILE" | sed -e '/-noantialias/d' | $RENDER_CALL | sed -e '/^\(Width\|X\|Y\): [0-9]*$/,/^$/d' | addmargins
fi
echo "INFO: Ready" >&2
diff --git a/filter/gstoraster.c b/filter/gstoraster.c
index f916ecb9a..4aec07992 100644
--- a/filter/gstoraster.c
+++ b/filter/gstoraster.c
@@ -171,11 +171,7 @@ add_pdf_header_options(gs_page_header *h, cups_array_t *gs_args,
cupsArrayAdd(gs_args, strdup("-dDuplex"));
}
}
- if ((h->HWResolution[0] != 100) || (h->HWResolution[1] != 100))
- snprintf(tmpstr, sizeof(tmpstr), "-r%dx%d",
- (unsigned)(h->HWResolution[0]), (unsigned)(h->HWResolution[1]));
- else
- snprintf(tmpstr, sizeof(tmpstr), "-r100x100");
+ snprintf(tmpstr, sizeof(tmpstr), "-r%dx%d",h->HWResolution[0], h->HWResolution[1]);
cupsArrayAdd(gs_args, strdup(tmpstr));
if (outformat == OUTPUT_FORMAT_RASTER) {
if (h->InsertSheet) {
@@ -262,17 +258,9 @@ add_pdf_header_options(gs_page_header *h, cups_array_t *gs_args,
cupsArrayAdd(gs_args, strdup("-dOutputFaceUp"));
}
}
- if (h->PageSize[0] != 612)
- snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEWIDTHPOINTS=%d",
- (unsigned)(h->PageSize[0]));
- else
- snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEWIDTHPOINTS=612");
+ snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEWIDTHPOINTS=%d",h->PageSize[0]);
cupsArrayAdd(gs_args, strdup(tmpstr));
- if (h->PageSize[1] != 792)
- snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEHEIGHTPOINTS=%d",
- (unsigned)(h->PageSize[1]));
- else
- snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEHEIGHTPOINTS=792");
+ snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEHEIGHTPOINTS=%d",h->PageSize[1]);
cupsArrayAdd(gs_args, strdup(tmpstr));
if (outformat == OUTPUT_FORMAT_RASTER) {
if (h->Separations) {
@@ -297,27 +285,11 @@ add_pdf_header_options(gs_page_header *h, cups_array_t *gs_args,
(unsigned)(h->cupsMediaType));
cupsArrayAdd(gs_args, strdup(tmpstr));
}
- if (h->cupsBitsPerColor != 1)
- snprintf(tmpstr, sizeof(tmpstr), "-dcupsBitsPerColor=%d",
- (unsigned)(h->cupsBitsPerColor));
- else
- snprintf(tmpstr, sizeof(tmpstr), "-dcupsBitsPerColor=1");
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsBitsPerColor=%d",h->cupsBitsPerColor);
cupsArrayAdd(gs_args, strdup(tmpstr));
- if (h->cupsColorOrder != CUPS_ORDER_CHUNKED)
- snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorOrder=%d",
- (unsigned)(h->cupsColorOrder));
- else
- snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorOrder=%d",
- CUPS_ORDER_CHUNKED);
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorOrder=%d",h->cupsColorOrder);
cupsArrayAdd(gs_args, strdup(tmpstr));
- }
- if (outformat == OUTPUT_FORMAT_RASTER) {
- if (h->cupsColorSpace != CUPS_CSPACE_K)
- snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorSpace=%d",
- (unsigned)(h->cupsColorSpace));
- else
- snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorSpace=%d",
- CUPS_CSPACE_K);
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorSpace=%d",h->cupsColorSpace);
cupsArrayAdd(gs_args, strdup(tmpstr));
}
diff --git a/filter/pdftoopvp/OPVPOutputDev.cxx b/filter/pdftoopvp/OPVPOutputDev.cxx
index 63806e8a4..45ebe02c8 100644
--- a/filter/pdftoopvp/OPVPOutputDev.cxx
+++ b/filter/pdftoopvp/OPVPOutputDev.cxx
@@ -66,7 +66,7 @@ struct SplashOutFontSubst {
class SplashOutFontFileID: public SplashFontFileID {
public:
- SplashOutFontFileID(Ref *rA) { r = *rA; substIdx = -1; }
+ SplashOutFontFileID(const Ref *rA) { r = *rA; substIdx = -1; }
~SplashOutFontFileID() {}
diff --git a/filter/pdftopdf/pdftopdf.cc b/filter/pdftopdf/pdftopdf.cc
index 7bc152b61..f474f08c6 100644
--- a/filter/pdftopdf/pdftopdf.cc
+++ b/filter/pdftopdf/pdftopdf.cc
@@ -164,9 +164,9 @@ static bool ppdDefaultOrder(ppd_file_t *ppd) // {{{ -- is reverse?
} else if ((attr=ppdFindAttr(ppd,"DefaultOutputOrder",0)) != NULL) {
val=attr->value;
}
- if ((!val)||(strcasecmp(val,"Normal")==0)) {
+ if ((!val)||(strcasecmp(val,"Normal")==0)||(strcasecmp(val,"same-order")==0)) {
return false;
- } else if (strcasecmp(val,"Reverse")==0) {
+ } else if (strcasecmp(val,"Reverse")==0||(strcasecmp(val,"reverse-order")==0)) {
return true;
}
error("Unsupported output-order value %s, using 'normal'!",val);
@@ -465,8 +465,10 @@ void getParameters(ppd_file_t *ppd,int num_options,cups_option_t *options,Proces
}
if ((val=cupsGetOption("OutputOrder",num_options,options)) != NULL ||
+ (val=cupsGetOption("output-order",num_options,options)) != NULL ||
(val=cupsGetOption("page-delivery",num_options,options)) != NULL) {
- param.reverse=(strcasecmp(val,"Reverse")==0);
+ param.reverse = (strcasecmp(val, "Reverse") == 0 ||
+ strcasecmp(val, "reverse-order") == 0);
} else if (ppd) {
param.reverse=ppdDefaultOrder(ppd);
}
@@ -768,17 +770,9 @@ static bool printerWillCollate(ppd_file_t *ppd) // {{{
void calculate(ppd_file_t *ppd,ProcessingParameters &param) // {{{
{
- param.deviceReverse=false;
- if (param.reverse) {
- // test OutputOrder of hardware (ppd)
- if (ppdFindOption(ppd,"OutputOrder") != NULL) {
- param.deviceReverse=true;
- param.reverse=false;
- } else {
- // Enable evenDuplex or the first page may be empty.
- param.evenDuplex=true; // disabled later, if non-duplex
- }
- }
+ if (param.reverse)
+ // Enable evenDuplex or the first page may be empty.
+ param.evenDuplex=true; // disabled later, if non-duplex
setFinalPPD(ppd,param);
diff --git a/filter/pdftopdf/pdftopdf_processor.cc b/filter/pdftopdf/pdftopdf_processor.cc
index 697eb4ab4..22ff0c5ce 100644
--- a/filter/pdftopdf/pdftopdf_processor.cc
+++ b/filter/pdftopdf/pdftopdf_processor.cc
@@ -95,8 +95,6 @@ void ProcessingParameters::dump() const // {{{
(emitJCL)?"true":"false");
fprintf(stderr,"deviceCopies: %d\n",
deviceCopies);
- fprintf(stderr,"deviceReverse: %s\n",
- (deviceReverse)?"true":"false");
fprintf(stderr,"deviceCollate: %s\n",
(deviceCollate)?"true":"false");
fprintf(stderr,"setDuplex: %s\n",
diff --git a/filter/pdftopdf/pdftopdf_processor.h b/filter/pdftopdf/pdftopdf_processor.h
index bd20ba40e..b3837d9b6 100644
--- a/filter/pdftopdf/pdftopdf_processor.h
+++ b/filter/pdftopdf/pdftopdf_processor.h
@@ -34,7 +34,7 @@ ProcessingParameters()
autoRotate(false),
- emitJCL(true),deviceCopies(1),deviceReverse(false),
+ emitJCL(true),deviceCopies(1),
deviceCollate(false),setDuplex(false),
page_logging(-1)
@@ -83,7 +83,6 @@ ProcessingParameters()
// ppd/jcl changes
bool emitJCL;
int deviceCopies;
- bool deviceReverse;
bool deviceCollate;
bool setDuplex;
// unsetMirror (always)