Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def _greekConvert(data):
    global _greek2Utf8
    if not _greek2Utf8:
        from reportlab.pdfbase.rl_codecs import RL_Codecs
        import codecs
        #our decoding map
        dm = codecs.make_identity_dict(range(32,256))
        for k in range(0,32):
            dm[k] = None
        dm.update(RL_Codecs._RL_Codecs__rl_codecs_data['symbol'][0])
        _greek2Utf8 = {}
        for k,v in dm.items():
            if not v:
                u = '\0'
            else:
                if isPy3:
                    u = chr(v)
                else:
                    u = unichr(v).encode('utf8')
            _greek2Utf8[chr(k)] = u
    return ''.join(map(_greek2Utf8.__getitem__,data))
        


src/r/e/reportlab-3.1.8/tests/test_hello.py   reportlab(Download)
import unittest
from reportlab.pdfgen.canvas import Canvas
from reportlab.platypus.paraparser import _greekConvert
 
class HelloTestCase(unittest.TestCase):
        c.setFont('Helvetica-Bold', 36)
        c.drawString(100,700, 'Hello World!')
        c.drawString(100,700-36*1.2, _greekConvert('Hello Brave New World')+'!')
        c.save()