I have taken a look at render.ml and have written a patch that will
enable the use of the PNG-rendering program dvipng. This would reduce
load on the server, and also enable full-alpha transparency (but I
havent included that yet, IE has problems with full-alpha PNGs).
There is already a patch somewhere, but in this attempt I have tried to
make sure that the old dvips->convert renderer is used in the case
dvipng fails (or indeed, is not present on the system). Unfortunately I
do not have a server to test it on. Does anyone want to try it?
The patch is small, so I suppose there is no real harm in including it here.
/Jan-Åke
Index: render.ml
===================================================================
--- render.ml (revision 16007)
+++ render.ml (working copy)
@@ -2,6 +2,10 @@
let cmd_latex tmpprefix = "latex " ^ tmpprefix ^ ".tex >/dev/null"
(* Putting -transparent white in converts arguments will sort-of give you transperancy *)
let cmd_convert tmpprefix finalpath = "convert -quality 100 -density 120 " ^ tmpprefix ^ ".ps " ^ finalpath ^ " >/dev/null 2>/dev/null"
+(* Putting -bg Transparent in dvipng's arguments will give full-alpha transparency *)
+(* Note that IE have problems with such PNGs and need an additional javascript snippet *)
+(* Putting -bg transparent in dvipng's arguments will give binary transparency *)
+let cmd_dvipng tmpprefix finalpath = "dvipng -gamma 1.5 -D 120 -T tight --strict " ^ tmpprefix ^ ".dvi -o " ^ finalpath ^ " >/dev/null 2>/dev/null"
exception ExternalCommandFailure of string
@@ -25,9 +29,11 @@
close_out f;
if Util.run_in_other_directory tmppath (cmd_latex tmpprefix0) != 0
then (unlink_all (); raise (ExternalCommandFailure "latex"))
- else if (Sys.command (cmd_dvips tmpprefix) != 0)
+ else if (Sys.command (cmd_dvipng tmpprefix (finalpath^"/"^md5^".png")) != 0)
+ then (if (Sys.command (cmd_dvips tmpprefix) != 0)
then (unlink_all (); raise (ExternalCommandFailure "dvips"))
else if (Sys.command (cmd_convert tmpprefix (finalpath^"/"^md5^".png")) != 0)
then (unlink_all (); raise (ExternalCommandFailure "convert"))
+ else unlink_all ())
else unlink_all ()
end