Skip Menu |

This queue is for tickets about the SQL-Translator CPAN distribution.

Report information
The Basics
Id: 22028
Status: open
Priority: 0/
Queue: SQL-Translator

People
Owner: Nobody in particular
Requestors: cpan [...] clotho.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.07
Fixed in: (no value)



Subject: sqlt-graph has no font options
I get this message with sqlt-graph: Error: Could not find/open font : Times-Roman That's probably an issue with my graphviz installation. However, I notice that unlike sqlt-diagram, sqlt-graph does not have an option to select a different font.
On Wed Oct 11 10:25:13 2006, CLOTHO wrote: Show quoted text
> I get this message with sqlt-graph: > Error: Could not find/open font : Times-Roman > That's probably an issue with my graphviz installation. However, I > notice that unlike sqlt-diagram, sqlt-graph does not have an option to > select a different font.
The attached patch resolves this bug as well as RT #22027. In summary: * Fixes scalar opts to Getopt in sqlt_graph [RT 22027] * Adds "--font-name" opt to sqlt_graph [RT 22028] * Passes $fontname to S::T::Producer::GraphViz [RT 22028] * Passes $fontname to GraphViz.pm if set [RT 22028] * Fiddles display of text in box [no RT ticket] (before and after attached as PNG images) With this patch, I can now say: sqlt-graph -o schema.png --font-name=cour -d MySQL schema.sql and get nice looking schema graphs which work on my Mac running the Fink version of graphviz 1.16.
Index: bin/sqlt-graph =================================================================== RCS file: /cvsroot/sqlfairy/sqlfairy/bin/sqlt-graph,v retrieving revision 1.6 diff -u -r1.6 sqlt-graph --- bin/sqlt-graph 30 Aug 2004 18:59:09 -0000 1.6 +++ bin/sqlt-graph 11 Oct 2006 18:48:12 -0000 @@ -100,7 +100,7 @@ $layout, $node_shape, $out_file, $output_type, $db_driver, $add_color, $natural_join, $join_pk_only, $skip_fields, $show_datatypes, $show_sizes, $show_constraints, $debug, $help, $height, $width, - $no_fields + $no_fields, $fontname ); GetOptions( @@ -116,9 +116,10 @@ 'natural-join' => \$natural_join, 'natural-join-pk' => \$join_pk_only, 's|skip:s' => \$skip_fields, - 'show-datatypes' => $show_datatypes, - 'show-sizes' => $show_sizes, - 'show-constraints' => $show_constraints, + 'show-datatypes' => \$show_datatypes, + 'show-sizes' => \$show_sizes, + 'show-constraints' => \$show_constraints, + 'font-name:s' => \$fontname, 'debug' => \$debug, 'h|help' => \$help, ) or die pod2usage; @@ -147,6 +148,7 @@ height => $height || 0, width => $width || 0, show_fields => $no_fields ? 0 : 1, + fontname => $fontname, }, ) or die SQL::Translator->error; Index: lib/SQL/Translator/Producer/GraphViz.pm =================================================================== RCS file: /cvsroot/sqlfairy/sqlfairy/lib/SQL/Translator/Producer/GraphViz.pm,v retrieving revision 1.12 diff -u -r1.12 GraphViz.pm --- lib/SQL/Translator/Producer/GraphViz.pm 20 Feb 2004 02:41:47 -0000 1.12 +++ lib/SQL/Translator/Producer/GraphViz.pm 11 Oct 2006 18:48:13 -0000 @@ -231,6 +231,7 @@ my $show_constraints = $args->{'show_constraints'}; my $join_pk_only = $args->{'join_pk_only'}; my $skip_fields = $args->{'skip_fields'}; + my $fontname = $args->{'fontname'}; my %skip = map { s/^\s+|\s+$//g; $_, 1 } split ( /,/, $skip_fields ); $natural_join ||= $join_pk_only; @@ -262,7 +263,8 @@ node => { shape => $node_shape, style => 'filled', - fillcolor => 'white' + fillcolor => 'white', + $fontname ? (fontname => $fontname) : (), } ); $args{'width'} = $width if $width; @@ -300,8 +302,8 @@ . '\ ' } @fields ) . '\l'; - my $label = $show_fields ? "{$table_name|$field_str}" : $table_name; - $gv->add_node( $table_name, label => $label ); + my $label = $show_fields ? $table_name . '\l' . $field_str : $table_name; + $gv->add_node( $table_name, label => $label); debug("Processing table '$table_name'");
Download schema_after.png
image/png 2.6k
schema_after.png