HermannSW 2700006U54 Tags:  pbmtobraille graphviz braille dot xslt image non-xml terminal unicode datapower netpbm 2 Comments 1,401 Views
HermannSW 2700006U54 Tags:  netpbm dot terminal non-xml unicode pbmtobraille datapower xslt image graphviz braille 7 Comments 2,292 Views
"ws & comments":"http://www.fileformat.info/format/pbm/egff.htm"
This week I retweeted a last April tweet I stumbled across:
This looked really interesting to me, graphviz dot tool drawing output "inside" the terminal:
I wanted to be able to do same or similar [of course store as file and view via gimp or browser is possible].
Back in 2011 I gave 2 WSTE webcasts on "Non-XML Data Processing in WebSphere DataPower SOA Appliances Stylesheets". The 2nd webcast shows on slide 28 how I did convert a bitmap image into textual output making use of the Braille Patterns.
This is the conversion for snowman.pbm, .pbm is portable bitmap format from netpbm tools:
Typically only the top 2x3 dots of 2x4 get used, as you can see above I used all 2x4.
Here are the numbering of the dots as well as the hex codes are specifed:
There are tons of converters between different formats in netpbm tools, as well as modifiers (like eg. pnmcrop).
In this blog posting I will now talk about new pbmtobraille tool I created.
You find the C source, a syntax highlighted version and sample outputs generated in pbmtobraille.zip for download.
pbmtobraille.c[.pre.html] is a small C program (97 lines without comments containing sample outputs) doing just what it says:
pbmtobraille.c.html is just the syntax highlighted version.
samples.txt[.pre.html] contains various sample output produced (shown below), which are part of pbmtobraille.c's comments too.
9x9.pbm is a really crazy parsing sample according the .pbm spec, following this statement:
This is the header section demonstrating basic use with pbmtext output, including negation of generated output, as well as the help line telling the tool's features:
This is top of tail comment section, showing graphviz output done by pbmtobraille:
And finally this is bottom section showing a bigger layout in vertical direction (layout=TB is default, Top to Bottom):
I am a German, born 1965 in Dortmund. I did learn to read the old German characters in use until the 1st half of 20th century, but not to write them.
Today my attention was brought to this again by this tweet (pointing to a nice code piece):
First I learned from Wikipedia that the black-letter characters were in use in Germany from 1150 until 1st half of 20th centurty:
And that similar letters for use in mathematical formulas are called fraktur.
It just outputs "Hallo Welt!" which is German for "Hello world!":
Next I wanted to replace all ASCII characters in that stylesheet by their black-letter counterparts.
The string of all black-letter characters was given under above "...#unicode" Wikipedia link, and XPath translate() function𝖊𝖓𝖈𝖔𝖉𝖎𝖓𝖌 did the rest:
Here you can see it work:
$ coproc2 𝖍𝖆𝖑𝖑𝖔-𝖜𝖊𝖑𝖙.𝖝𝖘𝖑 dummy.xml http://dp2-l3:2223 ; echo
𝕳𝖆𝖑𝖑𝖔 𝖂 𝖊𝖑𝖙!
End of 2012 I did blog posting BMP.xsl.html (Basic Multilingual Plane) in which I described stylesheet BMP.xsl that created nice 16x16 table with each cell containing a 16x16 table containing a single unicode character, that spans the complete Basic Multilangual Plane (BMP, Unicodes 0-65535).
In this xml-dev posting John Cowan pointed to two BMP videos and an A0 .pdf poster.
I replied to that posting and criticized that the A0 poster does not show any BMP structure.
I wanted to have BMP.xq.html A0 poster, but the biggest paper format our printers do provide is A3.
Since today his A0 = 8 x A3 BMP poster covers the outside wall of my Boeblingen lab office ;-)
This is a short "screenshot" story on my experiments with twitter, Unicode and web browsers,
Then I did a little test posting on that:
After that I thought on what might be a good, more elaborate sample,.
Next I did verify that Firefox, Chrome and Opera browsers did display fine (screenshot at bottom):
Of course I had to check my two Android browsers as well, first Android built in browser:
This was my 1st summary:
And this was to complete the whole thing with "Linux OK" message ;-)
Unicode character set is BIG.
Most of its characters can be found in Basic Multilingual Plane (BMP).
I wanted to view ALL 2^16=65536 characters of BMP in a BIG HTML table in my browser like this:
I created stylesheet BMP.xsl (size 2.5KB) to generate that HTML page (size 1.2MB).
Since XPATH 2 function fn:codepoints-to-string() is not available in browser XSLT
BMP.xsl.html had to be created offline by "xsltproc BMP.xsl BMP.xsl" (see "<!-- single codepoint to string -->" on how).
The generated HTML page displays fine in all BIG5 browsers, here are some observations:
If you change the xsl:output method to "html" then this stylesheet can be used in a DataPower loopback XML Firewall
and returns the HTML page to a browser correctly (if option "Process Messages Whose Body Is Empty" is set to "On").