[reportlab-users] Fonts / positioning different on Windows vs Linux
Andy Robinson
andy at reportlab.com
Wed Jan 8 16:47:19 EST 2014
Mike, if you use the standard font names supported by PDF (Helvetica,
Times and Courier), you are not actually using a standard font. Your
PDF viewer software or operating system decides what to substitute,
and there are many subtle variations of Helvetica and Times - it all
comes down to who licensed what for those big platforms many years
ago.
If you need reproducibility, the best thing is to select a TrueType
font and explicitly include the font file in your code under version
control. The glyphs will be embedded in the PDF, and as far as I
know, it will render identically across platforms. Our font chapter
shows how to do this. You can choose from a ton of fonts in the
Google fonts repository.
Hope this helps,
Andy
On 8 January 2014 21:38, Mike Driscoll <mike at pythonlibrary.org> wrote:
> Hi,
>
> I was wondering why the standard font is different on Linux versus Windows.
> Also, I noticed that the actual positioning of the text / elements are
> slightly different. The latter may be partially a function of the font
> difference, although I'm not sure of that.
>
> Anyway, I created a simple example where I have a barcode and an address
> underneath it. You'll notice that the first line of the address is slightly
> closer to the barcode when the code is run on Linux versus when it's run on
> Windows.
>
> This might not seem like a big deal, but I discovered that it matters when
> you are trying to position MICR marks on a check...I would get it working on
> one OS to find out it was broken on another. And I've had code where it will
> look great on Windows, then when I run it on Linux, the first line of the
> address is buried in the barcode.
>
> I am testing on CentOS and Windows 7.
>
> -------------------
> Mike Driscoll
>
> Blog: http://blog.pythonlibrary.org
>
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>
--
Andy Robinson
Managing Director
ReportLab Europe Ltd.
Thornton House, Thornton Road, Wimbledon, London SW19 4NG, UK
Tel +44-20-8405-6420
More information about the reportlab-users
mailing list