Home > Archive > Tcl > October 2004 > ASCII Line graphics in tcl
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ASCII Line graphics in tcl
|
|
| GizmoGorilla 2004-10-20, 8:57 pm |
| I have a text report generator I've written in tcl
for a database I have and Im trying to make the
reports look sharp by creating borders. I dont want
to use characters like | + _ for my boxes. Is it possible
to access the alternate character set that has all the box
drawing characters. Im currently using a listbox to
display my text. If this isnt possible are there any
other possibilities to spruce up my reports with borders
without getting bogged down in graphics.
Thanx
GizmoGorilla
| |
| Erik Leunissen 2004-10-20, 8:57 pm |
| See http://www.unicode.org/charts/PDF/U2500.pdf
for the codes of the unicode characters you need.
Prefix them with a leading "\u" and use them in your tcl I/O commands, like:
puts \u250C\u2500\u2510
This example draws the upper part of the smallest ascii box one can
imagine. I leave it up to you to draw the other half.
HTH,
Erik Leunissen
=============
GizmoGorilla wrote:
> I have a text report generator I've written in tcl
> for a database I have and Im trying to make the
> reports look sharp by creating borders. I dont want
> to use characters like | + _ for my boxes. Is it possible
> to access the alternate character set that has all the box
> drawing characters. Im currently using a listbox to
> display my text. If this isnt possible are there any
> other possibilities to spruce up my reports with borders
> without getting bogged down in graphics.
>
> Thanx
> GizmoGorilla
>
--
leunissen@ nl | Merge the left part of these two lines into one,
e. hccnet. | respecting a character's position in a line.
| |
| GizmoGorilla 2004-10-21, 4:04 pm |
| Erik Leunissen wrote:
> See http://www.unicode.org/charts/PDF/U2500.pdf
> for the codes of the unicode characters you need.
>
> Prefix them with a leading "\u" and use them in your tcl I/O commands,
> like:
>
> puts \u250C\u2500\u2510
>
> This example draws the upper part of the smallest ascii box one can
> imagine. I leave it up to you to draw the other half.
>
> HTH,
>
> Erik Leunissen
> =============
Erik,
Thanks for your response. The chart is great.
Unfortunately I had no success. When I use the
line you suggest I get ??? on the screen.
I've also tried using hex and binary, in
quotes & without. I've tried sending the escape
sequence to select the alternate keys and still
nothing.(I realize that thats a terminal "thing")
Same result if sending to either the
list box as text or to a shell (im using unix).
Surely there must be a way to access the box
graphics characters.
Thanx
Norm
| |
| Bruce Hartweg 2004-10-21, 4:04 pm |
|
GizmoGorilla wrote:
> Erik Leunissen wrote:
>
>
>
> Erik,
> Thanks for your response. The chart is great.
> Unfortunately I had no success. When I use the
> line you suggest I get ??? on the screen.
> I've also tried using hex and binary, in
> quotes & without. I've tried sending the escape
> sequence to select the alternate keys and still
> nothing.(I realize that thats a terminal "thing")
> Same result if sending to either the
> list box as text or to a shell (im using unix).
> Surely there must be a way to access the box
> graphics characters.
>
to use the unicode solution, you need to use a font
that supports it.
Bruce
| |
| Benjamin Riefenstahl 2004-10-21, 4:04 pm |
| Hi Norm,
GizmoGorilla writes:
> Subject: Re: ASCII Line graphics in tcl
<nitpick>
"ASCII" doesn't have line drawing characters. "ASCII line graphics" is
the stuff that you want to avoid (using "+", "-", "|" etc). What you
want (if I understand you right) is to use the *non-ASCII* capabilities
of your terminal.
</nitpick>
> When I use the line you suggest I get ??? on the screen. I've also
> tried using hex and binary, in quotes & without. I've tried sending
> the escape sequence to select the alternate keys and still
> nothing.(I realize that thats a terminal "thing") Same result if
> sending to either the list box as text or to a shell (im using
> unix). Surely there must be a way to access the box graphics
> characters.
I don't have enough time right now to test this, so here are just a
few ideas for now:
fconfigure stdout -encoding name-of-the-encoding
will cause [puts] to convert the internal Tcl string representation to
the encoding that is given. This will probably default to iso8859-1
on your system or to whatever your LANG environment variable
indicates.
[puts] will not send the necessary escape sequences to change the
terminal charset, so you will need to do that yourself. So I would
try something along the lines:
# Some global constants
set escape_alt_charset_on "..."
set escape_alt_charset_off "..."
set terminal_default_encoding [fconfigure stdout -encoding]
set terminal_alt_charset_encoding "..."
proc alt_charset_on {} {
puts -nonewline $::escape_alt_charset_on
fconfigure stdout -encoding $::terminal_alt_charset_encoding
}
proc alt_charset_off {} {
puts -nonewline $::escape_alt_charset_off
fconfigure stdout -encoding $::terminal_default_encoding
}
To complete this you will have to research which escape sequences are
needed and which encoding is actually used by the alternate charset
configuration.
benny
| |
| GizmoGorilla 2004-10-21, 4:04 pm |
| Bruce Hartweg wrote:
> to use the unicode solution, you need to use a font
> that supports it.
Aha!
Yes, I forgot about that. I've done this a few years
ago in assembler and remember that only some fonts
had the line graphics. Memory is ! what it used 2 B.
Thanks, I'll check it out
Norm
|
|
|
|
|