All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Fix fonts in figures
@ 2018-01-27  9:51 Akira Yokosawa
  2018-01-27  9:55 ` [PATCH 1/4] Add fixsvgfonts.sh Akira Yokosawa
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Akira Yokosawa @ 2018-01-27  9:51 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From 3fd97ea1bffc46d5ea2946397d3fa5debf74579e Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sat, 27 Jan 2018 16:30:20 +0900
Subject: [PATCH 0/4] Fix fonts in figures

Hi Paul,

This patch set is the result of my investigation of improper font
rendering in figures on Fedora 27.  In the end, I found several
font-related issues which also affected the results on other
platforms.

The cause of the font problem on Fedora 27 is the introduction
of URW++ v2 font family.  It is not compatible with fixfonts.sh's
font conversion.

Another problem on Fedora 27 is that ghostscript 9.22 does not work
with a2ping script. I reported the issue to Red Hat Bugzilla [1].
So far, it has not been resolved.  a2ping issue is not touched in
this patch set.

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1530268

Patch #1 adds a font conversion script for .svg files. In some
.svg files, non-free font names such as "Helvetica" and "Courier"
are used. Also, a generic font name of "Sans" causes the result
to depend on locale setting. Converting those names to URW font-
family names can eliminate the ambiguity.
It also adds a recipe to convert fonts in .eps files which are
the origin of figures (mostly generated by gnuplot).

Patch #2 fixes fixfonts.sh to avoid unintended conversions.

Patch #3 fixes font names embedded in .eps files which look
like the result of wrong conversion before they were committed.

Patch #4 adds conversion scripts for URW++ v2 font family.
Which set of scripts to use is determined in Makefile according
to the result of "fc-list" command.

These changes have been tested on Ubuntu Trusty, Ubuntu Xenial,
Fedora 26, and Fedora 27 (with ghostscript downgraded to 9.20).

Differences in the resulting figures can be seen in Figures 9.1,
9.7, 9.8, 17.5, and 17.6.

You need to do "make neatfreak; make -j4" to ensure all the
affected figures to be rebuilt.

         Thanks, Akira

NOTE 1: After KPTI was applied, ghostscript slowed down significantly
on virtual guest machines (might as well on real machines).

NOTE 2: Before this change, full rebuild on Ubuntu Trusty with small
RAM size (<2GB) sometimes ended up in DOS (thrashing). Now this
symptom has disappeared.

--
Akira Yokosawa (4):
  Add fixsvgfonts.sh
  Fix pattern order in fixfonts.sh
  future: Fix embedded font name in .eps files
  Makefile: Support URW++ v2 font family names

 Makefile                         | 38 +++++++++++++++++++++----
 future/be-lb-n4-rf-all.eps       |  4 +--
 future/be-lw-n4-rf-all.eps       |  4 +--
 future/latencytrend.eps          |  4 +--
 utilities/fixanepsfonts-urwps.sh | 27 ++++++++++++++++++
 utilities/fixfonts-urwps.sh      | 61 ++++++++++++++++++++++++++++++++++++++++
 utilities/fixfonts.sh            | 28 ++++++++++++++----
 utilities/fixsvgfonts-urwps.sh   | 23 +++++++++++++++
 utilities/fixsvgfonts.sh         | 15 ++++++++++
 9 files changed, 187 insertions(+), 17 deletions(-)
 create mode 100644 utilities/fixanepsfonts-urwps.sh
 create mode 100644 utilities/fixfonts-urwps.sh
 create mode 100644 utilities/fixsvgfonts-urwps.sh
 create mode 100644 utilities/fixsvgfonts.sh

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] Add fixsvgfonts.sh
  2018-01-27  9:51 [PATCH 0/4] Fix fonts in figures Akira Yokosawa
@ 2018-01-27  9:55 ` Akira Yokosawa
  2018-01-27  9:57 ` [PATCH 2/4] Fix pattern order in fixfonts.sh Akira Yokosawa
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2018-01-27  9:55 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From ba9206e36d668cc89ce14e920d0fafe7cfad42e3 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sat, 27 Jan 2018 12:41:55 +0900
Subject: [PATCH 1/4] Add fixsvgfonts.sh

Convert font names in svg files to those of URW.

Also add rules to convert fonts in eps files which are the origin
of figures.

This change will remove proprietary and generic font-family names
such as "Helvetica" and "Sans".

NOTE: URW font v2 uses a different set of font families.
Fedora 27 uses only the v2 names. We will need a different set of
scripts to use them.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 Makefile                 | 22 ++++++++++++++++++++--
 utilities/fixsvgfonts.sh | 15 +++++++++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 utilities/fixsvgfonts.sh

diff --git a/Makefile b/Makefile
index 373f0d6..f1b6715 100644
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,12 @@ EPSSOURCES := $(sort $(EPSSOURCES_DUP))

 PDFTARGETS_OF_EPS := $(EPSSOURCES:%.eps=%.pdf)

+EPSORIGIN := $(filter-out $(EPSSOURCES_FROM_TEX) $(EPSSOURCES_FROM_DOT) $(EPSSOURCES_FROM_FIG),$(EPSSOURCES))
+
+PDFTARGETS_OF_EPSORIG := $(EPSORIGIN:%.eps=%.pdf)
+
+PDFTARGETS_OF_EPSOTHER := $(filter-out $(PDFTARGETS_OF_EPSORIG),$(PDFTARGETS_OF_EPS))
+
 BIBSOURCES := bib/*.bib alphapf.bst

 SVGSOURCES := $(wildcard */*.svg)
@@ -164,7 +170,17 @@ endif
 	@fig2eps --nogv $< > /dev/null 2>&1
 	@sh utilities/fixanepsfonts.sh $@

-$(PDFTARGETS_OF_EPS): %.pdf: %.eps
+$(PDFTARGETS_OF_EPSORIG): %.pdf: %.eps
+	@echo "$< --> $@"
+	@cp $< $<i
+	@sh utilities/fixanepsfonts.sh $<i
+ifndef A2PING
+	$(error "$< --> $@: a2ping not found. Please install it.")
+endif
+	@a2ping --below --hires --bboxfrom=compute-gs $<i $@ > /dev/null 2>&1
+	@rm -f $<i
+
+$(PDFTARGETS_OF_EPSOTHER): %.pdf: %.eps
 	@echo "$< --> $@"
 ifndef A2PING
 	$(error "$< --> $@: a2ping not found. Please install it.")
@@ -176,7 +192,9 @@ $(PDFTARGETS_OF_SVG): %.pdf: %.svg
 ifndef INKSCAPE
 	$(error "$< --> $@: inkscape not found. Please install it.")
 endif
-	@inkscape --export-pdf=$@ $<
+	@sh utilities/fixsvgfonts.sh < $< > $<i
+	@inkscape --export-pdf=$@ $<i > /dev/null 2>&1
+	@rm -f $<i

 help:
 	@echo "Official targets (Latin Modern Typewriter for monospace font):"
diff --git a/utilities/fixsvgfonts.sh b/utilities/fixsvgfonts.sh
new file mode 100644
index 0000000..812cbc2
--- /dev/null
+++ b/utilities/fixsvgfonts.sh
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# fixsvgfonts.sh: Convert an .svg file to use embeddable fonts, taking from
+#	standard input and putting on standar output.
+#
+# Copyright (c) 2018 Akira Yokosawa
+
+sed	-e 's+family:Helvetica+family:Nimbus Sans L+g' \
+	-e 's+family="Helvetica+family="Nimbus Sans L+g' \
+	-e 's+family:Sans+family:Nimbus Sans L+g' \
+	-e 's+cation:Sans+cation:Nimbus Sans L+g' \
+	-e 's+family:Courier+family:Nimbus Mono L+g' \
+	-e 's+family="Courier+family="Nimbus Mono L+g' \
+	-e 's+family:Symbol+family:Standard Symbols L+g' \
+	-e 's+cation:Symbol+cation:Standard Symbols L+g'
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] Fix pattern order in fixfonts.sh
  2018-01-27  9:51 [PATCH 0/4] Fix fonts in figures Akira Yokosawa
  2018-01-27  9:55 ` [PATCH 1/4] Add fixsvgfonts.sh Akira Yokosawa
