[cairo] text with outline ?

Simon Burton simon at arrowtheory.com
Mon Jan 22 13:55:29 PST 2007


Is there a smarter way to draw text with an outline ?

def outline_text(ctx, x, y, txt):
    ctx.set_source_rgba(1, 1, 1, 1)
    for _x in (x-1, x+1):
        for _y in (y-1, y+1):
            ctx.move_to(_x, _y)
            ctx.show_text(txt)
            ctx.stroke()
    ctx.set_source_rgba(0, 0, 0, 1)
    ctx.move_to(x, y)
    ctx.show_text(txt)
    ctx.stroke()



Simon.


More information about the cairo mailing list