See the second message with more specifics and code, I was able to get it 
working by translating this objective-c code:  

http://www.gogo-robot.com/2009/06/07/two-awkward-things-about-iphone-development/

into this code:

def draw(self,c):
        length = len(self.string)
        glyphs = objc.allocateBuffer(length)
        chars = objc.allocateBuffer(length + 1)
        self.string.getCString_maxLength_encoding_(chars, length + 1, 
NSASCIIStringEncoding)
        for i in range(length):
                glyphs[i] = chr(ord(chars[i]) - 29)
        CGContextSaveGState(c)
        CGContextSetFont(c, self.font)
        CGContextSetFontSize(c, self.size)
        CGContextSetRGBFillColor(c, 0, 0, 0, 1)
        CGContextSetRGBStrokeColor (c, 0, 0, 0, 1)
        CGContextSetTextMatrix (c, self.xform)
        CGContextShowGlyphsAtPoint(c, 0, 0, glyphs, length)
        CGContextRestoreGState(c)

changing:
        CGContextShowGlyphsAtPoint(c, 0, 0, glyphs, length)

to:
        CGContextShowGlyphsAtPoint(c, 0, 0, tuple(map(ord, glyphs)), length)

Sadly, CTFontGetGlyphsForCharacters(...), doesn't seem to be in the 
bridgesupport on 10.6 and I still need to support it.  A CGGlyph is apparently 
an unsigned short, so a char array returned by objc.allocateBuffer() seems to 
suffice.

Thanks for your help.  



        
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to