@ 2018-01-27  9:57 ` Akira Yokosawa
  2018-01-27  9:58 ` [PATCH 3/4] future: Fix embedded font name in .eps files Akira Yokosawa
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2018-01-27  9:57 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From f66a34666ba8ebe75e17cbcca67afc3d4b80d093 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sat, 27 Jan 2018 12:47:49 +0900
Subject: [PATCH 2/4] Fix pattern order in fixfonts.sh

Longer matching patters should come first.
Also add several patterns for Helvetica Narrow fonts.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 utilities/fixfonts.sh | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/utilities/fixfonts.sh b/utilities/fixfonts.sh
index f348dc9..646c68b 100644
--- a/utilities/fixfonts.sh
+++ b/utilities/fixfonts.sh
@@ -16,17 +16,33 @@
 # http://www.gnu.org/licenses/gpl-2.0.html.
 #
 # Copyright (c) 2011 Paul E. McKenney, IBM Corporation.
+# Copyright (c) 2018 Akira Yokosawa

-sed	-e 's+Times-Roman+NimbusSanL-Regu+g' \
+sed	-e 's+Times-Roman-BoldItalic+NimbusSanL-BoldItal+g' \
+	-e 's+Times-Roman-Italic+NimbusSanL-ReguItal+g' \
+	-e 's+Times-Roman-Bold+NimbusSanL-Bold+g' \
+	-e 's+Times-Roman+NimbusSanL-Regu+g' \
 	-e 's+Times+NimbusSanL-Regu+g' \
 	-e 's+Helvetica-BoldOblique+NimbusSanL-BoldItal+g' \
 	-e 's+Helvetica-Oblique+NimbusSanL-ReguItal+g' \
