diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 627ad0b..4ee042c 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -1778,6 +1778,16 @@ let addline s = let endpath () = drawops := Cpdfdraw.EndPath::!drawops +let setthickness s = () + +let setcap s = () + +let setjoin s = () + +let setmiter s = () + +let setdash s = () + (* 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 @@ -2563,6 +2573,11 @@ and specs = ("-stroke", Arg.String setstroke, " Set stroke colour"); ("-fill", Arg.String setfill, " Set fill colour"); ("-end", Arg.Unit endpath, " End path"); + ("-thick", Arg.String setthickness, " Set stroke thickness"); + ("-cap", Arg.String setcap, " Set cap"); + ("-join", Arg.String setjoin, " Set join"); + ("-miter", Arg.String setmiter, " Set miter limit"); + ("-dash", Arg.String setdash, " Set dash pattern"); (* These items are undocumented *) ("-remove-unused-resources", Arg.Unit (setop RemoveUnusedResources), ""); ("-stay-on-error", Arg.Unit setstayonerror, ""); diff --git a/cpdfdraw.ml b/cpdfdraw.ml index 4aa188b..39df601 100644 --- a/cpdfdraw.ml +++ b/cpdfdraw.ml @@ -12,6 +12,11 @@ type drawops = | Line of float * float | Fill of drawops_colspec | Stroke of drawops_colspec + | SetLineThickness of float + | SetLineCap of int + | SetLineJoin of int + | SetMiterLimit of float + | SetDashPattern of float list * float | EndPath type state = @@ -59,6 +64,21 @@ let ops_of_drawop = function | _, NoCol -> [Pdfops.Op_f] | _, _ -> [Pdfops.Op_B'] end + | SetLineThickness t -> + state.linewidth <- t; + [Pdfops.Op_w t] + | SetLineCap c -> + state.linecap <- c; + [Pdfops.Op_J c] + | SetLineJoin j -> + state.linejoin <- j; + [Pdfops.Op_j j] + | SetMiterLimit m -> + state.miterlimit <- m; + [Pdfops.Op_M m] + | SetDashPattern (x, y) -> + state.dashpattern <- (x, y); + [Pdfops.Op_d (x, y)] let ops_of_drawops drawops = flatten (map ops_of_drawop drawops) diff --git a/cpdfdraw.mli b/cpdfdraw.mli index 7cd6245..336ba20 100644 --- a/cpdfdraw.mli +++ b/cpdfdraw.mli @@ -10,6 +10,11 @@ type drawops = | Line of float * float | Fill of drawops_colspec | Stroke of drawops_colspec + | SetLineThickness of float + | SetLineCap of int + | SetLineJoin of int + | SetMiterLimit of float + | SetDashPattern of float list * float | EndPath type state =