CocoaDev

Edit AllPages

Describe NSTextFieldCellSubclassandfontproblem here.

Im developing a font managment software in cocoa, and im having problems with the preview of the fonts.

For the preview Im using a NSTableView, with a subclass of NSTextFieldCell. In this subclass I draw the name of the font and a text example with the font.

The problem is after I preview the font in a cell, i can�t deactivate it. It seems like the NSFont object used in the cell is not released and dont allow to deactivate the font.

The NSTextFieldCell Subclass code:

@implementation TextPreviewCell

}

For activating the font Im using:

err = ATSFontActivateFromFileSpecification(&fspec, kATSFontContextGlobal, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, &id_fuente);

And for deactivating:

ATSFontDeactivate(id_fuente, NULL, kATSOptionFlagsDefault);

If I activate the font without preview in the table, works fine, activating and deactivating the font.

I note that if I put a NSLog in the dealloc method of my NSTextFieldCell subclass, it sends the log when i click in the row or when i move the scrolls, but it not log when I reload data in the data source of the NSTableView, but the rows are deleted and the new data is displayed. �are those cells deallocated?.

Sorry for my English and thanks.

C�sar Escolar