-	-e 's+Helvetica-Bold+NimbusSanL-Bold+g' \
 	-e 's+Helvetica-Bold-iso+NimbusSanL-Bold+g' \
-	-e 's+Helvetica+NimbusSanL-Regu+g' \
+	-e 's+Helvetica-Bold+NimbusSanL-Bold+g' \
+	-e 's+Helvetica-Narrow-BoldOblique-iso+NimbusSanL-BoldCondItal+g' \
+	-e 's+Helvetica-Narrow-BoldOblique+NimbusSanL-BoldCondItal+g' \
+	-e 's+Helvetica-Narrow-Oblique-iso+NimbusSanL-ReguCondItal+g' \
+	-e 's+Helvetica-Narrow-Oblique+NimbusSanL-ReguCondItal+g' \
+	-e 's+Helvetica-Narrow-Bold-iso+NimbusSanL-BoldCond+g' \
+	-e 's+Helvetica-Narrow-Bold+NimbusSanL-BoldCond+g' \
+	-e 's+Helvetica-Narrow-iso+NimbusSanL-ReguCond+g' \
+	-e 's+Helvetica-Narrow+NimbusSanL-ReguCond+g' \
 	-e 's+Helvetica-iso+NimbusSanL-Regu+g' \
+	-e 's+Helvetica+NimbusSanL-Regu+g' \
 	-e 's+Symbol+StandardSymL+g' \
-	-e 's+Courier+NimbusMonL-Regu+g' \
-	-e 's+Courier-Bold+NimbusMonL-Bold+g' \
+	-e 's+Courier-BoldOblique+NimbusMonL-BoldObli+g' \
 	-e 's+Courier-Oblique+NimbusMonL-ReguObli+g' \
