当前位置: 首页>>代码示例>>Python>>正文


Python Paragraph.split方法代码示例

本文整理汇总了Python中reportlab.platypus.paragraph.Paragraph.split方法的典型用法代码示例。如果您正苦于以下问题:Python Paragraph.split方法的具体用法?Python Paragraph.split怎么用?Python Paragraph.split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reportlab.platypus.paragraph.Paragraph的用法示例。


在下文中一共展示了Paragraph.split方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: go

# 需要导入模块: from reportlab.platypus.paragraph import Paragraph [as 别名]
# 或者: from reportlab.platypus.paragraph.Paragraph import split [as 别名]
def go():
    styles = getSampleStyleSheet()
    style=styles['Normal']
    
    p1 = Paragraph('This is a paragraph', style )
    print(p1.wrap(500,701))
    print(p1._cache['avail'])
    print(len(p1.split(500,701)))
    print(p1.wrap(500,700))
    print(len(p1.split(500,700)))
开发者ID:aquavitae,项目名称:rst2pdf-py3-dev,代码行数:12,代码来源:test_180.py

示例2: test2

# 需要导入模块: from reportlab.platypus.paragraph import Paragraph [as 别名]
# 或者: from reportlab.platypus.paragraph.Paragraph import split [as 别名]
    def test2(self):
        sty = ParagraphStyle(name = 'normal')
        sty.fontName = 'Times-Roman'
        sty.fontSize = 10
        sty.leading = 12

        p = Paragraph('one two three',sty)
        p.wrap(20,36)
        self.assertEqual(len(p.split(20,24)),2) #widows allowed
        self.assertEqual(len(p.split(20,16)),0) #orphans disallowed
        p.allowWidows = 0
        self.assertEqual(len(p.split(20,24)),0) #widows disallowed
        p.allowOrphans = 1
        self.assertEqual(len(p.split(20,16)),2) #orphans allowed
开发者ID:FatihZor,项目名称:infernal-twin,代码行数:16,代码来源:test_platypus_breaking.py

示例3: test2

# 需要导入模块: from reportlab.platypus.paragraph import Paragraph [as 别名]
# 或者: from reportlab.platypus.paragraph.Paragraph import split [as 别名]
 def test2(self):
     '''CJK splitting in multi-frag case'''
     style = ParagraphStyle('test', wordWrap = 'CJK')
     p = Paragraph('bla <i>blub</i> '*130 , style)
     aW,aH=439.275590551,121.88976378
     w,h=p.wrap(aW,aH)
     S=p.split(aW,aH)
     assert len(S)==2, 'Multi frag CJK splitting failed'
     w0,h0=S[0].wrap(aW,aH)
     assert h0<=aH,'Multi-frag CJK split[0] has wrong height %s >= available %s' % (H0,aH)
     w1,h1=S[1].wrap(aW,aH)
     assert h0+h1==h, 'Multi-frag-CJK split[0].height(%s)+split[1].height(%s) don\'t add to original %s' % (h0,h1,h)
开发者ID:Jbaumotte,项目名称:web2py,代码行数:14,代码来源:test_platypus_paragraphs.py

示例4: test2

# 需要导入模块: from reportlab.platypus.paragraph import Paragraph [as 别名]
# 或者: from reportlab.platypus.paragraph.Paragraph import split [as 别名]
 def test2(self):
     """CJK splitting in multi-frag case"""
     style = ParagraphStyle("test", wordWrap="CJK")
     p = Paragraph("bla <i>blub</i> " * 130, style)
     aW, aH = 439.275590551, 121.88976378
     w, h = p.wrap(aW, aH)
     S = p.split(aW, aH)
     assert len(S) == 2, "Multi frag CJK splitting failed"
     w0, h0 = S[0].wrap(aW, aH)
     assert h0 <= aH, "Multi-frag CJK split[0] has wrong height %s >= available %s" % (H0, aH)
     w1, h1 = S[1].wrap(aW, aH)
     assert h0 + h1 == h, "Multi-frag-CJK split[0].height(%s)+split[1].height(%s) don't add to original %s" % (
         h0,
         h1,
         h,
     )
开发者ID:TribunoDev,项目名称:pm,代码行数:18,代码来源:test_platypus_paragraphs.py

示例5: test0

# 需要导入模块: from reportlab.platypus.paragraph import Paragraph [as 别名]
# 或者: from reportlab.platypus.paragraph.Paragraph import split [as 别名]

#.........这里部分代码省略.........
##                '90msp-RKSJ-V',     #Vertical version of 90msp-RKSJ-H
##                '90pv-RKSJ-H',      #Macintosh, JIS X 0208 character set with KanjiTalk7
##                                    #extensions, Shift-JIS encoding, Script Manager code 1
##                'Add-RKSJ-H',       #JIS X 0208 character set with Fujitsu FMR extensions,
##                                    #Shift-JIS encoding
##                'Add-RKSJ-V',       #Vertical version of Add-RKSJ-H
##                'EUC-H',            #JIS X 0208 character set, EUC-JP encoding
##                'EUC-V',            #Vertical version of EUC-H
##                'Ext-RKSJ-H',       #JIS C 6226 (JIS78) character set with NEC extensions,
##                                    #Shift-JIS encoding
##                'Ext-RKSJ-V',       #Vertical version of Ext-RKSJ-H
##                'H',                #JIS X 0208 character set, ISO-2022-JP encoding,
##                'V',                #Vertical version of H
##                'UniJIS-UCS2-H',    #Unicode (UCS-2) encoding for the Adobe-Japan1 character
##                                    #collection
##                'UniJIS-UCS2-V',    #Vertical version of UniJIS-UCS2-H
##                'UniJIS-UCS2-HW-H', #Same as UniJIS-UCS2-H, but replaces proportional Latin
##                                    #characters with half-width forms
##                'UniJIS-UCS2-HW-V'  #Vertical version of UniJIS-UCS2-HW-H
##                ]
##
##            The next few pages show the complete character set available in the encoding
##            "90ms-RKSJ-H" - Shift-JIS with the standard Microsoft extensions.
##            """)
##        c.drawText(tx)
##
##        c.setFont('Helvetica',10)
##        c.drawCentredString(297, 36, 'Page %d' % c.getPageNumber())
##
##
##
##        c.showPage()

        from reportlab.lib import textsplit
        
        c.setFont('HeiseiMin-W3', 14)
        y = 700
        c.drawString(70, y, 'cannot end line')
        y -= 20
        for group in textsplit.CANNOT_START_LINE:
            c.drawString(70, y, group)
            y -= 20
            c.setFont('Helvetica',10)
            c.drawString(70, y, ' '.join([ascii(x)[4:-1] for x in group]))
            c.setFont('HeiseiMin-W3', 14)
            y -= 20



        y -= 20            
        c.drawString(70, y, 'cannot end line')
        y -= 20
        for group in textsplit.CANNOT_END_LINE:
            c.drawString(70, y, group)
            y -= 20
            c.setFont('Helvetica',10)
            c.drawString(70, y, ' '.join([ascii(x)[2:] for x in group]))
            c.setFont('HeiseiMin-W3', 14)
            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
开发者ID:Distrotech,项目名称:reportlab,代码行数:70,代码来源:test_multibyte_jpn.py


注:本文中的reportlab.platypus.paragraph.Paragraph.split方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。