[Debian-handbook-translators] Vector drawings in the PDF?

Petter Reinholdtsen pere at hungry.com
Sun Jun 18 21:47:32 UTC 2017


Hi.

[AYANOKOUZI, Ryuunosuke]
> We, Japanese translation team, made the change to achieve sufficient
> printing quality.

I would like to do so to for the Norwegian Bokmål edition.

> You can generate pdf images by hand (from *.dia to *.svg by Dia, from
> *.svg to *.pdf by Inkscape [1]).  But, sometime these conversion is
> not good (space characters leading text are ignored), since the svg
> file converted by Dia is not good for reproducing the same image from
> Inkscape.  So, this conversion can't be automatically done.

Aha.  I do not quite understand what kind of problem you are talking
about, but I tried to generate PDF versions using this recipe, and saw
nothing strange in the generated PDFs.

diff --git a/nb-NO/images/Makefile b/nb-NO/images/Makefile
index 112420b..a0e1c9e 100644
--- a/nb-NO/images/Makefile
+++ b/nb-NO/images/Makefile
@@ -1,9 +1,10 @@
 
 dia = $(wildcard *.dia)
 
-all: png
+all: png pdf
 
 png: $(patsubst %.dia,%.png,$(dia))
+pdf: $(patsubst %.dia,%.pdf,$(dia))
 
 eps: $(patsubst %.jpg,%.eps,$(wildcard *.jpg)) $(patsubst %.png,%.eps,$(wildcard *.png)) $(patsubst %.dia,%.eps,$(dia))
 
@@ -12,6 +13,11 @@ $(1).png: $(1).dia
 	dia -t png -s 1024 $$<
 endef
 
+%.pdf: %.dia
+	dia --filter svg --export floffa.svg $<
+	inkscape --file=floffa.svg --without-gui --export-area-drawing --export-pdf=$@
+
 $(foreach d,$(patsubst %.dia,%,$(dia)),$(eval $(call DIA_template,$(d))))
 
 .PHONY: png all
+.SUFFIXES: .dia .pdf

> We made a proposal to convert all dia files to Inkscape svg files and
> tried to use po4a for extracting and managing messages.

I wonder if Inkscape will be as easy as Dia when it comes to modifying
these kind of figures.  Dia seem well fit for flow charts and state
diagrams.

> But, message translation of Inkscape svg have another disadvantages.
> 1. Paragraph layout has not preserved.
> 2. Translator must set suitable fonts by hand.

Yeah.  I tested translating SVGs for my Free Culture book, and decided
it was a good starting point but had to be manually adjusted to cope
with the string length changes.

> For these reasons,
> We have stooped to migrate the change into 'jessie/master' branch
> and to implement automatic update of image translation using gettext
> tool-chain.

Right.  I would guess that if the dia->svg->pdf conversion path is not
working, it should be made to work instead of giving up on using vector
drawings in print.
>
> According to conversation with Raphael, Raphael think that...
> 1. High resolution raster image exported from Dia is sufficient for
> printing.

Well, I am not conviced this is true, and in addition I would like the
reduced file size and improved accuracty for the PDF edition of the
book.

> 2. But, if it is possible to export all image files (png for html and
>    pdf for pdf) from SINGLE image source file, we are willing change
>    drawing software.

What about sticking with Dia, and fixing the dia->pdf conversion path
instead?

Here is the complete patch I used, which seem to produce PDF with
scalable vector drawings.

diff --git a/en-US/01_the-debian-project.xml b/en-US/01_the-debian-project.xml
index 6601874..2fd7bb7 100644
--- a/en-US/01_the-debian-project.xml
+++ b/en-US/01_the-debian-project.xml
@@ -1833,7 +1833,10 @@
       <figure>
         <title>Compilation of a package by the autobuilders</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/autobuilder.pdf" scalefit="1" width="75%"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/autobuilder.png" scalefit="1" width="75%"/>
           </imageobject>
         </mediaobject>
@@ -1985,7 +1988,10 @@
       <figure>
         <title>A package's path through the various Debian versions</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/release-cycle.pdf" width="60%"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/release-cycle.png" width="60%"/>
           </imageobject>
         </mediaobject>
