[reportlab-users] Built-in versus embedded fonts
Andy Robinson
andy at reportlab.com
Sun Jun 21 15:32:56 EDT 2015
As far as I remember, if you register a TrueType Font,
pdfmetrics.stringwidth(..) gives the right answer.
It gets aliased to various functions in C accelerators so it may not
be obvious from reading the code....
On 21 June 2015 at 02:16, Glenn Linderman <v+python at g.nevcal.com> wrote:
> As an outgrowth of the "Helvetica" reference (and I've got working code to
> avoid it now, but would like the Canvas parameter for initial_fontname in
> time, thanks), I found some code that is using "Times-Roman" (also built in)
> to determine which string is longer... The strings are _actually_ placed in
> the document using "Times New Roman" (TTF)... but...
>
> 1) pdfmetrics.stringWidth doesn't seem to work for TTF fonts.
> 2) I couldn't find an obvious way to obtain the information for TTF fonts.
> 3) If kerning gets implemented, the stringWidth should reflect that.
>
> I vaguely recall implementing this "proxy for reality" late one night in a
> coding frenzy... is there an easy way to obtain stringWidth for a TTF font?
>
>
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users
>
More information about the reportlab-users
mailing list