On 2020-04-26 21:13, Tom Lane wrote:
"π" renders poorly in our PDF docs: as shown in the attached
screenshot, it doesn't line up on the baseline.  I realized that
this is the same problem I'd run into recently with right-arrow,
and it can be solved in the same way, namely we have to specify
use of the symbol font explicitly.  So attached is a proposed
patch to fix it.

The real problem here is that the default font (Times or Times New Roman) embedded in PDF readers doesn't have these off-the-beaten-path glyphs. I'm surprised you see anything at all. The fix is to use a different font with more glyphs. I looked into that some time ago because this also effects the contributors list in the release notes, which has to be dumbed down because of this.

To use a different font, you have to (a) pick one, and (b) install it locally when you build the PDFs.

My proposal is to use the DejaVu fonts, which are open source and easily available for common operating systems. (Arguably, they also give the documentation a slightly fresher look.)

The attached patch implements this. You just have to install the fonts somehow. Red Hat and Debian should have packages for this. We should write instructions for this in any case.

(With this you can undo the other patches discussed here and just write π and it should look correctly.)

--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>From 26f972a3bc91ac6685412a42f24170ce2783de50 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 29 Apr 2020 19:48:22 +0200
Subject: [PATCH] FOP font configuration

---
 doc/src/sgml/Makefile          |  1 +
 doc/src/sgml/fop.xml           | 12 ++++++++++++
 doc/src/sgml/stylesheet-fo.xsl |  2 ++
 doc/src/sgml/syntax.sgml       |  4 ++--
 4 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 doc/src/sgml/fop.xml

diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 0401a515df..b8212b3f62 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -38,6 +38,7 @@ endif
 ifndef FOP
 FOP = $(missing) fop
 endif
+FOP += -c $(srcdir)/fop.xml
 
 XMLINCLUDE = --path .
 
diff --git a/doc/src/sgml/fop.xml b/doc/src/sgml/fop.xml
new file mode 100644
index 0000000000..1b0fb16782
--- /dev/null
+++ b/doc/src/sgml/fop.xml
@@ -0,0 +1,12 @@
+<fop version="1.0">
+
+ <renderers>
+  <renderer mime="application/pdf">
+   <fonts>
+    <!-- automatically detect operating system installed fonts -->
+    <auto-detect/>
+   </fonts>
+  </renderer>>
+ </renderers>
+
+</fop>
diff --git a/doc/src/sgml/stylesheet-fo.xsl b/doc/src/sgml/stylesheet-fo.xsl
index 2f2517d8ce..0b53835782 100644
--- a/doc/src/sgml/stylesheet-fo.xsl
+++ b/doc/src/sgml/stylesheet-fo.xsl
@@ -6,6 +6,8 @@
 <xsl:import 
href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
 <xsl:include href="stylesheet-common.xsl" />
 
+<xsl:param name="body.font.family">DejaVu Serif</xsl:param>
+
 <xsl:param name="fop1.extensions" select="1"></xsl:param>
 <xsl:param name="tablecolumns.extension" select="0"></xsl:param>
 <xsl:param name="toc.max.depth">3</xsl:param>
diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml
index e134877798..930abbb462 100644
--- a/doc/src/sgml/syntax.sgml
+++ b/doc/src/sgml/syntax.sgml
@@ -230,7 +230,7 @@ <title>Identifiers and Key Words</title>
 U&amp;"d\0061t\+000061"
 </programlisting>
     The following less trivial example writes the Russian
-    word <quote>slon</quote> (elephant) in Cyrillic letters:
+    word <quote>слон</quote>/<quote>slon</quote> (elephant) in Cyrillic 
letters:
 <programlisting>
 U&amp;"\0441\043B\043E\043D"
 </programlisting>
@@ -494,7 +494,7 @@ <title>String Constants with Unicode Escapes</title>
 U&amp;'d\0061t\+000061'
 </programlisting>
      The following less trivial example writes the Russian
-     word <quote>slon</quote> (elephant) in Cyrillic letters:
+     word <quote>слон</quote>/<quote>slon</quote> (elephant) in Cyrillic 
letters:
 <programlisting>
 U&amp;'\0441\043B\043E\043D'
 </programlisting>
-- 
2.26.2

Reply via email to