Cairo: fix TypeError in figure.text() on Python3

Possible fix for https://github.com/matplotlib/matplotlib/issues/2903