[reportlab-users] Built-in versus embedded fonts
v+python at g.nevcal.com
Wed Jun 24 02:17:56 EDT 2015
On 6/22/2015 2:39 AM, Andy Robinson wrote:
>> canvas.stringWidth(text, font_name, font_size)
>> Thanks for the response, but it doesn't work with my TTFont ones, as far as
>> I can tell... I get the same errors as reported in my last message, but with
>> a slightly different call stack.
> Glenn, can you post a very short code snippet where this fails, and
> also tell us the font you used with it? We have been registering
> TrueType fonts and measuring their width for at least 12 years, so
> maybe you have a dodgy font file
Demonstrates that I have code that will allow TTFont.stringWidth to
work, but not Canvas.stringWidth.
Whether the fault is in my code, or in reportlab, is hard for me to say.
I don't know that I'm doing something wrong, in the larger program this
was extracted from reportlab generally works and produces documents, but
pdfmetrics.stringWidth (first tried) didn't work, and then I cast about
for other solutions. My "workaround" was to use built-in Times Roman as
a proxy for Times New Roman, which worked well enough for that font, but
didn't solve the problem.
The rest is experimentation based on this discussion thread.
I don't have the latest version of reportlab, but I think it is the
latest one released.... there is a reportlab-3.1.8.dist-info in my
site-packages, so I'll assume that is the version number.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the reportlab-users