@@ -2052,7 +2058,10 @@
       <figure>
         <title>Chronological path of a program packaged by Debian</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/package-lifecycle.pdf" scalefit="1"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/package-lifecycle.png" scalefit="1"/>
           </imageobject>
         </mediaobject>
diff --git a/en-US/02_case-study.xml b/en-US/02_case-study.xml
index fa42fa7..6a0b0b3 100644
--- a/en-US/02_case-study.xml
+++ b/en-US/02_case-study.xml
@@ -95,7 +95,10 @@
     <figure>
       <title>Overview of the Falcot Corp network</title>
       <mediaobject>
-        <imageobject>
+        <imageobject condition="pdf">
+          <imagedata fileref="images/case-study.pdf" scalefit="1" width="75%"/>
+        </imageobject>
+        <imageobject condition="none">
           <imagedata fileref="images/case-study.png" scalefit="1" width="75%"/>
         </imageobject>
       </mediaobject>
diff --git a/en-US/03_existing-setup.xml b/en-US/03_existing-setup.xml
index b9ad5d0..46edd45 100644
--- a/en-US/03_existing-setup.xml
+++ b/en-US/03_existing-setup.xml
@@ -94,7 +94,10 @@
       <figure>
         <title>Coexistence of Debian with OS X, Windows and Unix systems</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/existing-setup-1.pdf" width="25%"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/existing-setup-1.png" width="25%"/>
           </imageobject>
         </mediaobject>
@@ -212,7 +215,10 @@ Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds</computeroutput>
       <figure>
         <title>Database backups</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/existing-setup-2.pdf" width="50%"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/existing-setup-2.png" width="50%"/>
           </imageobject>
         </mediaobject>
@@ -402,7 +408,10 @@ Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds</computeroutput>
       <figure>
         <title>Install the selected services</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/existing-setup-4.pdf" width="66%"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/existing-setup-4.png" width="66%"/>
           </imageobject>
         </mediaobject>
diff --git a/en-US/05_packaging-system.xml b/en-US/05_packaging-system.xml
index fee3b86..0e225b3 100644
--- a/en-US/05_packaging-system.xml
+++ b/en-US/05_packaging-system.xml
@@ -554,7 +554,10 @@ SHA256: 371a559ce741394b59dbc6460470a9399be5245356a9183bbeea0f89ecaabb03</comput
           <figure>
             <title>Use of a <literal>Provides</literal> field in order to not break dependencies</title>
             <mediaobject>
-              <imageobject>
+              <imageobject condition="pdf">
+                <imagedata fileref="images/virtual-package.pdf" width="50%"/>
+              </imageobject>
+              <imageobject condition="none">
                 <imagedata fileref="images/virtual-package.png" width="50%"/>
               </imageobject>
             </mediaobject>
diff --git a/en-US/09_unix-services.xml b/en-US/09_unix-services.xml
index cc5651b..144e9df 100644
--- a/en-US/09_unix-services.xml
+++ b/en-US/09_unix-services.xml
@@ -63,7 +63,10 @@
     <figure id="figure.boot-process-systemd">
       <title>Boot sequence of a computer running Linux with systemd</title>
       <mediaobject>
-        <imageobject>
+        <imageobject condition="pdf">
+          <imagedata fileref="images/startup-systemd.pdf" scalefit="1" width="80%"/>
+        </imageobject>
+        <imageobject condition="none">
           <imagedata fileref="images/startup-systemd.png" scalefit="1" width="80%"/>
         </imageobject>
       </mediaobject>
@@ -550,7 +553,10 @@ up. </para></listitem>
     <figure id="figure.boot-process-sysvinit">
       <title>Boot sequence of a computer running Linux with System V init</title>
       <mediaobject>
-        <imageobject>
+        <imageobject condition="pdf">
+          <imagedata fileref="images/startup-sysvinit.pdf" scalefit="1" width="80%"/>
+        </imageobject>
+        <imageobject condition="none">
           <imagedata fileref="images/startup-sysvinit.png" scalefit="1" width="80%"/>
         </imageobject>
       </mediaobject>
