Re: gdtk_draw_text deprecated , what use instead of it ?



On Mon, Jan 05, 2004 at 12:12:19AM +0000, Paul Pogonyshev wrote:
I don't want to look into actual code, but let's say PangoLayout renders
text in this abstract way:

      while (paragraph = feed_me_paragraph(layout)) {
        while (line = feed_me_line(paragraph)) {
          while (character_span = feed_me_character_span(line))
            do_draw_character_span(character_span);
        }
      }

This is an exceptionally simplified view of text layout, and may explain
why you think PangoLayouts are unnecessary.  :)

So, there would be two ways of implementing a gdk_draw_text()-like, but
with Pango backend, function.  Either (code is descriptive only)

      layout = pango_layout_new();
      pango_layout_set_text(layout, text);
      gdk_draw_layout(layout);

or simply

      do_draw_character_span(text);


I think you're missing the point of Pango.  As I understand it, it needs
to process back and forth across the text to lay it out, potentially
doing things like combining nearby characters into single glyphs.  You
need to do this to even to calculate the width of a line.

(Does this seem excessive?  Consider the perspective of a CJK-only
programmer:  "No matter the font, the width in pixels of a line is just
the width of a character multiplied by the character width!  Why must
English/German be all complicated and require iterating through every
character and summing their widths, (then doing complicated kerning
processing on character pairs)?")

Anyway: do_draw_character_span, to do its processing, would need to
calculate and fill up a PangoLayout's worth of information.

-- 
Evan Martin
martine danga com
http://neugierig.org



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