Screen coords for a glyph?

Michael Cole broccole at panix.com
Mon Dec 3 00:35:37 UTC 2001


Yes, this will do it.

Thank you,

Michael

Dan Ingalls <Dan at SqueakLand.org> wrote:
> "Michael Cole"@bestweb.net, broccole at panix.com  wrote...
> 
> >Is there a clever way of learning the position of a specific glyph in a
> >text morph? I'm trying to anchor morphs to specific sections of text and
> >cannot see a means of determining the coordinates apart from
> >recalculating the layout of the text from StrikeFont.
> >
> >If there isn't already a built-in method, is it possible to send a
> >handmorph to an offset in a text (and then have it report its position)?
> 
> I'm about to run out the door, but two imporatnt methods are
> 	NewParagraph>>characterBlockAtPoint:, and
> 	NewParagraph>>characterBlockforIndex:.
> A characterBlock gives you the rectangle of the glyph, and also its string index in the text.  To get the proper recipient, send these messages to, eg,
> 	myTextMorph paragraph.
> 
> Also read the class comment of TextAnchor.  I think Squeak already does what you want.
> 
> Hope this helps.
> 
> 	- Dan




More information about the Squeak-dev mailing list