2

我正在尝试使用pyfpdf. 问题在于fpdf. 可能是什么问题?我使用的代码是:

#!/usr/bin/python
# -*- coding: utf8 -*-
from fpdf import FPDF

pdf = FPDF()
pdf.add_page()
pdf.add_font('lakkireddy', '', 'LakkiReddy.ttf', uni=True)
pdf.set_font('lakkireddy','', 16)
pdf.cell(40,10,u'హలో ప్రపంచమా!')
pdf.output('testfpdf.pdf','F')`

预期的输出是: 在此处输入图像描述

但实际输出是损坏的文本: 在此处输入图像描述

可能是什么问题,是字体,是编码还是字体渲染引擎?我可以定义使用哪个字体渲染引擎吗?

4

1 回答 1

1

I am not familiar with fpdf but it seems that fpdf does not support proper text shaping for complex scripts. Glyph shapes change based on glyph position in the string and based on its neighbor glyphs but fpdf does not seem to do this kind of processing by default.

You have to check if there are options in fpdf for specifying this kind of processing for complex scripts.

于 2019-06-19T05:02:56.710 回答