Page 1 of 1

Braille 6dot formats support

Posted: 2015-11-01T14:36:24-07:00
by sthibaul
Hello,

Braille embossers may support only 6dots printing, so there is a need
for 6dot unicode braille and iso braille formats. The attached patch
adds .ubrl6 and .isobrl6 formats for that.

Samuel

Re: Braille 6dot formats support

Posted: 2015-11-01T14:37:14-07:00
by sthibaul

Code: Select all

--- a/coders/braille.c
+++ b/coders/braille.c
@@ -108,12 +108,24 @@ ModuleExport size_t RegisterBRAILLEImage
   entry->description=AcquireString("Unicode Text format");
   entry->module=AcquireString("BRAILLE");
   (void) RegisterMagickInfo(entry);
+  entry=SetMagickInfo("UBRL6");
+  entry->encoder=(EncodeImageHandler *) WriteBRAILLEImage;
+  entry->adjoin=MagickFalse;
+  entry->description=AcquireString("Unicode Text format 6dot");
+  entry->module=AcquireString("BRAILLE");
+  (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("ISOBRL");
   entry->encoder=(EncodeImageHandler *) WriteBRAILLEImage;
   entry->adjoin=MagickFalse;
   entry->description=AcquireString("ISO/TR 11548-1 format");
   entry->module=AcquireString("BRAILLE");
   (void) RegisterMagickInfo(entry);
+  entry=SetMagickInfo("ISOBRL6");
+  entry->encoder=(EncodeImageHandler *) WriteBRAILLEImage;
+  entry->adjoin=MagickFalse;
+  entry->description=AcquireString("ISO/TR 11548-1 format 6dot");
+  entry->module=AcquireString("BRAILLE");
+  (void) RegisterMagickInfo(entry);
   return(MagickImageCoderSignature);
 }
 ^L
@@ -140,7 +152,9 @@ ModuleExport void UnregisterBRAILLEImage
 {
   (void) UnregisterMagickInfo("BRF");
   (void) UnregisterMagickInfo("UBRL");
+  (void) UnregisterMagickInfo("UBRL6");
   (void) UnregisterMagickInfo("ISOBRL");
+  (void) UnregisterMagickInfo("ISOBRL6");
 }
 ^L
 /*
@@ -211,11 +225,20 @@ static MagickBooleanType WriteBRAILLEIma
   assert(image->signature == MagickSignature);
   if (LocaleCompare(image_info->magick, "UBRL") == 0)
     unicode=1;                                       
-  else
-    if (LocaleCompare(image_info->magick, "ISOBRL") == 0)
+  else if (LocaleCompare(image_info->magick, "UBRL6") == 0)
+    {
+      unicode=1;
+      cell_height = 3;
+    }
+  else if (LocaleCompare(image_info->magick, "ISOBRL") == 0)
+    iso_11548_1=1;
+  else if (LocaleCompare(image_info->magick, "ISOBRL6") == 0)
+    {
       iso_11548_1=1;
-    else
-      cell_height=3;
+      cell_height = 3;
+    }
+  else
+    cell_height=3;
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
--- a/magick/coder.c
+++ b/magick/coder.c
@@ -143,6 +143,7 @@ static const CoderMapInfo
     { "IPTCTEXT", "META" },                 
     { "IPTCWTEXT", "META" },
     { "ISOBRL", "BRAILLE" },
+    { "ISOBRL6", "BRAILLE" },
     { "JBG", "JBIG" },       
     { "JNG", "PNG" }, 
     { "JPC", "JP2" },
@@ -214,6 +215,7 @@ static const CoderMapInfo
     { "TIF", "TIFF" },                      
     { "TTC", "TTF" }, 
     { "UBRL", "BRAILLE" },
+    { "UBRL6", "BRAILLE" },
     { "VDA", "TGA" },      
     { "VST", "TGA" },
     { "WIZARD", "MAGICK" },

Re: Braille 6dot formats support

Posted: 2015-11-01T14:38:54-07:00
by sthibaul
(Mmm, not the best way to submit a patch of course, but I couldn't find how to create an account on http://git.imagemagick.org/)

Re: Braille 6dot formats support

Posted: 2015-11-01T14:56:54-07:00
by dlemstra
We have not opened account registration at our main server. You can use our mirror at github or gitlab to send us a pull request. It would make us happy if you use our code conventions and write 'cell_height = 3' as 'cell_height=3' :)

We can also integrate your patch manually if you don't want to use github or gitlab.

Re: Braille 6dot formats support

Posted: 2015-11-01T16:04:11-07:00
by sthibaul

Re: Braille 6dot formats support

Posted: 2015-11-02T05:07:53-07:00
by dlemstra
Your patch has been applied to our GIT repository. Thanks!