Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Strange error w/ Mlgraph.make_font
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Matt Gushee <mgushee@h...>
Subject: [Caml-list] Strange error w/ Mlgraph.make_font
I have been doing some work with Mlgraph lately, and have noticed a
problem with the make_font function:

  bash-2.05a$ ocaml mlgraph.cma
          Objective Caml version 3.06
  
  # open Mlgraph;;
  # let f = make_font Helvetica 12.;;
  Exception: Failure "float_of_string".

This happens with proportional fonts (Helvetica, Times, and Symbol),
but not for fixed-width fonts (Courier). I tracked down the cause today:
it's because the function that loads the font definition files is 
attempting to apply 'float_of_string' to lines ending in semicolons.
So, for my own installation, I've added a 'strip_semicolon' function
to 'fonts.ml'.

However, I am planning to distribute a software package that may 
depend on MLgraph, so I'd like to make a patch available for this
error. But I'm wondering if my fix is really the right solution. 
What's strange about this is that it's almost certain that anyone
who tried to use MLgraph would have discovered this bug a long time
ago, so I can only think that, once upon a time, it wasn't a bug, but
something outside of Mlgraph changed to cause the error. For example:

  Older versions of Ghostscript didn't add semicolons to the ends
  of the problematic lines; or

  Older versions of OCaml had a float_of_string function that 
  ignored trailing semicolons.

Anybody know what the real reason might be?

While I'm at it, are the MLgraph developers still around? Would they
(you) be interested in accepting patches?

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners