[reportlab-users] Reportlab issue list
Robin Becker
robin at reportlab.com
Tue Jan 19 11:33:51 EST 2021
........
>>
>> I think that's doable with a small change in renderPDF.py; whether it is feasable in renderPS / renderPM I don't know.
>
> It would be a step forward, even if it's only for PDF rendering.
>
> Claude
>
Hi Claude,
I have some code that might be worth testing to see if it will work for your purposes. Effectively I have the String
class with an extra attribute textRenderMode as oneof 0,1,2,3,4,5,6,7. This follows the PDF canvas drawString mechanism.
I have modified as well the src/reportlab/graphics/renderPDF/PM/PS.py modules to do the right thing(s). I am not certain
I know about modes >3 in postscript, but I have have done enough in the PM backend with changes in
src/rl_addons/renderPM/_renderPM.c. I haven't done anything on the renderSVG front.
I will check these in on a branch to avoid problems on the trunk if it's all wrong or just supply a patch if that's what
you need for testing.
#So this works for PDF, PNG & PS output
#Autogenerated by ReportLab guiedit do not edit
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String, Line, Path, definePath
from reportlab.lib.colors import blue, red, green, yellow
from os import environ
class Drawing_000(_DrawingEditorMixin,Drawing):
def __init__(self,width=400,height=200,*args,**kw):
Drawing.__init__(self,width,height,*args,**kw)
trm = int(environ.get('TRM','2'))
self._add(self,String(70,10,'text',fontSize=80,fontName='Helvetica',fillColor=blue,strokeColor=red,
strokeWidth=1.5,textRenderMode=trm),name='S0',validate=None,desc=None)
self._add(self,Line(40,40,70,70,strokeWidth=0.5,strokeColor=green),name='L0',validate=None,desc=None)
self._add(self,definePath([('moveTo',80,80),('lineTo',110,110),
('lineTo',80,110),'closePath'],fillColor=None,strokeWidth=2,strokeColor=yellow),
name='P0',validate=None,desc=None)
if __name__=="__main__": #NORUNTESTS
Drawing_000().save(formats=['pdf','png', 'ps'],outDir='.',fnRoot=None)
I guess svglib could leverage this to fix your issue.
--
Robin Becker
More information about the reportlab-users
mailing list