[reportlab-users] Using Symbola or equivalent Unicode6 font with Reportlab

Robin Becker robin at reportlab.com
Fri Feb 21 06:27:50 EST 2014


Hi Mathieu,

On 20/02/2014 17:09, Mathieu Comandon wrote:

> Hi,

>

> I'm trying to generate a set of "superfonts" based on Symbola.ttf (

> http://users.teilar.gr/~g1951d/ ). The plan is to merge the regular fonts

> we use in our application with Symbola.ttf in order to allow printing

> almost any possible glyph.

>

I have looked for such a font without success.




> I tried generating a PDF from sources containing Unicode6 characters or

> non-latin alphabets (Japanese, Chinese, Arabic, Hebrew). Neither the

> composite Times + Symbola I created on FontForge nor the plain Symbola

> displayed the non Latin characters.

>

It's not clear exactly how you are doing the conversion. Are you creating a
combined TTF? I have used MS Mincho & MS Gothic on windows and they are
certainly able to display both latin & CJK / Arabic / etc etc. However, I'm not
sure what parts of unicode you're referring to when you mention unicode 6.

As I understand it there are some issues in python 2.x unicode related to going
outside the standard plane, but I'm not sure if that's what you mean.





> Before I go any further, like converting Symbola to a CIDFont, which if I

> understand is they right way to display non Latin characters, I would like

> to know if I'm heading into the right direction. Is this even possible, or

> am i going to hit a wall at some point ?


this code produces the attached pdf & png.
####################
def main():
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase.pdfmetrics import registerFont
from reportlab.graphics.shapes import Drawing, String

registerFont(TTFont('ms-mincho','/WINDOWS/Fonts/msmincho.ttc',subfontIndex=1))

d = Drawing(400,200)
d.add(String(10,190,u'ABCDE\u00c7\u2286\u211d\u20a3\u2657\u2677\u305b\u30f2\u3223\u52e3\u9d7a',fontName='ms-mincho',fontSize=10))
d.save(formats=['pdf','png'],outDir='/tmp',fnRoot='test-fonts')

if __name__=='__main__':
main()
###################

the character \u2677 is supposed to be 'white club suit', but it goes wrong in
both PDF & PNG. I think there's a glyph there, but perhaps it has a bad
definition or something and when we use freetype in the bitmap renderer
something goes very wrong.
--
Robin Becker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-fonts.pdf
Type: application/pdf
Size: 17675 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20140221/7bf18d69/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-fonts.png
Type: image/png
Size: 2916 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20140221/7bf18d69/attachment-0001.png>


More information about the reportlab-users mailing list