Re: NSView subclass never gets dealloced?
Re: NSView subclass never gets dealloced?
- Subject: Re: NSView subclass never gets dealloced?
- From: Brock Brandenberg <email@hidden>
- Date: Sat, 30 Mar 2002 14:14:05 -0600
Hi Erik.
Well, you can buy the book that I co-wrote.
Funny you'd mention that. I ordered the book long ago and got a recent
notice that the publication date was pushed back to May. Bummer. At
least now I can make the name association :)
so now I'm looking for those examples of extracting glyph outlines from
fonts, getting PDF information from files into a graphics context as
I posted just such an example of getting the outline path of a glyph to
this
forum months ago. There is also the CircleView example from Apple that
does
this. Parsing PDF is non-trivial. Consider using XML and open standards
instead. (SVG)
We've looked at CircleView, so I'll look up your example too. We've
already implemented several methods, but not without first running into
limitations of NSTextView drawing the glyphs in a window. NSTextView
doesn't place the first glyph well, so the padding and location of the
first glyph causes clipping of some descenders (like "f" in Zapfino).
Apparently you can change the first glyph location, but the docs
discourage use of the function and I couldn't make it work properly
anyway (something must be relocating it after I change it). We've ended
up using a custom NSView that draws glyphs using the
CGContextShowGlyphsAtPoint() function so that we have full control over
bounding/clipping rects (I've also kept 4 or 5 snippets of alternate
methods, even methods as odd as using the appendBezierPathWithGlyphs:
function and drawing the paths). We have numerous NSView subclasses with
frames that match the exact bounding rect of the glyphs (not the
selection rect), that are instantiated at runtime to draw over a
background of other PDF objects brought in from external files. The
result ends up being a retail sign with automatic type layout from
tabular data.
vectors rather than an imaged pixmap, and ways to save PDF data to a
file using Cocoa rather than the Adobe library or a gnu library. Which
NSView provides the ability to save vector graphics in PDF files. Every
Cocoa application has this capability.
Sure. The issue that I'm really having is getting a PDF into our NSView
as vector data, not imaged data. When drawing a PDF using NSImage, the
PDF is rasterized into the NSView and saved out as bitmap data in the
dataWithPDFInsideRect: function. I'd like the PDF to stay in vector form
when the NSView is saved to PDF.
I think dealloc is called in the case you describe if the window is
realeased when closed.
Correct. Dealloc is called if you "release when closed." but is not
being called if this IB option is not checked.
Quiting an application may not automatically close
all open windows, but I think it does. NSApplication maintains a list
of
windows that belong to the application.
It doesn't appear to be automatically closing all open windows. But
that's what a window controller is for and it's obvious that we haven't
spent enough time on the overall structure of our app yet. We've been
focused on the core functionality that we had to make sure that we could
overcome before we committed to a full Cocoa app. We needed type
handling, ligatures, access to glyph data and output as PDF data, so
we've been simply slamming pixels into NSViews and working on polygon
containment routines rather than app structure so far.
Now that most of this is working, I need to turn to properly
architecting the app. Bot, a better Cocoa book would be useful right
now...
Thanks,
Brock
----- industrial design @ bergdesign.com ------
_______________________________________________
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.