-	-e 's+Courier-BoldOblique+NimbusMonL-BoldObli+g'
+	-e 's+Courier-Bold+NimbusMonL-Bold+g' \
+	-e 's+Courier+NimbusMonL-Regu+g' \
+	-e 's+NimbusSanL-Regu-Italic+NimbusSanL-ReguItal+g' \
+	-e 's+NimbusSanL-Regu-BoldItalic+NimbusSanL-BoldItal+g' \
+	-e 's+NimbusSanL-Regu-Bold+NimbusSanL-Bold+g' \
+	-e 's+StardardSymL-+Symbol-+g'
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] future: Fix embedded font name in .eps files
  2018-01-27  9:51 [PATCH 0/4] Fix fonts in figures Akira Yokosawa
  2018-01-27  9:55 ` [PATCH 1/4] Add fixsvgfonts.sh Akira Yokosawa
  2018-01-27  9:57 ` [PATCH 2/4] Fix pattern order in fixfonts.sh Akira Yokosawa
@ 2018-01-27  9:58 ` Akira Yokosawa
  2018-01-27  9:59 ` [PATCH 4/4] Makefile: Support URW++ v2 font family names Akira Yokosawa
  2018-01-28  4:44 ` [PATCH 0/4] Fix fonts in figures Paul E. McKenney
  4 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2018-01-27  9:58 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From 3976a1258fea7b1be19bbfba91a78f1603bb9be0 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sat, 27 Jan 2018 12:51:29 +0900
Subject: [PATCH 3/4] future: Fix embedded font name in .eps files

"NimbusSanL-Regu+g" is not a proper font name.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 future/be-lb-n4-rf-all.eps | 4 ++--
 future/be-lw-n4-rf-all.eps | 4 ++--
 future/latencytrend.eps    | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/future/be-lb-n4-rf-all.eps b/future/be-lb-n4-rf-all.eps
index e0ad1aa..5482a3f 100644
--- a/future/be-lb-n4-rf-all.eps
+++ b/future/be-lb-n4-rf-all.eps
@@ -249,7 +249,7 @@ gsave
 0.100 0.100 scale
 0 setgray
 newpath
-(NimbusSanL-Regu+g) findfont 100 scalefont setfont
+(NimbusSanL-Regu) findfont 100 scalefont setfont
 1.000 UL
 LTb
 450 300 M
@@ -459,5 +459,5 @@ grestore
 end
 showpage
 %%Trailer
-%%DocumentFonts: NimbusSanL-Regu+g
+%%DocumentFonts: NimbusSanL-Regu
 %%Pages: 1
diff --git a/future/be-lw-n4-rf-all.eps b/future/be-lw-n4-rf-all.eps
index afdf069..a9aa12e 100644
--- a/future/be-lw-n4-rf-all.eps
+++ b/future/be-lw-n4-rf-all.eps
@@ -249,7 +249,7 @@ gsave
 0.100 0.100 scale
 0 setgray
 newpath
-(NimbusSanL-Regu+g) findfont 100 scalefont setfont
+(NimbusSanL-Regu) findfont 100 scalefont setfont
 1.000 UL
 LTb
 630 300 M
@@ -591,5 +591,5 @@ grestore
 end
 showpage
 %%Trailer
-%%DocumentFonts: NimbusSanL-Regu+g
+%%DocumentFonts: NimbusSanL-Regu
 %%Pages: 1
diff --git a/future/latencytrend.eps b/future/latencytrend.eps
index 5db0682..676578b 100644
--- a/future/latencytrend.eps
+++ b/future/latencytrend.eps
@@ -249,7 +249,7 @@ gsave
 0.100 0.100 scale
 0 setgray
 newpath
-(NimbusSanL-Regu+g) findfont 100 scalefont setfont
+(NimbusSanL-Regu) findfont 100 scalefont setfont
 1.000 UL
 LTb
 570 300 M
@@ -449,5 +449,5 @@ grestore
 end
 showpage
 %%Trailer
-%%DocumentFonts: NimbusSanL-Regu+g
+%%DocumentFonts: NimbusSanL-Regu
 %%Pages: 1
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] Makefile: Support URW++ v2 font family names
  2018-01-27  9:51 [PATCH 0/4] Fix fonts in figures Akira Yokosawa
                   ` (2 preceding siblings ...)
  2018-01-27  9:58 ` [PATCH 3/4] future: Fix embedded font name in .eps files Akira Yokosawa
@ 2018-01-27  9:59 ` Akira Yokosawa
  2018-01-28  4:44 ` [PATCH 0/4] Fix fonts in figures Paul E. McKenney
  4 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2018-01-27  9:59 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From 3fd97ea1bffc46d5ea2946397d3fa5debf74579e Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sat, 27 Jan 2018 13:06:26 +0900
Subject: [PATCH 4/4] Makefile: Support URW++ v2 font family names

Add conversion scripts for URW++ v2 font family, which has been
introduced in Fedora 27.

Define macros in Makefile according to the output of "fc-list" so
that correct scripts are used for font conversion.

NOTE: Ghostscript 9.22 is not compatible with a2ping at the moment.[1]
Downgrading to 9.20 is necessary on Fedora 27.

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1530268

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 Makefile                         | 20 +++++++++----
 utilities/fixanepsfonts-urwps.sh | 27 ++++++++++++++++++
 utilities/fixfonts-urwps.sh      | 61 ++++++++++++++++++++++++++++++++++++++++
 utilities/fixsvgfonts-urwps.sh   | 23 +++++++++++++++
 4 files changed, 126 insertions(+), 5 deletions(-)
 create mode 100644 utilities/fixanepsfonts-urwps.sh
 create mode 100644 utilities/fixfonts-urwps.sh
 create mode 100644 utilities/fixsvgfonts-urwps.sh

diff --git a/Makefile b/Makefile
index f1b6715..465e139 100644
--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,16 @@ A2PING := $(shell which a2ping 2>/dev/null)

 INKSCAPE := $(shell which inkscape 2>/dev/null)

+URWPS := $(shell fc-list | grep "Nimbus Mono PS" | wc -l)
+
+ifeq ($(URWPS),0)
+FIXSVGFONTS   = utilities/fixsvgfonts.sh
+FIXANEPSFONTS = utilities/fixanepsfonts.sh
+else
+FIXSVGFONTS   = utilities/fixsvgfonts-urwps.sh
+FIXANEPSFONTS = utilities/fixanepsfonts-urwps.sh
+endif
+
 default = $(PERFBOOK_DEFAULT)

 ifeq ($(default),)
@@ -152,7 +162,7 @@ $(EPSSOURCES_FROM_TEX): %.eps: %.tex
 	sh utilities/mpostcheck.sh
 	@latex -output-directory=$(shell dirname $<) $< > /dev/null 2>&1
 	@dvips -Pdownload35 -E $(patsubst %.tex,%.dvi,$<) -o $@ > /dev/null 2>&1
-	@sh utilities/fixanepsfonts.sh $@
+	@sh $(FIXANEPSFONTS) $@

 $(EPSSOURCES_FROM_DOT): %.eps: %.dot
 	@echo "$< --> $@"
@@ -160,7 +170,7 @@ ifndef DOT
 	$(error "$< --> $@: dot not found. Please install graphviz")
 endif
 	@dot -Tps -o $@ $<
-	@sh utilities/fixanepsfonts.sh $@
+	@sh $(FIXANEPSFONTS) $@

 $(EPSSOURCES_FROM_FIG): %.eps: %.fig
 	@echo "$< --> $@"
@@ -168,12 +178,12 @@ ifndef FIG2EPS
 	$(error "$< --> $@: fig2eps not found. Please install fig2ps")
 endif
 	@fig2eps --nogv $< > /dev/null 2>&1
-	@sh utilities/fixanepsfonts.sh $@
+	@sh $(FIXANEPSFONTS) $@

 $(PDFTARGETS_OF_EPSORIG): %.pdf: %.eps
 	@echo "$< --> $@"
 	@cp $< $<i
-	@sh utilities/fixanepsfonts.sh $<i
+	@sh $(FIXANEPSFONTS) $<i
 ifndef A2PING
 	$(error "$< --> $@: a2ping not found. Please install it.")
 endif
@@ -192,7 +202,7 @@ $(PDFTARGETS_OF_SVG): %.pdf: %.svg
 ifndef INKSCAPE
 	$(error "$< --> $@: inkscape not found. Please install it.")
 endif
-	@sh utilities/fixsvgfonts.sh < $< > $<i
+	@sh $(FIXSVGFONTS) < $< > $<i
 	@inkscape --export-pdf=$@ $<i > /dev/null 2>&1
 	@rm -f $<i

diff --git a/utilities/fixanepsfonts-urwps.sh b/utilities/fixanepsfonts-urwps.sh
new file mode 100644
index 0000000..e1640c7
--- /dev/null
+++ b/utilities/fixanepsfonts-urwps.sh
@@ -0,0 +1,27 @@
+# fixanepsfonts-urwps.sh: Convert the specified .eps files to use
+# embeddable fonts.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
+# Copyright (c) 2018 Akira Yokosawa
+
+names=$*
+for i in $names
+do
+	mv $i $i.badfonts
+	sh utilities/fixfonts-urwps.sh < $i.badfonts > $i
+	rm $i.badfonts
+done
diff --git a/utilities/fixfonts-urwps.sh b/utilities/fixfonts-urwps.sh
new file mode 100644
index 0000000..20dea73
--- /dev/null
+++ b/utilities/fixfonts-urwps.sh
@@ -0,0 +1,61 @@
+# fixfonts-urwps.sh: Convert an .eps file to use embeddable fonts, taking from
+#	standard input and putting on standar output.
+#
+# Based on fixfonts.sh, updated for Fedora 27 by Akira Yokosawa.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (c) 2011 Paul E. McKenney, IBM Corporation.
+# Copyright (c) 2018 Akira Yokosawa.
+
+sed	-e 's+Times-Roman-BoldItalic+NimbusSans-BoldItalic+g' \
+	-e 's+Times-Roman-Italic+NimbusSans-Italic+g' \
+	-e 's+Times-Roman-Bold+NimbusSans-Bold+g' \
+	-e 's+Times-Roman+NimbusSans-Regular+g' \
+	-e 's+Times+NimbusSans-Regular+g' \
+	-e 's+Helvetica-BoldOblique+NimbusSans-BoldItalic+g' \
+	-e 's+Helvetica-Oblique+NimbusSans-Italic+g' \
+	-e 's+Helvetica-Bold-iso+NimbusSans-Bold+g' \
+	-e 's+Helvetica-Bold+NimbusSans-Bold+g' \
+	-e 's+Helvetica-Narrow-BoldOblique-iso+NimbusSansNarrow-BdOblique+g' \
+	-e 's+Helvetica-Narrow-BoldOblique+NimbusSansNarrow-BdOblique+g' \
+	-e 's+Helvetica-Narrow-Oblique-iso+NimbusSansNarrow-Oblique+g' \
+	-e 's+Helvetica-Narrow-Oblique+NimbusSansNarrow-Oblique+g' \
+	-e 's+Helvetica-Narrow-Bold-iso+NimbusSansNarrow-Bold+g' \
+	-e 's+Helvetica-Narrow-Bold+NimbusSansNarrow-Bold+g' \
+	-e 's+Helvetica-Narrow-iso+NimbusSansNarrow-Regular+g' \
+	-e 's+Helvetica-Narrow+NimbusSansNarrow-Regular+g' \
+	-e 's+Helvetica-iso+NimbusSans-Regular+g' \
+	-e 's+Helvetica+NimbusSans-Regular+g' \
+	-e 's+Symbol+StandardSymbolsPS+g' \
+	-e 's+Courier-BoldOblique+NimbusMonoPS-BoldItalic+g' \
+	-e 's+Courier-Oblique+NimbusMonoPS-Italic+g' \
+	-e 's+Courier-Bold+NimbusMonoPS-Bold+g' \
+	-e 's+Courier+NimbusMonoPS-Regular+g' \
+	-e 's+NimbusSanL-BoldItal+NimbusSans-BoldItalic+g' \
+	-e 's+NimbusSanL-ReguItal+NimbusSans-Italic+g' \
+	-e 's+NimbusSanL-Bold+NimbusSans-Bold+g' \
+	-e 's+NimbusSanL-Regu+NimbusSans-Regular+g' \
+	-e 's+NimbusMonL-BoldObli+NimbusMonoPS-BoldItalic+g' \
+	-e 's+NimbusMonL-ReguObli+NimbusMonoPS-Italic+g' \
+	-e 's+NimbusMonL-Bold+NimbusMonoPS-Bold+g' \
+	-e 's+NimbusMonL-Regu+NimbusMonoPS-Regular+g' \
+	-e 's+StandardSymL+StandardSymbolsPS+g' \
+	-e 's+NimbusMono-Regular-Bold+NimbusMonoPS-Bold+g' \
+	-e 's+NimbusMono-Regular+NimbusMonoPS-Regular+g' \
+	-e 's+NimbusSans-Regular-Italic+NimbusSans-Italic+g' \
+	-e 's+NimbusSans-Regular-BoldItalic+NimbusSans-BoldItalic+g' \
+	-e 's+NimbusSans-Regular-Bold+NimbusSans-Bold+g' \
+	-e 's+StandardSymbolsPS-+Symbol-+g'
diff --git a/utilities/fixsvgfonts-urwps.sh b/utilities/fixsvgfonts-urwps.sh
new file mode 100644
index 0000000..ac55b4a
--- /dev/null
+++ b/utilities/fixsvgfonts-urwps.sh
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# fixsvgfonts-urwps.sh: Convert an .svg file to use embeddable fonts,
+#       taking from standard input and putting on standar output.
+#
+# Copyright (c) 2018 Akira Yokosawa
+
+sed	-e 's+family:Helvetica+family:Nimbus Sans+g' \
+	-e 's+family="Helvetica+family="Nimbus Sans+g' \
+	-e 's+family:Sans+family:Nimbus Sans+g' \
+	-e 's+cation:Sans+cation:Nimbus Sans+g' \
+	-e 's+family:Courier+family:Nimbus Mono PS+g' \
+	-e 's+family="Courier+family="Nimbus Mono PS+g' \
+	-e 's+family:Symbol+family:Standard Symbols PS+g' \
+	-e 's+cation:Symbol+cation:Standard Symbols PS+g' \
+	-e 's+family:Nimbus Sans L+family:Nimbus Sans+g' \
+	-e 's+family="Nimbus Sans L+family="Nimbus Sans+g' \
+	-e 's+cation:Nimbus Sans L+cation:Nimbus Sans+g' \
+	-e 's+family:Nimbus Mono L+family:Nimbus Mono PS+g' \
+	-e 's+family="Nimbus Mono L+family="Nimbus Mono PS+g' \
+	-e 's+cation:Nimbus Mono L+cation:Nimbus Mono PS+g' \
+	-e 's+family:Standard Symbols L+family:Standard Symbols PS+g' \
+	-e 's+cation:Standard Symbosl L+cation:Standard Symbols PS+g'
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] Fix fonts in figures
  2018-01-27  9:51 [PATCH 0/4] Fix fonts in figures Akira Yokosawa
                   ` (3 preceding siblings ...)
  2018-01-27  9:59 ` [PATCH 4/4] Makefile: Support URW++ v2 font family names Akira Yokosawa
@ 2018-01-28  4:44 ` Paul E. McKenney
  4 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2018-01-28  4:44 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: perfbook

