Braille 6dot formats support

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
sthibaul
Posts: 9
Joined: 2015-11-01T14:01:29-07:00
Authentication code: 1151

Braille 6dot formats support

Post 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
sthibaul
Posts: 9
Joined: 2015-11-01T14:01:29-07:00
Authentication code: 1151

Re: Braille 6dot formats support

Post 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" },
sthibaul
Posts: 9
Joined: 2015-11-01T14:01:29-07:00
Authentication code: 1151

Re: Braille 6dot formats support

Post 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/)
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Braille 6dot formats support

Post 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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
sthibaul
Posts: 9
Joined: 2015-11-01T14:01:29-07:00
Authentication code: 1151

Re: Braille 6dot formats support

Post by sthibaul »

User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Braille 6dot formats support

Post by dlemstra »

Your patch has been applied to our GIT repository. Thanks!
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply