• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Determining required physical space for a HTML segment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Determining required physical space for a HTML segment
      • From: Michael Tyson <email@hidden>
    • Re: Determining required physical space for a HTML segment
      • From: Dominik Pich <email@hidden>
  • Prev by Date: Re: Artifacts in toolbar
  • Next by Date: Link to call me for free
  • Previous by thread: Problem with Duplicate Notifications, possibly due to bad dealloc and init of document controller & window controller
  • Next by thread: Re: Determining required physical space for a HTML segment
  • Index(es):
    • Date
    • Thread