]> git.baikalelectronics.ru Git - kernel.git/commit
docs: sphinx/kfigure.py: Use rsvg-convert(1) for DOT -> PDF conversion
authorAkira Yokosawa <akiyks@gmail.com>
Wed, 29 Dec 2021 11:44:19 +0000 (20:44 +0900)
committerJonathan Corbet <corbet@lwn.net>
Thu, 10 Feb 2022 00:00:41 +0000 (17:00 -0700)
commit3983f0260a10b377f81e24f0659fd8d3b7a0d12e
tree2e825e27ceee5d7a7f9c35f835631752b9103107
parent6b65404c915491a545bd17bc666b183e33b7e55f
docs: sphinx/kfigure.py: Use rsvg-convert(1) for DOT -> PDF conversion

On openSUSE, dot(1) command does not support direct PDF output.
On other distros, generated PDF images have unnecessarily wide margins,
especially for small graphs.

By using dot(1) for DOT -> SVG, then rsvg-convert(1) for SVG -> PDF,
more optimal PDF images can be obtained, with the bonus of improved
portability across various distros.

Add rules in kfigure.py so that the above mentioned route is taken
when rsvg-convert(1) is available.

Note that rsvg-convert(1) is recommended by sphinx_pre_install.
So it is most likely that existing systems for building pdfdocs have
rsvg-convert(1) installed.

Note:
    SVG features supported by rsvg-convert(1) vary depending on its
    version and distro config.
    For example, the one found on Ubuntu Bionic (version 2.40.20) does
    poor job in rendering some of SVG files drawn by Inkscape.
    SVG files generated by dot(1) are converted nicely even with such
    old versions of rsvg-convert.

    So this change does not affect the quality of such figures in any
    way.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/15b56dd3-081a-2469-c3a4-dfc1ca4c6c2d@gmail.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Documentation/sphinx/kfigure.py