Index: trunk/phase3/math/render.ml |
— | — | @@ -5,11 +5,11 @@ |
6 | 6 | (* Putting -bg Transparent in dvipng's arguments will give full-alpha transparency *) |
7 | 7 | (* Note that IE have problems with such PNGs and need an additional javascript snippet *) |
8 | 8 | (* Putting -bg transparent in dvipng's arguments will give binary transparency *) |
9 | | -let cmd_dvipng tmpprefix finalpath = "dvipng -gamma 1.5 -D 120 -T tight --strict " ^ tmpprefix ^ ".dvi -o " ^ finalpath ^ " >/dev/null 2>/dev/null" |
| 9 | +let cmd_dvipng tmpprefix finalpath backcolor = "dvipng -bg \'" ^ backcolor ^ "\' -gamma 1.5 -D 120 -T tight --strict " ^ tmpprefix ^ ".dvi -o " ^ finalpath ^ " >/dev/null 2>/dev/null" |
10 | 10 | |
11 | 11 | exception ExternalCommandFailure of string |
12 | 12 | |
13 | | -let render tmppath finalpath outtex md5 = |
| 13 | +let render tmppath finalpath outtex md5 backcolor = |
14 | 14 | let tmpprefix0 = (string_of_int (Unix.getpid ()))^"_"^md5 in |
15 | 15 | let tmpprefix = (tmppath^"/"^tmpprefix0) in |
16 | 16 | let unlink_all () = |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | close_out f; |
32 | 32 | if Util.run_in_other_directory tmppath (cmd_latex tmpprefix0) != 0 |
33 | 33 | then (unlink_all (); raise (ExternalCommandFailure "latex")) |
34 | | - else if (Sys.command (cmd_dvipng tmpprefix (finalpath^"/"^md5^".png")) != 0) |
| 34 | + else if (Sys.command (cmd_dvipng tmpprefix (finalpath^"/"^md5^".png") backcolor) != 0) |
35 | 35 | then (if (Sys.command (cmd_dvips tmpprefix) != 0) |
36 | 36 | then (unlink_all (); raise (ExternalCommandFailure "dvips")) |
37 | 37 | else if (Sys.command (cmd_convert tmpprefix (finalpath^"/"^md5^".png")) != 0) |
Index: trunk/phase3/math/README |
— | — | @@ -48,13 +48,13 @@ |
49 | 49 | |
50 | 50 | === Command-line parameters === |
51 | 51 | |
52 | | - texvc <temp directory> <output directory> <TeX code> <encoding> |
| 52 | + texvc <temp directory> <output directory> <TeX code> <encoding> <color> |
53 | 53 | |
54 | 54 | Be sure to properly quote the TeX code! |
55 | 55 | |
56 | 56 | Example: |
57 | 57 | |
58 | | - texvc /home/wiki/tmp /home/wiki/math "y=x+2" iso-8859-1 |
| 58 | + texvc /home/wiki/tmp /home/wiki/math "y=x+2" iso-8859-1 "rgb 1.0 1.0 1.0" |
59 | 59 | |
60 | 60 | === Output format === |
61 | 61 | |
Index: trunk/phase3/math/texvc.ml |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | try Lexer.token lexbuf |
5 | 5 | with Failure s -> raise (LexerException s) |
6 | 6 | |
7 | | -let render tmppath finalpath tree = |
| 7 | +let render tmppath finalpath tree backcolor = |
8 | 8 | let outtex = Util.mapjoin Texutil.render_tex tree in |
9 | 9 | let md5 = Digest.to_hex (Digest.string outtex) in |
10 | 10 | begin |
— | — | @@ -19,11 +19,11 @@ |
20 | 20 | | Some h,Html.LIBERAL,Some m -> "L" ^ md5 ^ h ^ "\000" ^ m |
21 | 21 | | None,_,Some m -> "X" ^ md5 ^ m |
22 | 22 | ); |
23 | | - Render.render tmppath finalpath outtex md5 |
| 23 | + Render.render tmppath finalpath outtex md5 backcolor |
24 | 24 | end |
25 | 25 | let _ = |
26 | 26 | Texutil.set_encoding (try Sys.argv.(4) with _ -> "UTF-8"); |
27 | | - try render Sys.argv.(1) Sys.argv.(2) (Parser.tex_expr lexer_token_safe (Lexing.from_string Sys.argv.(3))) |
| 27 | + try render Sys.argv.(1) Sys.argv.(2) (Parser.tex_expr lexer_token_safe (Lexing.from_string Sys.argv.(3))) (try Sys.argv.(5) with _ -> "rgb 1.0 1.0 1.0") |
28 | 28 | with Parsing.Parse_error -> print_string "S" |
29 | 29 | | LexerException _ -> print_string "E" |
30 | 30 | | Texutil.Illegal_tex_function s -> print_string ("F" ^ s) |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1895,6 +1895,13 @@ |
1896 | 1896 | $wgUseTeX = false; |
1897 | 1897 | /** Location of the texvc binary */ |
1898 | 1898 | $wgTexvc = './math/texvc'; |
| 1899 | +/** |
| 1900 | + * Texvc background color |
| 1901 | + * use LaTeX color format as used in \special function |
| 1902 | + * for transparent background use value 'Transparent' for alpha transparency or |
| 1903 | + * 'transparent' for binary transparency. |
| 1904 | + */ |
| 1905 | +$wgTexvcBackgroundColor = 'rgb 1.0 1.0 1.0'; |
1899 | 1906 | |
1900 | 1907 | /** |
1901 | 1908 | * Normally when generating math images, we double-check that the |
Index: trunk/phase3/includes/Math.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | |
35 | 35 | function render() { |
36 | 36 | global $wgTmpDirectory, $wgInputEncoding; |
37 | | - global $wgTexvc, $wgMathCheckFiles; |
| 37 | + global $wgTexvc, $wgMathCheckFiles, $wgTexvcBackgroundColor; |
38 | 38 | $fname = 'MathRenderer::render'; |
39 | 39 | |
40 | 40 | if( $this->mode == MW_MATH_SOURCE ) { |
— | — | @@ -63,7 +63,8 @@ |
64 | 64 | escapeshellarg( $wgTmpDirectory ).' '. |
65 | 65 | escapeshellarg( $wgTmpDirectory ).' '. |
66 | 66 | escapeshellarg( $this->tex ).' '. |
67 | | - escapeshellarg( $wgInputEncoding ); |
| 67 | + escapeshellarg( $wgInputEncoding ).' '. |
| 68 | + escapeshellarg( $wgTexvcBackgroundColor ); |
68 | 69 | |
69 | 70 | if ( wfIsWindows() ) { |
70 | 71 | # Invoke it within cygwin sh, because texvc expects sh features in its default shell |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -290,6 +290,7 @@ |
291 | 291 | * (bug 20717) Added checkboxes to hide users with bot and/or sysop group |
292 | 292 | membership in SpecialActiveusers |
293 | 293 | * Allow \pagecolor and \definecolor in texvc |
| 294 | +* $wgTexvcBackgroundColor contains background color for texvc call |
294 | 295 | |
295 | 296 | === Bug fixes in 1.16 === |
296 | 297 | |