[Pythonmac-SIG] PyObjC and Quartz - CGContextShowGlyphsAtPoint

Rand Dvorak randdvorak at gmail.com
Mon Apr 29 01:13:43 CEST 2013


Hello, 

I was wondering if any would could help with a issue I'm having with some PyObjC and Quartz.  I have a class the creates a pdf contact sheet from a list of images.  I have the need to include bar codes along with each image.  On the sheet is text with the filename of each image and I need to add a barcoded filename along with it.  To this end I downloaded some barcode fonts and am trying to use CGContextDrawTextAtPoint(...) to draw the barcode but am not having any luck.  Through some research I determined that I need to call CGContextDrawGlyphsAtPoint(...) instead, but cannot figure how to get the glyphs to to draw.  I tried just using the bare string, but am getting this error.   

    CGContextShowGlyphsAtPoint(c, 5, 5, self.string.cStringUsingEncoding_(NSUTF8StringEncoding), len(self.string))
ValueError: depythonifying 'unsigned short', got 'str'

Any ideas on how to achieve what I am trying to accomplish here?  Any info would be much appreciated.

Thanks,

Rand


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20130428/4d68c892/attachment.html>


More information about the Pythonmac-SIG mailing list