[reportlab-users] outline chars

R. Bastian rbastian at free.fr
Fri Oct 7 07:06:44 EDT 2011


On Thu, 6 Oct 2011 11:28:21 -0700
Tim Roberts <timr at probo.com> scribit:


> 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 )


... and cv.setLineWidth(2.5)
to set the width of the stroke.

Thanks, Tim.


>

> --

> Tim Roberts, timr at probo.com

> Providenza & Boekelheide, Inc.

>

> _______________________________________________


--
René Bastian
www.pythoneon.org
www.musiques-rb.org


More information about the reportlab-users mailing list