All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: printing-architecture@lists.linux-foundation.org
Subject: Re: [Printing-architecture] Contributing braille embosser support
Date: Tue, 29 Nov 2016 20:30:00 +0100	[thread overview]
Message-ID: <20161129193000.GG2918@var.home> (raw)
In-Reply-To: <20161127185441.GG18656@var.home>

[-- Attachment #1: Type: text/plain, Size: 97 bytes --]

Hello,

This is an update for the Index braille driver, to add support for text
margins.

Samuel

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 7787 bytes --]

=== 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 <samuel.thibault@ens-lyon.org>
+// Copyright (c) 2015-2016 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
@@ -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 <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2016 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
@@ -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 <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2016 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
@@ -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 <samuel.thibault@ens-lyon.org>
+# Copyright (c) 2015-2016 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
@@ -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


      parent reply	other threads:[~2016-11-29 19:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 10:27 [Printing-architecture] Contributing braille embosser support Samuel Thibault
2015-12-09 16:04 ` Michael Sweet
2015-12-10 20:29 ` Till Kamppeter
2015-12-10 20:45   ` Samuel Thibault
2015-12-10 21:02     ` Till Kamppeter
2015-12-10 21:31       ` Samuel Thibault
2015-12-11  0:19         ` Till Kamppeter
2015-12-11  0:31           ` Samuel Thibault
2015-12-11  1:17             ` Till Kamppeter
2015-12-12  2:28             ` Till Kamppeter
2015-12-12  3:53               ` Till Kamppeter
2015-12-12  8:36               ` Samuel Thibault
2015-12-12  9:50                 ` Samuel Thibault
2015-12-12 11:53                 ` Till Kamppeter
2015-12-12 12:04                   ` Till Kamppeter
2015-12-13  2:40                   ` Samuel Thibault
2015-12-13 11:07                     ` Till Kamppeter
2015-12-21  0:11                       ` Samuel Thibault
2015-12-21  0:12                       ` Samuel Thibault
2015-12-21 13:56                         ` Till Kamppeter
2015-12-13 18:59                     ` Samuel Thibault
2015-12-13 19:42                       ` Till Kamppeter
2015-12-12 15:00                 ` Till Kamppeter
2016-11-27 18:54 ` Samuel Thibault
2016-11-27 19:22   ` Till Kamppeter
2016-11-29 19:30   ` Samuel Thibault [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161129193000.GG2918@var.home \
    --to=samuel.thibault@ens-lyon.org \
    --cc=printing-architecture@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.