From: Matthew Fernandez Date: Sat, 22 May 2021 23:37:41 +0000 (-0700) Subject: commit generated ps_font_equiv.h and remove generator for this X-Git-Tag: 2.47.3~22^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35f94e722ad4051a0f121c97b4ae55045f561f3a;p=graphviz commit generated ps_font_equiv.h and remove generator for this The header ps_font_equiv.h was generated from 3 files, fontmap.cfg, ps_font_equiv.txt, and ps_fontmap.txt. The generator itself was the Perl file, mksvgfonts.pl. The generation process is deterministic and not dependent on the end user’s system. In fact, ps_font_equiv.h is generated during CI and included in the portable source tarball. Furthermore the main driving source for this, ps_font_equiv.txt is no clearer or more commented than the generated header. Finally, a copy of the generated header was actually already committed to the repository under windows/include/ for the MSBuild work flow that does not want to call Perl. For these reasons, having this as a generated file was no advantage. In fact, this was a net negative in the build process as it is the only thing in the build that requires Perl. As of this commit, Perl is no longer required to build Graphviz. Perl is still necessary for building some optional components like the Graphviz bindings for Perl. Closes #2067. --- diff --git a/.gitignore b/.gitignore index a1354621a..4d1e19a69 100644 --- a/.gitignore +++ b/.gitignore @@ -163,7 +163,6 @@ lib/common/colortbl.h lib/common/htmlparse.c lib/common/htmlparse.h lib/common/htmlparse.output -lib/common/ps_font_equiv.h lib/common/svgcolor_lib lib/expr/exparse.c lib/expr/exparse.h diff --git a/CHANGELOG.md b/CHANGELOG.md index a62750f33..97998fd56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - marginally more accurate computations in Smyrna sphere projection +- Perl is no longer required to build Graphviz #2067 ## [2.47.2] - 2021-05-26 diff --git a/lib/common/CMakeLists.txt b/lib/common/CMakeLists.txt index 2620f1867..de233fd8b 100644 --- a/lib/common/CMakeLists.txt +++ b/lib/common/CMakeLists.txt @@ -33,22 +33,6 @@ add_custom_command( ${CMAKE_CURRENT_BINARY_DIR}/color_lib > ${CMAKE_CURRENT_BINARY_DIR}/common/colortbl.h ) -# Generate ps_font_equiv.h from sources -add_custom_command( - OUTPUT ps_font_equiv.h - DEPENDS - ${CMAKE_CURRENT_SOURCE_DIR}/mksvgfonts.pl - ${CMAKE_CURRENT_SOURCE_DIR}/ps_font_equiv.txt - ${CMAKE_CURRENT_SOURCE_DIR}/fontmap.cfg - ${CMAKE_CURRENT_SOURCE_DIR}/ps_fontmap.txt - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/ps_fontmap.txt - ${CMAKE_CURRENT_BINARY_DIR}/ps_font_equiv.h - COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/mksvgfonts.pl - ${CMAKE_CURRENT_SOURCE_DIR}/fontmap.cfg - ${CMAKE_CURRENT_SOURCE_DIR}/ps_font_equiv.txt - >> ${CMAKE_CURRENT_BINARY_DIR}/ps_font_equiv.h -) - add_library(common_obj OBJECT # Header files arith.h diff --git a/lib/common/Makefile.am b/lib/common/Makefile.am index 0b76a8764..8f0d6bd20 100644 --- a/lib/common/Makefile.am +++ b/lib/common/Makefile.am @@ -15,27 +15,22 @@ AM_CFLAGS = -D_BLD_gvc=1 AM_CPPFLAGS += -O0 endif -BUILT_SOURCES = colortbl.h ps_font_equiv.h htmlparse.h +BUILT_SOURCES = colortbl.h htmlparse.h pkginclude_HEADERS = arith.h geom.h color.h types.h textspan.h usershape.h noinst_HEADERS = render.h utils.h memory.h \ geomprocs.h colorprocs.h colortbl.h entities.h globals.h \ logic.h const.h macros.h htmllex.h htmltable.h pointset.h intset.h \ - timing.h + timing.h ps_font_equiv.h noinst_LTLIBRARIES = libcommon_C.la libcommon_C_la_SOURCES = arrows.c colxlate.c ellipse.c textspan.c \ args.c memory.c globals.c htmllex.c htmlparse.y htmltable.c input.c \ pointset.c intset.c postproc.c routespl.c splines.c psusershape.c \ timing.c labels.c ns.c shapes.c utils.c geom.c taper.c \ - output.c emit.c ps_font_equiv.txt ps_fontmap.txt fontmap.cfg \ + output.c emit.c \ color_names -# ensure font names are properly sorted for bsearch operation -ps_font_equiv.h: $(srcdir)/ps_font_equiv.txt $(srcdir)/fontmap.cfg $(srcdir)/ps_fontmap.txt - cp $(srcdir)/ps_fontmap.txt ps_font_equiv.h - ./mksvgfonts.pl fontmap.cfg ps_font_equiv.txt | LC_ALL=C $(SORT) >>ps_font_equiv.h - colxlate.o colxlate.lo : colortbl.h colortbl.h : color_lib @@ -57,11 +52,11 @@ htmlparse.o htmlparse.lo: htmlparse.c htmlparse.h htmlparse.c htmlparse.h: $(top_srcdir)/lib/common/htmlparse.y @YACC@ -Wno-yacc -dv $(top_srcdir)/lib/common/htmlparse.y -o htmlparse.c -DISTCLEANFILES = brewer_lib color_lib colortbl.h ps_font_equiv.h \ +DISTCLEANFILES = brewer_lib color_lib colortbl.h \ htmlparse.[ch] -EXTRA_DIST = README.imap chars.tcl ps_font_equiv.h \ +EXTRA_DIST = README.imap chars.tcl \ htmlparse.c htmlparse.h \ entities.html entities.tcl \ brewer_colors brewer_lib svgcolor_names svgcolor_lib \ - color_names color_lib colortbl.h mksvgfonts.pl + color_names color_lib colortbl.h diff --git a/lib/common/fontmap.cfg b/lib/common/fontmap.cfg deleted file mode 100644 index 253cf2621..000000000 --- a/lib/common/fontmap.cfg +++ /dev/null @@ -1,255 +0,0 @@ - -# Use this font configuration file if you have the GhostScript fonts -# installed on your system. This allows to produce SVG files for embedding -# into documents. - -# Before you use this font configuration file, do the following -# steps: -# * Download the GhostScript fonts, unpack the archive -# and copy the *.pfb and *.afm files into C:\Windows\Fonts -# (directory name may differ). - -[Times-Roman] -name = NimbusRomNo9L-Regu - source type = system - features = roman - family = Times - driver = * - -[Times-Italic] -name = NimbusRomNo9L-ReguItal - source type = system - features = roman italic - family = Times - driver = * - -[Times-Bold] -name = NimbusRomNo9L-Medi - source type = system - features = roman bold - family = Times - driver = * - -[Times-BoldItalic] -name = NimbusRomNo9L-MediItal - source type = system - features = roman bold italic - family = Times - driver = * - -[AvantGarde-Book] -name = URWGothicL-Book - source type = system - features = sans-serif - family = AvantGarde - driver = * - -[AvantGarde-BookOblique] -name = URWGothicL-BookObli - source type = system - features = sans-serif italic - family = AvantGarde - driver = * - -[AvantGarde-Demi] -name = URWGothicL-Demi - source type = system - features = sans-serif bold - family = AvantGarde - driver = * - -[AvantGarde-DemiOblique] -name = URWGothicL-DemiObli - source type = system - features = sans-serif bold italic - family = AvantGarde - driver = * - -[Bookman-Light] -name = URWBookmanL-Ligh - source type = system - features = roman - family = Bookman - driver = * - -[Bookman-LightItalic] -name = URWBookmanL-LighItal - source type = system - features = roman italic - family = Bookman - driver = * - -[Bookman-Demi] -name = URWBookmanL-Demi - source type = system - features = roman bold - family = Bookman - driver = * - -[Bookman-DemiItalic] -name = URWBookman-DemiItal - source type = system - features = roman bold italic - family = Bookman - driver = * - -[Courier] -name = NimbusMonL-Regu - source type = system - features = typewriter - family = Courier - driver = * - -[Courier-Oblique] -name = NimbusMonL-ReguObli - source type = system - features = typewriter italic - family = Courier - driver = * - -[Courier-Bold] -name = NimbusMonL-Bold - source type = system - features = typewriter bold - family = Courier - driver = * - -[Courier-BoldOblique] -name = NimbusMonL-BoldObli - source type = system - features = typewriter bold italic - family = Courier - driver = * - -[Helvetica] -name = NimbusSanL-Regu - source type = system - features = sans-serif - family = Helvetica - driver = * - -[Helvetica-Oblique] -name = NimbusSanL-ReguItal - source type = system - features = sans-serif italic - family = Helvetica - driver = * - -[Helvetica-Bold] -name = NimbusSanL-Bold - source type = system - features = sans-serif bold - family = Helvetica - driver = * - -[Helvetica-BoldOblique] -name = NimbusSanL-BoldItal - source type = system - features = sans-serif bold italic - family = Helvetica - driver = * - -[Helvetica-Narrow] -name = NimbusSanL-ReguCond - source type = system - features = sans-serif - family = Helvetica Narrow - driver = * - -[Helvetica-Narrow-Oblique] -name = NimbusSanL-ReguCondItal - source type = system - features = sans-serif italic - family = Helvetica Narrow - driver = * - -[Helvetica-Narrow-Bold] -name = NimbusSanL-BoldCond - source type = system - features = sans-serif bold - family = Helvetica Narrow - driver = * - -[Helvetica-Narrow-BoldOblique] -name = NimbusSanL-BoldCondItal - source type = system - features = sans-serif bold italic - family = Helvetica Narrow - driver = * - -[NewCenturySchlbk-Roman] -name = CenturySchL-Roma - source type = system - features = roman - family = New Century Schoolbook - driver = * - -[NewCenturySchlbk-Italic] -name = CenturySchL-RomaItal - source type = system - features = roman italic - family = New Century Schoolbook - driver = * - -[NewCenturySchlbk-Bold] -name = CenturySchL-Bold - source type = system - features = roman bold - family = New Century Schoolbook - driver = * - -[NewCenturySchlbk-BoldItalic] -name = CenturySchL-BoldItal - source type = system - features = roman bold italic - family = New Century Schoolbook - driver = * - -[Palatino-Roman] -name = URWPalladioL-Roma - source type = system - features = roman - family = Palatino - driver = * - -[Palatino-Italic] -name = URWPalladioL-Ital - source type = system - features = roman italic - family = Palatino - driver = * - -[Palatino-Bold] -name = URWPalladioL-Bold - source type = system - features = roman bold - family = Palatino - driver = * - -[Palatino-BoldItalic] -name = URWPalladioL-BoldItal - source type = system - features = roman bold italic - family = Palatino - driver = * - -[Symbol] -name = StandardSymL - source type = system - family = Symbol - driver = * - -[ZapfChancery-MediumItalic] -name = URWChanceryL-MediItal - source type = system - features = roman italic - family = Zapf Chancery - driver = * - -[ZapfDingbats] -name = Dingbats - source type = system - family = Zapf Dingbats - driver = * - - diff --git a/lib/common/mksvgfonts.pl b/lib/common/mksvgfonts.pl deleted file mode 100755 index 1802eec17..000000000 --- a/lib/common/mksvgfonts.pl +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl - -# translate a ghostscript config to a graphviz ps_font_equiv.h table -use English; -my %features = (); - -my %map = ( -"roman" => "serif", -"sans-serif" => "sans-Serif", -"typewriter" => "monospace" -); - -# weight normal or bold -# style normal or italic - -if ($#ARGV + 1 != 2) { die "usage: cf2psfe.pl fontmap.cfg ps_font_equiv.txt";} - -open(CONFIG,"< $ARGV[0]"); -while () { - next if /^#/; - if (/\[(.+)\]/) { $fontname = $1;} - if (/features\s*=\s*(.+)/) { $features{$fontname} = $1;} -} - -open(SOURCE,"< $ARGV[1]"); -while () { - my ($fontfam, $weight, $style); - m/"([^"]+)"/; - $f = $features{$1}; - while (($key,$value) = each(%map)) { - $fontfam = $value if ($f =~ /$key/); - } - $style = ($f =~ /italic/? q("italic") : 0); - $weight= ($f =~ /bold/? q("bold") : 0); - if ($fontfam eq "") {warn "don't know about $1\n"; $fontfam = "fantasy";} - $_ =~ s/},$/,\t\"$fontfam\",\t$weight,\t$style},/; - print $_; -} diff --git a/windows/include/ps_font_equiv.h b/lib/common/ps_font_equiv.h similarity index 100% rename from windows/include/ps_font_equiv.h rename to lib/common/ps_font_equiv.h diff --git a/lib/common/ps_font_equiv.txt b/lib/common/ps_font_equiv.txt deleted file mode 100644 index 26a768460..000000000 --- a/lib/common/ps_font_equiv.txt +++ /dev/null @@ -1,35 +0,0 @@ -{"AvantGarde-Book", "URW Gothic L", "book", 0, 0, 4 }, -{"AvantGarde-BookOblique", "URW Gothic L", "book", 0, "oblique", 5 }, -{"AvantGarde-Demi", "URW Gothic L", "demi", 0, 0, 6 }, -{"AvantGarde-DemiOblique", "URW Gothic L", "demi", 0, "oblique", 7 }, -{"Bookman-Demi", "URW Bookman L", "demi", 0, 0, 10}, -{"Bookman-DemiItalic", "URW Bookman L", "demi", 0, "italic", 11}, -{"Bookman-Light", "URW Bookman L", "light", 0, 0, 8 }, -{"Bookman-LightItalic", "URW Bookman L", "light", 0, "italic", 9 }, -{"Courier", COURIER, 0, 0, 0, 12}, -{"Courier-Bold", COURIER, "bold", 0, 0, 14}, -{"Courier-BoldOblique", COURIER, "bold", 0, "oblique", 15}, -{"Courier-Oblique", COURIER, 0, 0, "oblique", 13}, -{"Helvetica", HELVETICA, 0, 0, 0, 16}, -{"Helvetica-Bold", HELVETICA, "bold", 0, 0, 18}, -{"Helvetica-BoldOblique", HELVETICA, "bold", 0, "oblique", 19}, -{"Helvetica-Narrow", HELVETICA, 0, "condensed", 0, 20}, -{"Helvetica-Narrow-Bold", HELVETICA, "bold", "condensed", 0, 22}, -{"Helvetica-Narrow-BoldOblique",HELVETICA, "bold", "condensed", "oblique", 23}, -{"Helvetica-Narrow-Oblique", HELVETICA, 0, "condensed", "oblique", 21}, -{"Helvetica-Oblique", HELVETICA, 0, 0, "oblique", 17}, -{"NewCenturySchlbk-Bold", "Century Schoolbook L", "bold", 0, 0, 26}, -{"NewCenturySchlbk-BoldItalic", "Century Schoolbook L", "bold", 0, "italic", 27}, -{"NewCenturySchlbk-Italic", "Century Schoolbook L", 0, 0, "italic", 25}, -{"NewCenturySchlbk-Roman", "Century Schoolbook L", "roman", 0, 0, 24}, -{"Palatino-Bold", PALATINO, "bold", 0, 0, 30}, -{"Palatino-BoldItalic", PALATINO, "bold", 0, "italic", 31}, -{"Palatino-Italic", PALATINO, 0, 0, "italic", 29}, -{"Palatino-Roman", PALATINO, "roman", 0, 0, 28}, -{"Symbol", SYMBOL, 0, 0, 0, 32}, -{"Times-Bold", "Times", "bold", 0, 0, 2 }, -{"Times-BoldItalic", "Times", "bold", 0, "italic", 3 }, -{"Times-Italic", "Times", 0, 0, "italic", 1 }, -{"Times-Roman", TIMES, 0, 0, 0, 0 }, -{"ZapfChancery-MediumItalic", "URW Chancery L", "medium", 0, "italic", 33}, -{"ZapfDingbats", "Dingbats", 0, 0, 0, 34}, diff --git a/lib/common/ps_fontmap.txt b/lib/common/ps_fontmap.txt deleted file mode 100644 index bdf1978dd..000000000 --- a/lib/common/ps_fontmap.txt +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef DARWIN -#define TIMES "Times" -#elif defined(_WIN32) -#define TIMES "Times New Roman" -#else -#define TIMES "Times" -#endif -#define COURIER "Courier" -#define HELVETICA "Helvetica" -#define SYMBOL "Symbol" -#define PALATINO "Palatino Linotype" diff --git a/lib/common/textspan.c b/lib/common/textspan.c index 5e16c24ad..b679a36bf 100644 --- a/lib/common/textspan.c +++ b/lib/common/textspan.c @@ -162,10 +162,6 @@ estimate_textspan_size(textspan_t * span, char **fontpath) /* * This table maps standard Postscript font names to URW Type 1 fonts. - * - * The original source is in ps_font_equiv.txt. This is sorted - * during make into ps_font_equiv.h to ensure that it is in the right - * order for bsearch() */ static PostscriptAlias postscript_alias[] = { #include "ps_font_equiv.h"