When calling log2vis on Arabic text with joining using fribidi 0.19.1, fribidi inserts filler chars that need to be removed by calling fribidi_remove_bidi_marks per the exchange here http://lists.freedesktop.org/archives/fribidi/2009-March/000559.html. This patch adds an optional "clean" keyword argument. If set to 1 or True, fribidi_remove_bidi_marks is called after log2vis. The default is 0 or False so that the standard behavior does not change.
This patch includes the changes for the patch to bug 2676136.
Patch for pyfribidi.c and pyfribidi.h