Re: [Silgraphite-devel] Re: Pango and SILGraphite was Re: Possible Pango 1.4 ideas



ftang netscape com (Yung-Fong Tang) writes:

> BTW more on-progress study note about Pango and GTK/GDK is posted under
> http://people.netscape.com/ftang/paper/How_does_GDK_and_GTK_calling_Pango.html
> 
> I just spend about 60 minutes to do egrep on gtk/gdk to get this. I
> have no in-depth knowledge about the "real relationship" between them
> yet.
> 
> Owen:
> Does pango provide both kinds (one accept character code and another
> accept glyph code) for upper level components (say gdk/gtk) to called?
> If it does, can you give me some hint which functions I should take a
> look at first? Thanks
> 
> I assume Gtk only provide api to upper level componts for character
> drawing, but do not provide api for glyph drawing, right ?

The Pango application interfaces divide more or less into two layers:

 1. High-level interface
    PangoLayout
    PangoAttrList
    PangoFontDescription
    [etc]

 2. Low-level interface
    PangoFont
    PangoItem
    PangoGlyphString
    [etc]

The high-level interface is pretty much purely character based; once
you've laid-out a paragraph of text using PangoLayout, you can get the
positions of individual elements of the Paragraph (pango_xy_to_index,
PangoLayoutIter, etc.), but that's about the only sub-paragraph access
you have.

GTK+ and GDK work pretty much completely with the high-level interface;
the only partial exception to this is the code for actually drawing
Pango objects to the screen which touches the lower level interfaces 
a bit.

There are various good reasons for sticking to the higher level
interfaces:

 - They are a whole lot easier to use
 - They are much cleaner; the low level interfaces are not my
   proudest moment of API design.
 - Once you start talking to the lower levels, there is a lot of 
   complicated driver code from PangoLayout which has to be duplicated.
 - If we ever do an Pango-2.0 with API changes, it's likely that the 
   high level interfaces will be untouched, but the low level
   interfaces will change significantly.

That being said, various people have used Pango at a more-raw level
when creating HTML widgets (GtkHTML2 and GtkHTML3) that use Pango.

Even at the lower level, it should be pointed out that Pango still
is a paragraph-based system. You don't get access to simple
"draw_character()/draw_glyph()" type API's; you just get more detailed
access to the internals of how drawing a paragraph of text works.

Glyph codes are actually opaque integers in the Pango system; there
is no exported relationship at the application level between a Glyph
code and anything externally meaningful, though it happens that
for the Xft and FT2 backends, the Pango glyph code matches the 
TrueType glyph index.

I'm not sure if the above answers your questions, but it hopefully
will help get you oriented a bit more.

Regards,
                                        Owen



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