Howdy,

I've been trying to get (the very cool) GraphViz.pm working under Mac OS
X 10.0.4. Oddly enough, the module downloaded and installed just fine,
all tests passing.  The reason this was strange is that these tests
passed despite the fact that graphviz (the backend rendering engine)
wasn't even installed on my system yet.

In any case, I've got it mostly working now, but fonts were very tricky.
For a while, any text labels in the output were rendered as
binary-gibberish text.  Finally got it to work, so I'm posting my
results.  Here's what I've done:

1) Using the CPAN module, do 'install GraphViz' and let it install any
dependency files.

2) Get the "dot" command-line program from
http://www.research.att.com/sw/tools/graphviz/download.html (look for
the "Apple Mac OS X" binaries), rename it from "dot.exe" to "dot", make
it executable, and move it to somewhere in my path:

  wget http://www.research.att.com/sw/tools/graphviz/dist/osx/dot.exe
  chmod u+x dot.exe
  sudo mv dot.exe /usr/local/bin/dot

3) Try a sample script using GraphViz.  I get the error:
can't find font Times in 
/usr/share/ttf:/usr/local/share/ttf:/usr/share/fonts/ttf:/usr/local/share/f
onts/ttf:/usr/lib/fonts:/usr/local/lib/fonts:/usr/lib/fonts/ttf:/usr/local/
lib/fonts/ttf:/usr/common/graphviz/lib/fonts/ttf:/windows/fonts:/dos/window
s/fonts:/usr/add-on/share/ttf:.

4) I noticed that '.' was in the font path (most of the other
directories don't exist), so I tried putting Times in the current
directory.  Of course, this doesn't work, since the system fonts are in
Macintosh format (with resource fork, etc.) and it expects them to be in
a single file.  So I downloaded the TTConverter program (runs under
Classic, at http://www.versiontracker.com/moreinfo.fcgi?id=4632&db=mac),
which converted the font to Windows format, which I suppose is the same
as Unix format.  TTConverter generated several .TTF files, including one
called TIMESNR.TTF (Times New Roman).

5) I put the file TIMESNR.TTF in the current directory, then specified
fontname => "TIMESNR" in the Perl code that creates the GraphViz nodes. 
Worked like a charm (a very hard-to-find charm, nonetheless!).  =)



Hope this helps someone who treads this path after me.  If I were going
to be doing this stuff a lot (as I might do), I'd probably put whatever
.TTF files I wanted to use into more central directories so I didn't
have to keep shuffling them around.



  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  [EMAIL PROTECTED]                            The Math Forum

Reply via email to