pretty printing, missing characters in unicode

閲覧: 59 回
最初の未読メッセージにスキップ

Ondrej Certik

未読、
2008/06/14 17:30:172008/06/14
To: sy...@googlegroups.com
Hi,

I was looking more at how the unicode printing could be leveraged even
more than what we are currently doing. I found some pretty neat
examples, for example:

http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt

This is best viewed in vim (for example) in the terminal. Then I tried
to encode some common formulas, that I need, for example:

In [19]: print u"\u00BD\u2202\u1D66\u03C6\u2202\u1D5D\u03C6"
½∂ᵦφ∂ᵝφ

That looks pretty good. However, if I wanted to change \beta to \mu, I
didn't find a way to do it, as I didn't find a subscript \mu in
unicode. See here what is available and what not:

http://en.wikipedia.org/wiki/Superscript#Unicode

I don't understand, why the full superscript latin lowercase alphabet
is available except q... And why only 8 latin letters are available as
subscripts.
Otherwise there seem to be characters for pretty much everything I
need in 95% of cases. I just looked at my recent notes in TeX that I
put here:

http://code.google.com/p/sympy/issues/detail?id=884#c21

and I think all the formulas could be drawn by the current SymPy
prettyprinter if we could fix the above missing characters in
sub/superscripts. Does anyone know how to do it? Kirill?

If unicode is truly missing them, I think it will be worthy to add
them somehow, e.g. propose some unicode positions for them, and create
an example font, that can be used in a terminal. I think it doesn't
have to be particularly hard, it's probably just that noone has needed
the characters so far. That would greatly increase the usability of
our pretty printer. Then I could manipulate almost all expressions I
need in ipython and having them print nicely in a terminal. I like
terminals, I don't think anyone has invented anything better in the
last 30 years. :)

Ondrej

Kirill Smelkov

未読、
2008/06/28 9:54:242008/06/28
To: sy...@googlegroups.com

:)

I completely agree.

It seems not all needed character/glyphs have their entries in unicode,
so we should push unicode.org (which we do) to include them.

As to fonts - I think it shouldn't be difficult to get super or
subscript character with fontforge basing on its normal glyph.

Let's push unicode.org all together:

http://www.unicode.org/mail-arch/unicode-ml/y2008-m06/0062.html

--
Всего хорошего, Кирилл.


P.S. sorry for long delay in replying to this.

Ondrej Certik

未読、
2008/06/29 19:01:522008/06/29
To: sy...@googlegroups.com

Yes, I got quite some responses, as you can read there and here is my
reply to that:

http://www.unicode.org/mail-arch/unicode-ml/y2008-m06/0103.html

and Kirill's comments here:

http://www.unicode.org/mail-arch/unicode-ml/y2008-m06/0124.html

There were no more objections (but maybe some will still come), so I
sent another email. It takes it a long time to appear in the archives,
so I am quoting the most important part here:

------------

I think we need to follow the rules here:

http://www.unicode.org/pending/proposals.html

Especially read the "Interim Solutions". After readingt it, I think
what we should do is that we'll start with adding the characters in
the Private Use Area and make sure that our application SymPy (e.g.
Python) can show them just fine in the terminal. After we have this,
we'll have the exact idea what stuff needs to be fixed/patched and we
can propose adding them officially into some non Private Use Area of
unicode.

------------

Ondrej

Ondrej Certik

未読、
2008/08/08 8:52:282008/08/08
To: sy...@googlegroups.com
> I think we need to follow the rules here:
>
> http://www.unicode.org/pending/proposals.html
>
> Especially read the "Interim Solutions". After readingt it, I think
> what we should do is that we'll start with adding the characters in
> the Private Use Area and make sure that our application SymPy (e.g.
> Python) can show them just fine in the terminal. After we have this,
> we'll have the exact idea what stuff needs to be fixed/patched and we
> can propose adding them officially into some non Private Use Area of
> unicode.


So the conclusion in the unicode list was that sub and superscripts
*doesn't* belong to unicode, those that are in are there for
historical reasons only. The way we should accomplish our goal is to
extend terminal capabilities. Currently terminals can handle colors,
bold, italics and underscore. So we should also add sub and
superscripts escape sequences and patch gnome-terminal (and other
terminals) to display it.

E.g. isympy should query the terminal version, if that is possible and
only use the new escape sequences if the terminal supports it.

Ondrej

Kirill Smelkov

未読、
2008/08/08 8:55:312008/08/08
To: sy...@googlegroups.com

Btw, one can do cool things even with existing terminals.

Good news: for example w3m (apt-get install w3m w3m-img) can show images
(screenshot attached)

Bad news: i think that how this is done is very hackish an unreliable.

--
Всего хорошего, Кирилл.

w3m-img-google-ru.png

Ondrej Certik

未読、
2008/08/08 9:08:302008/08/08
To: sy...@googlegroups.com

Man!! I've never seen anything like this. How do they do it?

But it doesn't seem to work over ssh (i.e. when running w3m on another
computer).

Ondrej

Kirill Smelkov

未読、
2008/08/08 9:11:452008/08/08
To: sy...@googlegroups.com

:)

They use hacks:

- first they detect whether a terminal (any terminal!) is running under
X
- then they do:
o crete another X surface
o XCopyArea to terminal window, carefully calculating position
where to blit.

But try to take another window and to move it around it and overlapping.
You'll see thy this is unreliable.

> But it doesn't seem to work over ssh (i.e. when running w3m on another
> computer).

It works, but because it requires X you need to use 'ssh -X'

--
Всего хорошего, Кирилл.

全員に返信
投稿者に返信
転送
新着メール 0 件