[reportlab-users] outline chars

Tim Roberts timr at probo.com
Thu Oct 6 14:28:21 EDT 2011


R. Bastian wrote:

> Please, how can I write outlined chars ?

>

> (outline of chars in blue and filled with green)


Postscript has the concepts of "stroke" and "fill". Edges are stroked,
and interiors are filled. This is why Reportlab has two different
colors (stroke and fill).

The same concept applies to text, but because outlining is not usually
what you want, the default is only to use "fill" with text. You can
override that when you draw the string. If you are using a textobject,
you use setTextRenderMode. 0 means fill only, 1 means stroke only, 2
means fill then stroke.

So:
cv.setFillColor( (0,1,0) ) # fill with green
cv.setStrokeColor( (0,0,1) ) # stroke with blue
cv.setFont( 'Bookman-Bold', 36 )
cv.drawString( 100, 100, 'Outline', mode=2 )

--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list