blampe / goat

Render ASCII art as SVG diagrams
MIT License
640 stars 39 forks source link

Consider reading unicode arrow or line characters #2

Open samliddicott opened 7 years ago

samliddicott commented 7 years ago

Have you considered limited support for reading and interpreting unicode characters?

U+00B7 middle dot could be used for dotted lines, instead of hyphen

Or, using math symbols: http://jrgraphix.net/r/Unicode/2200-22FF U+22EE ⋮ vertical 3 dots U+22EF ⋯ horizontal 3 dots U+22F0 ⋰ dotted slash U+22F1 ⋱ dotted backslash

Box drawing lines: http://jrgraphix.net/r/Unicode/2500-257F (includes rounded conrners, diagonal crossover etc).

Unicode arrows: http://jrgraphix.net/r/Unicode/2190-21FF Supplementary arrows A: http://jrgraphix.net/r/Unicode/27F0-27FF Supplementary arrows B: http://jrgraphix.net/r/Unicode/2900-297F (oh my eyes)

I realise that there could be no end to this, and "almost" with so many symbols and a fixed-width font, who needs SVG... (Me, me, I need SVG).

dmullis commented 2 months ago

Note that some Unicode characters do not conform to the standard 2:1 height:width aspect ratio. Worse, the non-conformity is specific to individual fonts. See examples/unicode.txt.

Consistent aspect ratio in the incoming text rectangle is a hard requirement, regardless of whether a Unicode character is to trigger graphical output in the SVG, or merely passed through as text annotation.

So, there may be value in additional Unicode support, but how to adequately test against whatever fonts may be found "in the wild" remains problematic.

dmullis commented 1 month ago

Experimenting shows that the following have dimensions same as common alnums in a variety of the fonts installed on Ubuntu:

│ BOX DRAWINGS LIGHT VERTICAL ─ BOX DRAWINGS LIGHT HORIZONTAL

It may be possible to treat these as variants of '|' and '-' that select an alternate line style on SVG output.

A caveat is that the BOX DRAWINGS plane seems to contain no diagonals suitable to code for '/' and '\' rendered in an alternate SVG style.