[cairo] Fw: bitrot of the python freetype example (Re: cairo Digest, Vol 141, Issue 29)

Hin-Tak Leung htl10 at users.sourceforge.net
Sat Apr 22 12:59:15 UTC 2017

 Date: Sat, 22 Apr 2017 10:21:22 +1200
 From: Lawrence D'Oliveiro <ldo at geek-central.gen.nz>
 To: cairo at cairographics.org
 Subject: Re: [cairo] Fw: bitrot of the
 python freetype example

 On Fri, 21 Apr 2017 16:41:06 +0000
 (UTC), Hin-Tak Leung wrote:
> > If I comment out the section added
 by Lawrence D'Oliveiro, (the whole
> > "if
 _cairo_so.cairo_font_face_get_user_data ... #endif" clause),
> > it sgefault inside freetype ...
That's perhaps the whole problem with that code. I need to google to find out what "PEBKAC" is. Sometimes it is trying to be too clever, and not clear enough as a customizable "cookbook" example.

For example, instead of using 20 lines, 10 which is a cryptic comment, and another 10 which sets up the automatic clean-up code, perhaps a couple of lines at the beginning of the main body to keep the reference, and another few lines towards the end to drop the refernce, both manually, would make the example easier to use and customize.

I am talking about re-organizing the code somewhat along the line of:

cr_face = _cairo_so.cairo_ft_font_face_create_for_ft_face()
... main body...

That's one way that code might be improved, at least in one direction; it would be shorter perhaps also... shorter is good, right?   

More information about the cairo mailing list