On Sat, Jan 27, 2018 at 06:51:07PM +0900, Akira Yokosawa wrote:
> >From 3fd97ea1bffc46d5ea2946397d3fa5debf74579e Mon Sep 17 00:00:00 2001
> From: Akira Yokosawa <akiyks@gmail.com>
> Date: Sat, 27 Jan 2018 16:30:20 +0900
> Subject: [PATCH 0/4] Fix fonts in figures
> 
> Hi Paul,
> 
> This patch set is the result of my investigation of improper font
> rendering in figures on Fedora 27.  In the end, I found several
> font-related issues which also affected the results on other
> platforms.
> 
> The cause of the font problem on Fedora 27 is the introduction
> of URW++ v2 font family.  It is not compatible with fixfonts.sh's
> font conversion.
> 
> Another problem on Fedora 27 is that ghostscript 9.22 does not work
> with a2ping script. I reported the issue to Red Hat Bugzilla [1].
> So far, it has not been resolved.  a2ping issue is not touched in
> this patch set.
> 
> [1]: https://bugzilla.redhat.com/show_bug.cgi?id=1530268
> 
> Patch #1 adds a font conversion script for .svg files. In some
> .svg files, non-free font names such as "Helvetica" and "Courier"
> are used. Also, a generic font name of "Sans" causes the result
> to depend on locale setting. Converting those names to URW font-
> family names can eliminate the ambiguity.
> It also adds a recipe to convert fonts in .eps files which are
> the origin of figures (mostly generated by gnuplot).
> 
> Patch #2 fixes fixfonts.sh to avoid unintended conversions.
> 
> Patch #3 fixes font names embedded in .eps files which look
> like the result of wrong conversion before they were committed.
> 
> Patch #4 adds conversion scripts for URW++ v2 font family.
> Which set of scripts to use is determined in Makefile according
> to the result of "fc-list" command.
> 
> These changes have been tested on Ubuntu Trusty, Ubuntu Xenial,
> Fedora 26, and Fedora 27 (with ghostscript downgraded to 9.20).
> 
> Differences in the resulting figures can be seen in Figures 9.1,
> 9.7, 9.8, 17.5, and 17.6.
> 
> You need to do "make neatfreak; make -j4" to ensure all the
> affected figures to be rebuilt.

