ReportLab 段落中的字母间距

标签 reportlab

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

最佳答案

根据official documentation ,p。 30:

The setCharSpace method adjusts one of the parameters of text -- the inter-character spacing.

后面是一个代码示例:

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

关于ReportLab 段落中的字母间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51707607/

相关文章:

google-app-engine - Reportlab 不会在 dev_appserver 中加载

python - ReportLab - 无法屏蔽图像 [Google App Engine]

Python- Reportlabs - 在 2 个不同的页面中保存 2 个不同的图表?

python - Reportlab 圆角矩形

python - 无法安装reportlab mac OS X 10.9.2 + python2.7

python - 是否存在报告实验室 rml 的所见即所得编辑器?

python - 在Python中隐藏PDF文件中的信息

python - Reportlab 不在 Google App Engine 上的 Django 应用程序中生成图表

python - 导入错误;在 PyCharm 中使用 Python 3.5 安装 Reportlab 3.4 时出现问题

Python 每个 PDF 页面多个 .PNG 文件