in reply to Shameless plug and QR japh
It took me quite a bit to get the labyrinth on my homenode cavac sort of working. And it only displays correctly on Google Chrome (using Ubuntu 20.04 here, might look different on other operating systems with different fonts installed. And i am using pre tags, not code tags.
One way to render it better on PerlMonks would be to use a HTML table with colored cells. Something like this:
<table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20px" height="20px" bgcolor="white"></td><td width="20px" h +eight="20px" bgcolor="black"></td><td width="20px" height="20px" bgco +lor="white"></td><td width="20px" height="20px" bgcolor="black"></td> </tr><tr> <td width="20px" height="20px" bgcolor="black"></td><td width="20px" h +eight="20px" bgcolor="white"></td><td width="20px" height="20px" bgco +lor="black"></td><td width="20px" height="20px" bgcolor="white"></td> </tr> </table>
Which will give you:
So, to generate a (mostly) PM compatible version, you would do something like this:
#!/usr/bin/env perl use strict; use warnings; use Text::QRCode; my $qr = Text::QRCode->new()->plot("YAPH"); my $black = '<td width="15px" height="15px" bgcolor="black"></td>'; my $white = '<td width="15px" height="15px" bgcolor="white"></td>'; print "<p> </p>;\n"; # Add "silent zone" print '<table border="0" border="0" cellspacing="0" cellpadding="0">', + "\n"; foreach my $line (@{$qr}) { print "<tr>"; foreach my $elem (@{$line}) { if($elem eq '*') { print $black; } else { print $white; } } print "</tr>\n"; } print '<\table">', "\n"; print "<p> </p>;\n"; # Add "silent zone"
Resulting in a somewhat useable QR code:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Shameless plug and QR japh
by ambrus (Abbot) on Apr 08, 2022 at 13:04 UTC | |
by hippo (Archbishop) on Apr 08, 2022 at 13:35 UTC | |
by choroba (Cardinal) on Apr 08, 2022 at 20:21 UTC | |
by jdporter (Paladin) on Oct 20, 2023 at 13:18 UTC | |
Re^2: Shameless plug and QR japh
by cavac (Prior) on Apr 08, 2022 at 12:04 UTC | |
by cavac (Prior) on Apr 08, 2022 at 13:19 UTC |