=== modified file 'filter/braille/drivers/index/index.defs' --- filter/braille/drivers/index/index.defs 2015-12-12 02:11:10 +0000 +++ filter/braille/drivers/index/index.defs 2016-11-27 20:30:23 +0000 @@ -1,5 +1,5 @@ // -// Copyright (c) 2015 Samuel Thibault +// Copyright (c) 2015-2016 Samuel Thibault // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -56,3 +56,70 @@ Group "Braille" 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" === modified file 'filter/braille/drivers/index/index.sh.in' --- filter/braille/drivers/index/index.sh.in 2015-12-12 02:11:10 +0000 +++ filter/braille/drivers/index/index.sh.in 2016-11-27 20:47:11 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2015 Samuel Thibault +# Copyright (c) 2015-2016 Samuel Thibault # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -28,6 +28,7 @@ FIRMWARE=$(getOptionNumber IndexFirmware FOLDING=$(getOption IndexFolding) TABLE=$(getOptionNumber IndexTable) MULTIPLEIMPACT=$(getOptionNumber IndexMultipleImpact) +PAGENUMBER=$(getOption PageNumber) # Convert from 100th of mm to Inch fraction mmToIndexIn () { @@ -71,7 +72,7 @@ mmToIndexIn () { commonOptions() { INIT= # Disable options we don't want: first line offset and page numbering - INIT+=,FO0,PN0 + INIT+=,FO0 # Support hardware-assisted multiple copies if [ $NB != 1 ] @@ -82,7 +83,7 @@ commonOptions() { INIT+=,MI$MULTIPLEIMPACT # Support page folding - case $FOLDING in + case "$FOLDING" in Single) INIT+=,DP1 ;; Double) INIT+=,DP2 ;; SingleZ) INIT+=,DP5 ;; @@ -101,11 +102,22 @@ commonOptions() { 320) INIT+=,TD2 ;; *) printf "ERROR: unsupported '%s' text dot distance\n" "$TEXTDOTDISTANCE" >&2 ; exit 1 ;; esac - case $GRAPHICDOTDISTANCE in + case "$GRAPHICDOTDISTANCE" in 160) INIT+=,GD2 ;; 200) INIT+=,GD0 ;; 250) INIT+=,GD1 ;; - *) printf "ERROR: unsupported '%s'graphic dot distance\n" "$GRAPHICDOTDISTANCE" >&2 ; exit 1 ;; + *) printf "ERROR: unsupported '%s' graphic dot distance\n" "$GRAPHICDOTDISTANCE" >&2 ; exit 1 ;; + esac + + case "$PAGENUMBER" 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 ;; esac echo "$INIT" === modified file 'filter/braille/drivers/index/indexv3.sh.in' --- filter/braille/drivers/index/indexv3.sh.in 2015-12-12 02:11:10 +0000 +++ filter/braille/drivers/index/indexv3.sh.in 2016-11-29 19:29:11 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2015 Samuel Thibault +# Copyright (c) 2015-2016 Samuel Thibault # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -33,7 +33,7 @@ then INIT=$'\033'D # Disable margins - INIT+=TM0,BM0,IM0,OM0 + INIT+=TM$TOPMARGIN,BM$BOTTOMMARGIN,IM$INNERMARGIN,OM$OUTERMARGIN # Trying to disable banner page seems to pose problems #INIT+=,BP === modified file 'filter/braille/drivers/index/indexv4.sh.in' --- filter/braille/drivers/index/indexv4.sh.in 2015-12-12 02:11:10 +0000 +++ filter/braille/drivers/index/indexv4.sh.in 2016-11-29 19:29:12 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2015 Samuel Thibault +# Copyright (c) 2015-2016 Samuel Thibault # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -30,7 +30,7 @@ then INIT=$'\033'D # Disable margins - INIT+=TM0,BI0 + INIT+=TM$TOPMARGIN,BI$INNERMARGIN # Common options INIT+="$(setCommonOptions)" === modified file 'filter/braille/filters/cups-braille.sh.in' --- filter/braille/filters/cups-braille.sh.in 2016-04-10 17:20:32 +0000 +++ filter/braille/filters/cups-braille.sh.in 2016-11-27 20:35:31 +0000 @@ -144,7 +144,7 @@ case "$PAGESIZE" in ;; esac -# TODO: hardcoded margin +# TODO: hardcoded embosser margin PRINTABLEWIDTH=$((PAGEWIDTH - 1000)) PRINTABLEHEIGHT=$((PAGEHEIGHT - 1000)) @@ -167,9 +167,30 @@ esac TEXTDOTS=$(getOptionNumber TextDots) LINESPACING=$(getOptionNumber LineSpacing) +# Cell dimension, including spacing +TEXTCELLWIDTH=$(( $TEXTDOTDISTANCE + $TEXTCELLDISTANCE )) +TEXTCELLHEIGHT=$(( $TEXTDOTDISTANCE * ($TEXTDOTS / 2 - 1) + $LINESPACING )) + +if [ "$(getOption TopMargin)" = "" ] +then + # No margin + TEXTAREAWIDTH=$PRINTABLEWIDTH + TEXTAREAHEIGHT=$PRINTABLEHEIGHT +else + # Margins in cells + TOPMARGIN=$(getOptionNumber TopMargin) + BOTTOMMARGIN=$(getOptionNumber BottomMargin) + INNERMARGIN=$(getOptionNumber InnerMargin) + OUTERMARGIN=$(getOptionNumber OuterMargin) + + # Subtract margins from printable area + TEXTAREAWIDTH=$(( $PRINTABLEWIDTH - ($INNERMARGIN + $OUTERMARGIN) * $TEXTCELLWIDTH )) + TEXTAREAHEIGHT=$(( $PRINTABLEHEIGHT - ($TOPMARGIN + $BOTTOMMARGIN) * $TEXTCELLHEIGHT )) +fi + # Compute number of printable cells according to page width and height -TEXTWIDTH=$(( ($PRINTABLEWIDTH + $TEXTCELLDISTANCE) / ($TEXTDOTDISTANCE + $TEXTCELLDISTANCE) )) -TEXTHEIGHT=$(( ($PRINTABLEHEIGHT + $LINESPACING) / ($TEXTDOTDISTANCE * ($TEXTDOTS / 2 - 1) + $LINESPACING) )) +TEXTWIDTH=$(( ($TEXTAREAWIDTH + $TEXTCELLDISTANCE) / $TEXTCELLWIDTH )) +TEXTHEIGHT=$(( ($TEXTAREAHEIGHT + $LINESPACING) / $TEXTCELLHEIGHT )) # # Graphic spacing