Re: Determining required physical space for a HTML segment
Re: Determining required physical space for a HTML segment
- Subject: Re: Determining required physical space for a HTML segment
- From: Dominik Pich <email@hidden>
- Date: Sun, 13 May 2007 15:42:23 +0200
I think you are too optimistic but if there is indeed a way I'd be
interested in it too!
Regards,
Dominik
On May 13, 2007, at 3:07 PM, Mike Tyson wrote:
Hi!
I'm working on an application that, among other things, involves
the layout of items in HTML segments. I'm going to be using an
algorithm that searches through the set of possible layouts for an
optimum.
In order to do that though, I first need to calculate the space
each HTML segment requires, and preferably for several different
aspect ratios.
I see that this can be performed using plain text, at a given font/
size using NSLayoutManager (http://developer.apple.com/
documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html).
This is a good start, but I would like to be able to apply it to
HTML, which is far less well-behaved and homogenous.
Does anyone know of a way to take a (rebellious) chunk of HTML
(possibly containing images, and maybe even flash content, and
maybe with some accompanying CSS) and, for example, a desired
width, and return the minimum dimensions (bounds rectangle)
required to display that chunk with that width (or closest to it)?
That is, something like:
- (void)requiredDimensionsForWidth:(int)width htmlSegment:(NSString
*)htmlSegment result:(NSSize *)size
or
- (void)requiredDimensionsForHeight:(int)width htmlSegment:
(NSString *)htmlSegment result:(NSSize *)size
Am I being too optimistic?
Many thanks in advance,
Michael
--
Michael Tyson | michael.tyson.id.au
m: (+61) 0407 754 124
e: email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden