Re: Built-in versus embedded fonts

Glenn Linderman <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
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

http://nevcal.com/temporary/rl-test.py

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.

Glenn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.