Re: text selection



On Tue, 2007-06-26 at 18:27 +0200, Ulrich Mierendorff wrote:
> Hello,
> I am new to the pango api. I want to use pango to draw text(-boxes) with 
> cairo (GUI for gaming). The textboxes are displayed to the screen and 
> the user should be able to select text from the text box with the mouse 
> and put the text curser to any location of the text.
> The mouse coordinates are available as pixels. Does the pango library 
> provide an interface to do text selections for me? (i.e. a function with 
> the mouse coordinates as arguments which returns something like: "Mouse 
> is at text position X", and then I can access my text string/char array 
> at position X (text[X]) to get the char)

Pango does that.  See pango_layout_xy_to_index() and friends:

http://developer.gnome.org/doc/API/2.0/pango/pango-Layout-Objects.html#pango-layout-xy-to-index


> Kind regards
> Ulrich

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759






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