pypdflib-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pypdflib-dev] Pypdflib and fonts


From: Santhosh Thottingal
Subject: Re: [pypdflib-dev] Pypdflib and fonts
Date: Fri, 23 Dec 2011 13:11:15 +0530

On Fri, Dec 23, 2011 at 11:17 AM, Murthy Raju <address@hidden> wrote:
> 1. How does pypdflib choose the font when it is not mentioned
> explicitly? I have noticed that the pdf file generated has Lohit-Hindi
> and Lohit-Bengali bundled, Which means the font is chosen and bundled
> automatically. Is there any doc that explains the process of automatic
> choice of fonts?

It is font fallback, offered by operating system. The pango rendering
engine can find out the default font for a script. The default font is
configured in your fontconfig setting. See /etc/fonts

> 2. When there is a para with text in several indic scripts, what is
> the best practice for declaring the fonts?

Declare a generic family. Sans, san-serif , or serif. again, Pango
will use fontconfig to find out the default fonts in the given generic
family.
http://en.wikipedia.org/wiki/Fontconfig
http://en.wikipedia.org/wiki/Font_family

> 3. Is it possible to declare font-script mapping once globally, to
> handle paras with text in several scripts more gracefully?

Not inside pypdflib(at least for now), but using fontconfig, you can do that.

> 4. An unrelated question - In the output pdf generated by running
> scripts_test.py, I notice that the line spacing in Tamil text is much
> more than the line spacing for other scripts. Has this something to do
> with the font?

Yes,  Pango rendering engine gives a callback for each line it
renders. It calculates the line height required for the given text and
font, fontsize. According to this value we increment y coordinates in
the page


-Santhosh



reply via email to

[Prev in Thread] Current Thread [Next in Thread]