There is no Ruby workaround. What I currently do is I have a workaround subclass of CATextLayer that takes an explicit type instead of NSCFType and subclass/use that from MacRuby.
% cat CALayerWorkarounds.h #import <Cocoa/Cocoa.h> #import <QuartzCore/QuartzCore.h> @interface WorkaroundTextLayer : CATextLayer - (void)setFontObject:(NSFont *)font; @end % cat CALayerWorkarounds.m #import "CALayerWorkarounds.h" @implementation WorkaroundTextLayer -(void)setFontObject:(NSFont *)font { self.font = font; } @end Met vriendelijke groet, Eloy Durán On Mar 23, 2011, at 4:20 AM, Matt Aimonetti wrote: > The work around would be to create a pointer: > > irb(main):005:0> font = NSFont.systemFontOfSize(NSFont.systemFontSize) > => #<NSFont:0x200b25300> > irb(main):006:0> layer = CATextLayer.new > => #<CATextLayer:0x200b22f80> > irb(main):007:0> layer.font = font > TypeError: expected instance of Pointer, got `#<NSFont:0x200b25300>' (NSFont) > Instead of setting the font directly try something like that: > > font_pointer = Pointer.new("@") > font_pointer[0] = font > layer.font = font_pointer > > I'm not in front of a computer so I can't test but I'd be curious to know if > that works for you. > > - Matt > > > Sent from my iPhone > > On Mar 22, 2011, at 20:11, Ben Koski <ben.ko...@gmail.com> wrote: > >> I'm having trouble trying to set the font property on a CATextLayer using >> the latest version of macruby. >> >> I've noticed that there is already a ticket for an issue when trying to set >> the font using a NSFont instance (http://www.macruby.org/trac/ticket/1114). >> >> I tried using CGFontCreateWithFontName('Georgia') to create the font >> reference, with similar results (expected instance of Pointer, got >> `#<__NSCFType:). CTFontCreateWithName didn't work either. >> >> Does anyone here have an ideas/suggestions for workarounds? The rest of the >> CATextLayer properties seem to work fine, it's just font that causes errors. >> >> Ben >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel