Makes text as clipping masks work

WIP. Fixes #732.