Determining required physical space for a HTML segment
Determining required physical space for a HTML segment
- Subject: Determining required physical space for a HTML segment
- From: Mike Tyson <email@hidden>
- Date: Sun, 13 May 2007 23:07:01 +1000
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