Skip to contentSkip to conversation

Fix graphical braille margins

PATCH Applied Samuel Thibault 2 participants 5 messages Sep 14, 2017 – Sep 16, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix graphical braille margins

In Index graphical mode we need to disable the text margins, since they come in the way there too.
Also, we should always add a 1.6mm margin for taking into account the width of dots.

Samuel

=== modified file 'filter/braille/drivers/index/imageubrltoindexv3.in'

braille/drivers/index/imageubrltoindexv3.in +7 -1
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 #
-# Copyright (c) 2015-2016 Samuel Thibault <[email protected]>
+# Copyright (c) 2015-2017 Samuel Thibault <[email protected]>
 # 
 # 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,6 +34,12 @@ NB=$4
 OPTIONS=$5
 FILE=$6
 
+# Disable margins, they are done by imagemagick before this
+TOPMARGIN=0
+BOTTOMMARGIN=0
+INNERMARGIN=0
+OUTERMARGIN=0
+
 . @CUPS_DATADIR@/braille/indexv3.sh
 printf "$INIT"
 

=== modified file 'filter/braille/drivers/index/imageubrltoindexv4.in'

braille/drivers/index/imageubrltoindexv4.in +7 -1
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 #
-# Copyright (c) 2015-2016 Samuel Thibault <[email protected]>
+# Copyright (c) 2015-2017 Samuel Thibault <[email protected]>
 # 
 # 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,6 +34,12 @@ NB=$4
 OPTIONS=$5
 FILE=$6
 
+# Disable margins, they are done by imagemagick before this
+TOPMARGIN=0
+BOTTOMMARGIN=0
+INNERMARGIN=0
+OUTERMARGIN=0
+
 . @CUPS_SERVERBIN@/filter/indexv4.sh
 printf "$INIT"
 

=== modified file 'filter/braille/drivers/index/indexv3.sh.in'

braille/drivers/index/indexv3.sh.in +2 -2
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015-2016 Samuel Thibault <[email protected]>
+# Copyright (c) 2015-2017 Samuel Thibault <[email protected]>
 # 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -32,7 +32,7 @@ then
   # Firmware 10.30 and above support temporary parameters
   INIT=$'\033'D
 
-  # Disable margins
+  # Configure margins
   INIT+=TM$TOPMARGIN,BM$BOTTOMMARGIN,IM$INNERMARGIN,OM$OUTERMARGIN
 
   # Trying to disable banner page seems to pose problems

=== modified file 'filter/braille/drivers/index/indexv4.sh.in'

braille/drivers/index/indexv4.sh.in +2 -2
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015-2016 Samuel Thibault <[email protected]>
+# Copyright (c) 2015-2017 Samuel Thibault <[email protected]>
 # 
 # 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 @@ then
   # Firmware 10.30 and above support temporary parameters
   INIT=$'\033'D
 
-  # Disable margins
+  # Configure margins
   INIT+=TM$TOPMARGIN,BI$INNERMARGIN
 
   # Common options

=== modified file 'filter/braille/filters/cups-braille.sh.in'

