linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH 0/3] docs: sphinx/kfigure.py: Improve conversion to PDF
Date: Sun, 12 Dec 2021 16:59:53 +0900	[thread overview]
Message-ID: <de8def13-efbc-1d98-acb5-5cc1f6902e4b@gmail.com> (raw)

This patch set improves conversions of DOT -> PDF and SVG -> PDF
for PDF docs.

* DOT -> PDF conversion

Current scheme uses "dot -Tpdf" (of graphviz).

Cons:
  - openSUSE's dot(1) does not support -Tpdf.
  - Other distro's dot(1) generates PDFs with unnecessarily wide
    margins for inclusion into LaTeX docs.

Patch 1/3 changes the route to two steps:

  1. DOT -> SVG by "dot -Tsvg"
  2. SVG -> PDF by "rsvg-convert -f pdf" with fallback to convert(1).

Pros:
  - Improved portability across distros
  - Less space for graphs in final PDF documents

Con:
  - On systems without rsvg-convert, generated PDF will be of raster
    image.


* SVG -> PDF conversion

Current scheme uses convert(1) (of ImageMagick)

Cons:
  - Generated PDFs are of raster image.  Some of them look blurry.
  - Raster image tends to be large in size.
  - convert(1) delegates SVG decoding to rsvg-convert(1).
    It doesn't cover full range of Inkscape specific SVG features
    and fails to convert some of SVG figures properly.

Failed conversions are observed with:
  - Documentation/userspace-api/media/v4l/selection.svg
  - Documentation/userspace-api/media/v4l/vbi_525.svg
  - Documentation/userspace-api/media/v4l/vbi_625.svg

If you have Inkscape installed as well, convert(1) delegates SVG
decoding to inkscape(1) and the above SVGs are rendered correctly.

So if Inkscape is required for converting those SVGs, why not use it
directly in the first place?

Patch 2/3 adds a route of SVG -> PDF conversion by inkscape(1).
Patch 3/3 hides warning messages from inkscape(1) which are harmless
in command-line uses.

Pros:
  - Generated PDFs are of vector graphics.
  - Vector graphics tends to be smaller in size and keeps looking nice
    while zoomed in.
  - SVGs drawn by Inkscape are fully supported.

On systems without Inkscape, there won't be any change in behavior.

        Thanks, Akira
--
Akira Yokosawa (3):
  docs: sphinx/kfigure.py: Use rsvg-convert(1) for DOT -> PDF conversion
  docs: sphinx/kfigure.py: Use inkscape(1) for SVG -> PDF conversion
  docs: sphinx/kfigure.py: Redirect warnings from inkscape to /dev/null

 Documentation/sphinx/kfigure.py | 109 ++++++++++++++++++++++++++++----
 1 file changed, 97 insertions(+), 12 deletions(-)


base-commit: a32fa6b2e8b4e0b8c03f5218afa0649e188239c5
-- 
2.17.1


             reply	other threads:[~2021-12-12  8:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12  7:59 Akira Yokosawa [this message]
2021-12-12  8:01 ` [PATCH 1/3] docs: sphinx/kfigure.py: Use rsvg-convert(1) for DOT -> PDF conversion Akira Yokosawa
2021-12-12  8:02 ` [PATCH 2/3] docs: sphinx/kfigure.py: Use inkscape(1) for SVG " Akira Yokosawa
2021-12-12  8:03 ` [PATCH 3/3] docs: sphinx/kfigure.py: Redirect warnings from inkscape to /dev/null Akira Yokosawa
2021-12-12 10:38 ` [PATCH 0/3] docs: sphinx/kfigure.py: Improve conversion to PDF Mauro Carvalho Chehab
2021-12-12 11:57   ` Akira Yokosawa
2021-12-13  6:33     ` Mauro Carvalho Chehab
2021-12-13  7:53       ` Akira Yokosawa
2021-12-29 12:54         ` Status of selection.svg update (was Re: [PATCH 0/3] docs: sphinx/kfigure.py: Improve conversion to PDF) Akira Yokosawa
2021-12-29 22:14           ` Mauro Carvalho Chehab
2021-12-30  2:09             ` Akira Yokosawa
2021-12-13 14:36 ` [PATCH 4/3] docs: sphinx/kfigure.py: Add check of 'dot -Tpdf' Akira Yokosawa
2021-12-14  2:34 ` [PATCH 5/3] docs: sphinx/kfigure.py: Delegate inkscape msgs to kernellog Akira Yokosawa
2021-12-14  2:50   ` Randy Dunlap
2021-12-14  3:14     ` Akira Yokosawa
2021-12-23 19:56 ` [PATCH 0/3] docs: sphinx/kfigure.py: Improve conversion to PDF Jonathan Corbet
2021-12-23 21:52   ` Akira Yokosawa
2021-12-23 23:48     ` Jonathan Corbet
2021-12-24  1:53       ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=de8def13-efbc-1d98-acb5-5cc1f6902e4b@gmail.com \
    --to=akiyks@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).