Re: Pango in Gnome-terminal, zvt Terminal widget

Chookij Vanatham <chookij vanatham eng sun com> writes:

> Hi Owen,
> Is there any plan to use Pango in Gnome-terminal and zvt Terminal widget ?

In general, I'd say that using Pango in a terminal widget is a
difficult thing to do.

This has to do mostly with the Pango font API. Pango does not export a
fully general font API; instead, what it does is export the necessary
parts of a font API for selecting fonts. Most of the actual API for
handling the metrics, encoding, etc, of a font is hidden inside
shaper modules. 

The reason that Pango does not have a low level font API is that
because Pango works with many different font systems, any common font
API would expose only a small subset of any systems functionality, and
would not be very satisfactory.

But a terminal is enough different from displaying normal text that I
think trying to use the Pango layout APIs is going to be difficult.
This does depend on your goals: a terminal that just handles shell
commands is easy enough, but a terminal that can handle curses
programs has to deal with positioning in a way that is very different
from continuous text.

(I actually don't have much of a sense of how a terminal should
behave in the presence of bidirectional and complex text, so
I might be very wrong about this) 

My general feeling is that gnome-terminal should probably continue to
use traditional X fonts directly until a common replacement font API
for Linux is agreed upon (at this point, it looks like it will be
based on client-side fonts and FreeType), and then it should be
written to use that API directly. I don't think using Pango is really

Some of that general approach is being done for xterm and XFree86

 - Much work has been done to make xterm handle utf-8 and
   double width characters. (But no bidi support)

 - Keith Packard did an initial implementation of anti-aliased
   rendering using FreeType and his Xrender extension. 

The same sort of things could be done for gnome-terminal - in fact
there is some simple UTF-8 code in the CVS version, and a patch for
double-width characters does exist.

But unfortunately, the zvt widget code base is pretty hard to work
with and not very cleanly written. Its sort of a shame that when a
from-scratch rewrite of xterm was doing, the result was (IMO) worse
code than xterm, not better.

My attempts to fix bugs in the zvt widget have not met with much
success in general, and I'd be worried about adding new features
without doing a lot of rewriting of at least the display engine, and
perhaps some of the escape-sequence parsing as well.

But Pango doesn't really support the kind of char-cell model that you
need for a terminal emulator, and I think that trying to use it for
that purpose would turn out to be a fairly big headache.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]