[reportlab-users] some questions about renderPM

Robin Becker reportlab-users@reportlab.com
Fri, 16 Jan 2004 09:04:50 +0000


In article <20040116065147.47241.qmail@web15207.mail.bjs.yahoo.com>,
=?gb2312?q?=FFffffca=FFffffbf=FFffffb7=FFffffbc=20=FFffffcd=FFfffff5?=
<wangshifang_2008@yahoo.com.cn> writes

Hi, the latest version of _renderPM.c does support various freetype font
formats. Basically if the font is registered using ttfonts then renderPM
may be able to use it if freetype likes it.


You can get the latest code from CVS or a win32 binary from

http://www.reportlab.com/ftp/win32-dlls/

As for chinese fonts I'm not certain. If they work for PDF then they may
work for bitmaps. There is code in reportlab/graphics/testshapes.py
(getDrawing13) that illustrates how to register fonts etc.


>
>    Hi:
>
>    1 . Is renderPM supportting TTF fonts? 
>
>    2 . You said: We have   just gone through trying to get TTF fonts 
>    in via freetype 2
>
>    I want to know how to do it.
>
>    3 .  If it supports TTF fonts ,is that meaning if I use Chinese TTF 
>    fonts (SIMHEI.TTF for example ) it also can work?
>
>    4 .in the renderPM script:
>
>    def _setFont(gs,fontName,fontSize):
>        try:
>            gs.setFont(fontName,fontSize)
>        except _renderPM.Error, errMsg:
>            if errMsg.args[0]!="Can't find font!": raise
>            #here's where we try to add a font to the canvas
>            try:
>                f = getFont(fontName)
>         
>    _renderPM.makeT1Font(fontName,f.face.findT1Fil(),f.encoding.vector)
>            except:
>                s1, s2 = map(str,sys.exc_info()[:2])
>                raise RenderPMError, "Can't setFont(%s) missing the T1 
>    files? \nOriginally %s: %s" % (fontName,s1,s2)
>            gs.setFont(fontName,fontSize)
>
>       is that meaning it only support type1 fonts
>
>    Thanks in advance
>
>
>    Do You Yahoo!?

-- 
Robin Becker