1# 2# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org> 3# 4# Permission is hereby granted, free of charge, to any person obtaining a copy 5# of this software and associated documentation files (the "Software"), to deal 6# in the Software without restriction, including without limitation the rights 7# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8# copies of the Software, and to permit persons to whom the Software is 9# furnished to do so, subject to the following conditions: 10# 11# 12# The above copyright notice and this permission notice shall be included in 13# all copies or substantial portions of the Software. 14# 15# 16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22# THE SOFTWARE. 23# 24 25. @CUPS_DATADIR@/braille/index.sh 26 27# Whether lengths should be given to the embosser in In or Mm 28PAPERLENGTH=$(getAttribute IndexPaperLength) 29 30if [ $FIRMWARE -ge 103000 ] 31then 32 # Firmware 10.30 and above support temporary parameters 33 INIT=$'\033'D 34 35 # Margins are implemented in software 36 INIT+=TM0,BI0 37 38 # Trying to disable banner page seems to pose problems 39 #INIT+=,BP 40 41 # Common options 42 INIT+="$(commonOptions)" 43 [ $? = 0 ] || exit 1 44 45 # Paper size 46 case "$PAPERLENGTH" in 47 In) 48 INIT+=,PW$(mmToIndexIn $PAGEWIDTH),PL$(mmToIndexIn $PAGEHEIGHT) 49 ;; 50 Mm) 51 INIT+=,PW$(($PAGEWIDTH / 100)),PL$(($PAGEHEIGHT / 100)) 52 ;; 53 *) ;; 54 esac 55 56 case $LINESPACING in 57 250) INIT+=,LS0 ;; 58 375) INIT+=,LS1 ;; 59 450) INIT+=,LS2 ;; 60 475) INIT+=,LS3 ;; 61 500) INIT+=,LS4 ;; 62 525) INIT+=,LS5 ;; 63 550) INIT+=,LS6 ;; 64 750) INIT+=,LS7 ;; 65 1000) INIT+=,LS8 ;; 66 *) 67 if [ $FIRMWARE -lt 120130 ] 68 then 69 echo "ERROR: unsupported $LINESPACING line spacing, please upgrade firmware to at least 12.01.3" >&2 70 exit 1 71 fi 72 if [ $LINESPACING -lt 100 ] 73 then 74 echo "ERROR: too small $LINESPACING line spacing" >&2 75 exit 1 76 fi 77 INIT+=,LS$(($LINESPACING / 10)) 78 ;; 79 esac 80 81 if [ $LIBLOUIS1 != None -o \ 82 $LIBLOUIS2 != None -o \ 83 $LIBLOUIS3 != None -o \ 84 $LIBLOUIS4 != None ] 85 then 86 # software-translated, enforce a 6-dot table if needed 87 case $TEXTDOTS in 88 # Firmware 11.02.1 and above allow to make sure to be using a 6-dot table 89 6) INIT+=,BT0 ;; 90 # Hoping the user properly configured an 8-dot table 91 8) ;; 92 *) echo "ERROR: unsupported $TEXTDOTS dots" >&2 ; exit 1 ;; 93 esac 94 else 95 # Hoping the user configured a table with appropriate number of dots 96 INIT+=,BT$TABLE 97 fi 98 99 # roger 100 INIT+=";" 101else 102 # No support for temporary parameters. Hoping that the user configured CUPS 103 # the same way as the embosser. 104 INIT= 105fi 106