expanded Japanese para tests
authorandy
Thu, 04 May 2006 23:07:51 +0000
changeset 2588 ea348c8bdef1
parent 2587 8984967879af
child 2589 1af821ded9f1
expanded Japanese para tests
reportlab/test/test_multibyte_jpn.py
--- a/reportlab/test/test_multibyte_jpn.py	Thu May 04 10:48:36 2006 +0000
+++ b/reportlab/test/test_multibyte_jpn.py	Thu May 04 23:07:51 2006 +0000
@@ -318,6 +318,48 @@
             y -= 20
 
         c.showPage()
+
+        #utf8 encoded paragraph
+        sample2_uni = u'''\u30ac\u30c8\u30a6\u30a3\u30c3\u30af\u7a7a\u6e2f\u3068\u9023\u7d61\u901a
+        \u8def\u3067\u76f4\u7d50\u3055\u308c\u3066\u3044\u308b\u552f\u4e00\u306e\u30db\u30c6\u30eb
+        \u3067\u3042\u308b\u5f53\u30db\u30c6\u30eb\u306f\u3001\u8857\u306e\u4e2d\u5fc3\u90e8\u304b
+        \u308930\u5206\u306e\u5834\u6240\u306b\u3054\u3056\u3044\u307e\u3059\u3002\u5168\u5ba2\u5ba4
+        \u306b\u9ad8\u901f\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u74b0\u5883\u3092\u5b8c\u5099
+        \u3057\u3066\u304a\u308a\u307e\u3059\u3002\u30d5\u30a1\u30df\u30ea\u30fc\u30eb\u30fc\u30e0
+        \u306f5\u540d\u69d8\u307e\u3067\u304a\u6cca\u308a\u3044\u305f\u3060\u3051\u307e\u3059\u3002
+        \u307e\u305f\u3001\u30a8\u30b0\u30bc\u30af\u30c6\u30a3\u30d6\u30eb\u30fc\u30e0\u306e\u304a
+        \u5ba2\u69d8\u306f\u3001\u30a8\u30b0\u30bc\u30af\u30c6\u30a3\u30d6\u30e9\u30a6\u30f3\u30b8
+        \u3092\u3054\u5229\u7528\u3044\u305f\u3060\u3051\u307e\u3059\u3002\u4e8b\u524d\u306b\u3054
+        \u4e88\u7d04\u3044\u305f\u3060\u3051\u308b\u30bf\u30a4\u30e0\u30c8\u30a5\u30d5\u30e9\u30a4
+        \u30fb\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u306f\u3001\u7a7a\u6e2f\u306e\u99d0\u8eca\u6599
+        \u91d1\u304c\u542b\u307e\u308c\u3066\u304a\u308a\u307e\u3059\u3002'''
+
+        oneline_uni = u''.join(sample2_uni.split())
+        sample2_utf8 = oneline_uni.encode('utf8')
+
+        from reportlab.platypus import Paragraph
+        from reportlab.lib.styles import ParagraphStyle
+        jsty = ParagraphStyle('japanese',fontName='HeiseiMin-W3', wordWrap='CJK')
+        jpara = Paragraph(sample2_utf8, style=jsty)
+
+        c.drawString(100, 710, 'Try to wrap a paragraph using a style with wordWrap="CJK"')
+        w, h = jpara.wrap(400,400)
+        jpara.drawOn(c, 100, 700 - h)
+
+        #now try to split it...
+        c.drawString(100, 510, 'Now try to split a paragraph as if over a page break')
+
+        topPara, bottomPara = jpara.split(400, 30)
+        w1, h1 = topPara.wrap(400, 30)
+        topPara.drawOn(c, 100, 450)
+
+        w2, h2 = bottomPara.wrap(400, 30)
+        bottomPara.drawOn(c, 100, 400)
+        #print 'split into heights %0.2f, %0.2f' % (topPara.height, bottomPara.height) 
+        
+    
+
+
 ##        c.showPage()
 ##
 ##