@@ -934,7 +940,10 @@ up. </para></listitem>
         <figure id="figure.ssh-L">
           <title>Forwarding a local port with SSH</title>
           <mediaobject>
-            <imageobject>
+            <imageobject condition="pdf">
+              <imagedata fileref="images/ssh-L.pdf" width="35%"/>
+            </imageobject>
+            <imageobject condition="none">
               <imagedata fileref="images/ssh-L.png" width="35%"/>
             </imageobject>
           </mediaobject>
@@ -943,7 +952,10 @@ up. </para></listitem>
         <figure id="figure.ssh-R">
           <title>Forwarding a remote port with SSH</title>
           <mediaobject>
-            <imageobject>
+            <imageobject condition="pdf">
+              <imagedata fileref="images/ssh-R.pdf" width="35%"/>
+            </imageobject>
+            <imageobject condition="none">
               <imagedata fileref="images/ssh-R.png" width="35%"/>
             </imageobject>
           </mediaobject>
diff --git a/en-US/11_network-services.xml b/en-US/11_network-services.xml
index 8fda6b9..7f78c9e 100644
--- a/en-US/11_network-services.xml
+++ b/en-US/11_network-services.xml
@@ -160,7 +160,10 @@
       <figure>
         <title>Role of the DNS <emphasis>MX</emphasis> record while sending a mail</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/mail-server.pdf" scalefit="1" width="60%"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/mail-server.png" scalefit="1" width="60%"/>
           </imageobject>
         </mediaobject>
diff --git a/en-US/14_security.xml b/en-US/14_security.xml
index 16b963e..8cc1c91 100644
--- a/en-US/14_security.xml
+++ b/en-US/14_security.xml
@@ -268,7 +268,10 @@
       <figure id="figure.chaines-netfilter">
         <title>How <emphasis>netfilter</emphasis> chains are called</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/netfilter.pdf" scalefit="1" width="65%"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/netfilter.png" scalefit="1" width="65%"/>
           </imageobject>
         </mediaobject>
@@ -1583,7 +1586,10 @@ Finished generating profile for /sbin/dhclient.</computeroutput>
       <figure>
         <title>Security contexts and Unix users</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/selinux-context.pdf" scalefit="1" width="65%"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/selinux-context.png" scalefit="1" width="65%"/>
           </imageobject>
         </mediaobject>
@@ -1632,7 +1638,10 @@ Finished generating profile for /sbin/dhclient.</computeroutput>
       <figure>
         <title>Automatic transitions between domains</title>
         <mediaobject>
-          <imageobject>
+          <imageobject condition="pdf">
+            <imagedata fileref="images/selinux-transitions.pdf" scalefit="1" width="35%"/>
+          </imageobject>
+          <imageobject condition="none">
             <imagedata fileref="images/selinux-transitions.png" scalefit="1" width="35%"/>
           </imageobject>
         </mediaobject>
diff --git a/nb-NO/images/Makefile b/nb-NO/images/Makefile
index 112420b..a0e1c9e 100644
--- a/nb-NO/images/Makefile
+++ b/nb-NO/images/Makefile
@@ -1,9 +1,10 @@
 
 dia = $(wildcard *.dia)
 
-all: png
+all: png pdf
 
 png: $(patsubst %.dia,%.png,$(dia))
+pdf: $(patsubst %.dia,%.pdf,$(dia))
 
 eps: $(patsubst %.jpg,%.eps,$(wildcard *.jpg)) $(patsubst %.png,%.eps,$(wildcard *.png)) $(patsubst %.dia,%.eps,$(dia))
 
@@ -12,6 +13,11 @@ $(1).png: $(1).dia
 	dia -t png -s 1024 $$<
 endef
 
+%.pdf: %.dia
+	dia --filter svg --export floffa.svg $<
+	inkscape --file=floffa.svg --without-gui --export-area-drawing --export-pdf=$@
+
 $(foreach d,$(patsubst %.dia,%,$(dia)),$(eval $(call DIA_template,$(d))))
 
 .PHONY: png all
+.SUFFIXES: .dia .pdf

-- 
Happy hacking
Petter Reinholdtsen



More information about the Debian-handbook-translators mailing list