Re: mixed pango/foreign layout



On Mon, 2004-02-02 at 22:46, Luca Padovani wrote:
> Hi,
> 
> I'd like to interleave some text layed out by pango with foreign objects
> which are layed out by a distinct rendering engine. Now, assuming I can
> handle (or ignore) issues like text direction, what is the most
> efficient and easy way of doing this?
> 
> Currently I split the text at word boundaries and use pango to layout
> each single word, thus generating a large amount of PangoLayout objects.
> But this turns out to be rather slow. I haven't found a way of inserting
> foreign objects into a pango layout (which would be rather hard to
> implement I guess), so I'm wondering if there's another way like, dunno,
> having a way of splitting the text in the largest possible chunks so as
> to minimize the number of layout objects to create (there would be
> issues with indentation and line spacing which I'm not sure could be
> solved with the current API).
> 
> I'm aware that what I'm trying to do somehow goes beyond what pango has
> been designed for. (Un)fortunately there are contexts where plain text
> is interleaved with other stuff (math formulae in my case), it would be
> a pity if the valuable pango library turns out to be useless in such
> cases.

This is possible, in some sense at least. Check out the gtk-demo
textview demo, it has widgets and pixbufs inside the text (which are
pangolayouts). The way its done is to insert a character in the text and
set the "Shape" attribute on the character. The shaper will then leave
this area unpainted and you can do whatever you want with it.

I'm not sure on all the details, but check out how GtkTextView does it. 
 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an underprivileged overambitious ex-con haunted by an iconic dead 
American confidante She's a cold-hearted tomboy fairy princess operating on 
the wrong side of the law. They fight crime! 




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