braille/filters/cups-braille.sh.in +3 -2
@@ -205,9 +205,10 @@ TEXTHEIGHT=$(( ($TEXTAREAHEIGHT + $LINES
 #
 
 # Compute number of printable cells according to page size
+# Take into account that dots have a width.
 GRAPHICDOTDISTANCE=$(getOptionNumber GraphicDotDistance)
-GRAPHICWIDTH=$(( $PRINTABLEWIDTH / $GRAPHICDOTDISTANCE ))
-GRAPHICHEIGHT=$(( $PRINTABLEHEIGHT / $GRAPHICDOTDISTANCE ))
+GRAPHICWIDTH=$(( ($PRINTABLEWIDTH - 160) / $GRAPHICDOTDISTANCE ))
+GRAPHICHEIGHT=$(( ($PRINTABLEHEIGHT - 160) / $GRAPHICDOTDISTANCE ))
 
 #
 # Text translation
#1 lore raw
Quoted 4 lines · Samuel Thibault

In Index graphical mode we need to disable the text margins, since they come in the way there too.
Also, we should always add a 1.6mm margin for taking into account the width of dots.

Applied. Thank you very much for the patch.

Till

#2 lore raw

PATCH 1/1 round graphical braille images to braille cell

In reply to Samuel Thibault

Embossers would typically need a round number of cells to emboss, so round the graphical area to a multiple of 2x4.

Samuel

=== modified file 'filter/braille/filters/cups-braille.sh.in'

braille/filters/cups-braille.sh.in +2 -2
@@ -207,8 +207,8 @@ TEXTHEIGHT=$(( ($TEXTAREAHEIGHT + $LINES
 # Compute number of printable cells according to page size
 # Take into account that dots have a width.
 GRAPHICDOTDISTANCE=$(getOptionNumber GraphicDotDistance)
-GRAPHICWIDTH=$(( ($PRINTABLEWIDTH - 160) / $GRAPHICDOTDISTANCE ))
-GRAPHICHEIGHT=$(( ($PRINTABLEHEIGHT - 160) / $GRAPHICDOTDISTANCE ))
+GRAPHICWIDTH=$(( ( ($PRINTABLEWIDTH - 160) / $GRAPHICDOTDISTANCE ) / 2 * 2 ))
+GRAPHICHEIGHT=$(( ( ($PRINTABLEHEIGHT - 160) / $GRAPHICDOTDISTANCE ) / 4 * 4 ))
 
 #
 # Text translation
#3 lore raw

Re: [Printing-architecture] [PATCH] round graphical braille images to braille cell

Quoted 2 lines · Samuel Thibault

Embossers would typically need a round number of cells to emboss, so round the graphical area to a multiple of 2x4.

Applied. Thanks.

Till

#4 lore raw
In reply to Samuel Thibault

Hello,

Quoted 2 lines · Samuel Thibault, on jeu. 14 sept. 2017 19:40:09 +0200, wrote:

In Index graphical mode we need to disable the text margins, since they come in the way there too.

Oops, sorry, that was not actually working :/ Here is a fix.

Samuel

=== modified file 'filter/braille/drivers/index/imageubrltoindexv3.in'

braille/drivers/index/imageubrltoindexv3.in +1 -4
@@ -35,10 +35,7 @@ OPTIONS=$5
 FILE=$6
 
 # Disable margins, they are done by imagemagick before this
-TOPMARGIN=0
-BOTTOMMARGIN=0
-INNERMARGIN=0
-OUTERMARGIN=0
+NOMARGIN=1
 
 . @CUPS_DATADIR@/braille/indexv3.sh
 printf "$INIT"

=== modified file 'filter/braille/drivers/index/imageubrltoindexv4.in'

braille/drivers/index/imageubrltoindexv4.in +1 -4
@@ -35,10 +35,7 @@ OPTIONS=$5
 FILE=$6
 
 # Disable margins, they are done by imagemagick before this
-TOPMARGIN=0
-BOTTOMMARGIN=0
-INNERMARGIN=0
-OUTERMARGIN=0
+NOMARGIN=1
 
 . @CUPS_SERVERBIN@/filter/indexv4.sh
 printf "$INIT"

=== modified file 'filter/braille/drivers/index/indexv3.sh.in'

braille/drivers/index/indexv3.sh.in +8 -2
@@ -32,8 +32,14 @@ then
   # Firmware 10.30 and above support temporary parameters
   INIT=$'\033'D
 
-  # Configure margins
-  INIT+=TM$TOPMARGIN,BM$BOTTOMMARGIN,IM$INNERMARGIN,OM$OUTERMARGIN
+  if [ -z "$NOMARGIN" ]
+  then
+    # Configure margins
+    INIT+=TM$TOPMARGIN,BM$BOTTOMMARGIN,IM$INNERMARGIN,OM$OUTERMARGIN
+  else
+    # disable margins
+    INIT+=TM0,BM0,IM0,OM0
+  fi
 
   # Trying to disable banner page seems to pose problems
   #INIT+=,BP

=== modified file 'filter/braille/drivers/index/indexv4.sh.in'

braille/drivers/index/indexv4.sh.in +9 -2
@@ -29,8 +29,15 @@ then
   # Firmware 10.30 and above support temporary parameters
   INIT=$'\033'D
 
-  # Configure margins
-  INIT+=TM$TOPMARGIN,BI$INNERMARGIN
+  if [ -z "$NOMARGIN" ]
+  then
+    # Configure margins
+    INIT+=TM$TOPMARGIN,BI$INNERMARGIN
+  else
+    # disable margins
+    INIT+=TM0,BM0,IM0,OM0
+  fi
+
 
   # Common options
   INIT+="$(setCommonOptions)"