• 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
Re: howto draw math forumulas
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: howto draw math forumulas


  • Subject: Re: howto draw math forumulas
  • From: Bill Dudney <email@hidden>
  • Date: Mon, 15 Jan 2007 15:31:29 -0800

Hi William,

Sorry I misread your question, as Peter points out Bezier Path would allow you to plot the equation not draw it.

To typeset there are tons of options but none of them are a cake walk, if the PDF generator works for you as pointed out by Chris then I'd go with that. You could then use an NSImage to render the PDF into your view.

Assuming you've rendered the pdf to a file called myequation.pdf and added it to your XCode project as a resource you could use;

@impl MyView
...
- (void)drawRect:(NSRect)rect {
...
NSImage *equation = [NSImage imageNamed:"myequation"]
NSSize equSize = [equation size];
NSRect equRect = NSMakeRect(0.0f, 0.0f, equSize.width, equSize.height);
[equation  drawAtPoint:NSMakePoint(100.0f, 100.0f) fromRect:equRect operation:NSCompositeSourceOver fraction:1.0f];
...
}
...
@end

If you want to generate them dynamically at runtime you could look into the latex engine and do something similar to the PDF Equation app that Chris found (the src is avalible too so perhaps you could encorperate it into your app, check the license though).

HTH,

-bd-

On Monday, January 15, 2007, at 04:14PM, "Chris Suter" <email@hidden> wrote:
>
>On 16/01/2007, at 10:09 AM, Peter Seibel wrote:
>
>> On Jan 15, 2007, at 1:36 PM, Bill Dudney wrote:
>>
>>> Hi William,
>>>
>>> Take a look at NSBezierPath.
>>
>> Mmmmm, I'm no expert but wouldn't this be better suited for
>> plotting the function. I think the OP was interested in displaying
>> a textual representation of the function, thus his references to
>> subscripts, brackets, etc. Or maybe NSBezierPath has typesetting
>> capabilities I'm not aware of. (Seriously, I'm quite new to Cocoa
>> programming so it might.)
>>
>> -Peter
>
>You could try rendering what you want to a PDF and then using a
>PDFView. I don't have any experience with doing that so I don't know
>how well it would work, if at all.
>
>This looks like it might create the PDF for you:
>
>http://www.apple.com/downloads/macosx/math_science/pdfequation.html
>
>- Chris
>_______________________________________________
>
>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

References: 
 >howto draw math forumulas (From: "William Zumwalt" <email@hidden>)
 >Re: howto draw math forumulas (From: Bill Dudney <email@hidden>)
 >Re: howto draw math forumulas (From: Peter Seibel <email@hidden>)
 >Re: howto draw math forumulas (From: Chris Suter <email@hidden>)

  • Prev by Date: setKeys + array operators = slowdown
  • Next by Date: WebView makes NSOpenGLView glitchy on MacBook
  • Previous by thread: Re: howto draw math forumulas
  • Next by thread: Re: howto draw math forumulas
  • Index(es):
    • Date
    • Thread