【问题标题】:ReportLab letter spacing in ParagraphReportLab 段落中的字母间距
【发布时间】:2019-04-01 04:31:49
【问题描述】:

是否可以在段落样式中设置字母/字符间距? 我尝试使用spaceShrinkage 但没有任何区别

【问题讨论】:

  • 这有什么好运气吗?我有完全相同的问题。
  • @DanceParty,我的回答适合这个问题吗?
  • 我认为它可能有效。我最终使用了 style.spaceShrinkage。

标签: reportlab


【解决方案1】:

根据official documentation,p。 30:

setCharSpace 方法调整文本的参数之一——字符间距。

后面是代码示例:

def charspace(canvas):
    from reportlab.lib.units import inch
    textobject = canvas.beginText()
    textobject.setTextOrigin(3, 2.5*inch)
    textobject.setFont("Helvetica-Oblique", 10)
    charspace = 0
    for line in lyrics:
        textobject.setCharSpace(charspace)
        textobject.textLine("%s: %s" %(charspace,line))
        charspace = charspace+0.5

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-14
    • 2017-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-15
    相关资源
    最近更新 更多