debugging draw/font
This commit is contained in:
parent
9753e9fb9b
commit
93219ce4a0
|
@ -2096,6 +2096,7 @@ let setfont f =
|
|||
begin match args.op with Some Draw -> addop (Cpdfdraw.FontPack (f, embed_font (), null_hash ())) | _ -> () end
|
||||
|
||||
let loadttf n =
|
||||
Printf.printf "loadttf: %s\n" n;
|
||||
let name, filename =
|
||||
match String.split_on_char '=' n with
|
||||
| [name; filename] -> name, filename
|
||||
|
@ -2129,6 +2130,10 @@ let setstderrtostdout () =
|
|||
let settextwidth s =
|
||||
args.op <- Some (TextWidth s)
|
||||
|
||||
let setdraw () =
|
||||
args.op <- Some Draw;
|
||||
addop (Cpdfdraw.FontPack (args.fontname, embed_font (), null_hash ()))
|
||||
|
||||
(* Parse a control file, make an argv, and then make Arg parse it. *)
|
||||
let rec make_control_argv_and_parse filename =
|
||||
control_args := !control_args @ parse_control_file filename
|
||||
|
@ -2930,7 +2935,7 @@ and specs =
|
|||
("-text-width",
|
||||
Arg.String settextwidth,
|
||||
" Find width of a line of text");
|
||||
("-draw", Arg.Unit (setop Draw), " Begin drawing");
|
||||
("-draw", Arg.Unit setdraw, " Begin drawing");
|
||||
("-rect", Arg.String addrect, " Draw rectangle");
|
||||
("-to", Arg.String addto, " Move to");
|
||||
("-line", Arg.String addline, " Add line to");
|
||||
|
@ -4463,8 +4468,7 @@ let go () =
|
|||
| Some Draw ->
|
||||
let pdf = get_single_pdf args.op false in
|
||||
let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in
|
||||
(* Whatever the font is going in to -draw, add its fontpack. *)
|
||||
addop (Cpdfdraw.FontPack (args.fontname, embed_font (), null_hash ()));
|
||||
|
||||
let ops = match !drawops with [("_MAIN", ops)] -> rev ops | _ -> error "not enough -end-xobj or -et" in
|
||||
write_pdf
|
||||
false
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
open Pdfutil
|
||||
open Cpdferror
|
||||
|
||||
(* FIXME Use hashtbl.replace everywhere? *)
|
||||
|
||||
type colspec =
|
||||
NoCol
|
||||
| RGB of float * float * float
|
||||
|
@ -195,10 +197,7 @@ let update_resources pdf old_resources =
|
|||
|
||||
let rec ops_of_drawop dryrun pdf endpage filename bates batespad num page = function
|
||||
| Qq ops ->
|
||||
respush (); (* FIXME Is this right or not vis-a-vis fonts? *)
|
||||
let r = [Pdfops.Op_q] @ ops_of_drawops dryrun pdf endpage filename bates batespad num page ops @ [Pdfops.Op_Q] in
|
||||
respop ();
|
||||
r
|
||||
[Pdfops.Op_q] @ ops_of_drawops dryrun pdf endpage filename bates batespad num page ops @ [Pdfops.Op_Q]
|
||||
| Matrix m -> [Pdfops.Op_cm m]
|
||||
| Rect (x, y, w, h) -> [Pdfops.Op_re (x, y, w, h)]
|
||||
| Bezier (a, b, c, d, e, f) -> [Pdfops.Op_c (a, b, c, d, e, f)]
|
||||
|
|
Loading…
Reference in New Issue