Re: Getting accurate bounds for glyph range
Re: Getting accurate bounds for glyph range
- Subject: Re: Getting accurate bounds for glyph range
- From: Jeremy Dronfield <email@hidden>
- Date: Tue, 2 Mar 2004 20:25:42 +0000
On 2 Mar 2004, at 6:39 pm, Douglas Davidson wrote:
On Mar 2, 2004, at 9:56 AM, Jeremy Dronfield wrote:
I'm experimenting with Matt Gemmell's Rounded Floating Panel, using
it to display text instead of icons (sort of like the Large Type
display in Address Book). To this end, I've inserted a transparent
text view in place of the image view supplied. The point where I run
into trouble is getting the text view to resize accurately to the
bounds of its text storage. The following code represents my latest
desperate attempt to achieve this:
Two things you should keep in mind: first, the text view's coordinate
system is not the same as the text container's coordinate system, and
the layout manager always works in the container's coordinate system.
The difference is an offset, obtained by querying the text view for
its text container origin. Second, the text container supplies
padding on the left and right for each line fragment; this padding is
included in the used rect, but you may find that it is not appropriate
for your situation--for example, it is not used in string drawing,
because it is not appropriate there. You may wish to set the padding
to 0.
Thanks. Those coordinate systems floor me every time. For the moment,
I've fallen back on using an NSTextField. This works fine for my
immediate purposes, but I'll probably have to come back to NSTextView
later if my display requirements get more elaborate. I'll keep your
advice handy for when I do.
-Jeremy
========================================
email@hidden
theLocustFarm.net:
- fractious fiction at
http://freespace.virgin.net/jeremy.dronfield
========================================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.