They do look nicer.  Applied and pushed, thank you!!!

>          Thanks, Akira
> 
> NOTE 1: After KPTI was applied, ghostscript slowed down significantly
> on virtual guest machines (might as well on real machines).

Meltdown and Spectre do seem to exact a price in terms of performance,
don't they?  :-/

> NOTE 2: Before this change, full rebuild on Ubuntu Trusty with small
> RAM size (<2GB) sometimes ended up in DOS (thrashing). Now this
> symptom has disappeared.

Very good!  (Me, I have quite a bit more memory, but very good to
make it work for people on smaller systems.)

							Thanx, Paul

> --
> Akira Yokosawa (4):
>   Add fixsvgfonts.sh
>   Fix pattern order in fixfonts.sh
>   future: Fix embedded font name in .eps files
>   Makefile: Support URW++ v2 font family names
> 
>  Makefile                         | 38 +++++++++++++++++++++----
>  future/be-lb-n4-rf-all.eps       |  4 +--
>  future/be-lw-n4-rf-all.eps       |  4 +--
>  future/latencytrend.eps          |  4 +--
>  utilities/fixanepsfonts-urwps.sh | 27 ++++++++++++++++++
>  utilities/fixfonts-urwps.sh      | 61 ++++++++++++++++++++++++++++++++++++++++
>  utilities/fixfonts.sh            | 28 ++++++++++++++----
>  utilities/fixsvgfonts-urwps.sh   | 23 +++++++++++++++
>  utilities/fixsvgfonts.sh         | 15 ++++++++++
>  9 files changed, 187 insertions(+), 17 deletions(-)
>  create mode 100644 utilities/fixanepsfonts-urwps.sh
>  create mode 100644 utilities/fixfonts-urwps.sh
>  create mode 100644 utilities/fixsvgfonts-urwps.sh
>  create mode 100644 utilities/fixsvgfonts.sh
> 
> -- 
> 2.7.4
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-28  4:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-27  9:51 [PATCH 0/4] Fix fonts in figures Akira Yokosawa
2018-01-27  9:55 ` [PATCH 1/4] Add fixsvgfonts.sh Akira Yokosawa
2018-01-27  9:57 ` [PATCH 2/4] Fix pattern order in fixfonts.sh Akira Yokosawa
2018-01-27  9:58 ` [PATCH 3/4] future: Fix embedded font name in .eps files Akira Yokosawa
2018-01-27  9:59 ` [PATCH 4/4] Makefile: Support URW++ v2 font family names Akira Yokosawa
2018-01-28  4:44 ` [PATCH 0/4] Fix fonts in figures Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.