From df85eb17403c62dbee480896d48aaec122d1ae9b Mon Sep 17 00:00:00 2001 From: John Whitington Date: Wed, 27 Sep 2023 17:02:22 +0100 Subject: [PATCH] Add setting of font to cpdfdrawcontrol --- cpdfcommand.ml | 2 ++ cpdfdrawcontrol.ml | 2 ++ cpdfdrawcontrol.mli | 2 ++ 3 files changed, 6 insertions(+) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index f4aa2e0..6a2b06c 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -1827,6 +1827,8 @@ let setdraw () = let () = Cpdfdrawcontrol.getfontname := fun () -> args.fontname let () = Cpdfdrawcontrol.getfontsize := fun () -> args.fontsize +let () = Cpdfdrawcontrol.setfontname := setfont +let () = Cpdfdrawcontrol.setfontsize := fun s -> args.fontsize <- s (* Parse a control file, make an argv, and then make Arg parse it. *) let rec make_control_argv_and_parse filename = diff --git a/cpdfdrawcontrol.ml b/cpdfdrawcontrol.ml index 87e4432..319b14e 100644 --- a/cpdfdrawcontrol.ml +++ b/cpdfdrawcontrol.ml @@ -5,6 +5,8 @@ open Cpdferror let embed_font = ref (fun () -> Cpdfembed.ExistingNamedFont) let getfontname = ref (fun () -> "") let getfontsize = ref (fun () -> 0.) +let setfontname = ref (fun _ -> ()) +let setfontsize = ref (fun _ -> ()) let ttfs = null_hash () diff --git a/cpdfdrawcontrol.mli b/cpdfdrawcontrol.mli index d2da532..f7ddb0f 100644 --- a/cpdfdrawcontrol.mli +++ b/cpdfdrawcontrol.mli @@ -1,6 +1,8 @@ val embed_font : (unit -> Cpdfembed.cpdffont) ref val getfontname : (unit -> string) ref val getfontsize : (unit -> float) ref +val setfontname : (string -> unit) ref +val setfontsize : (float -> unit) ref val ttfs : (string, (string * Cpdfembed.cpdffont)) Hashtbl.t val fontpack_initialised : bool ref val drawops : (string * Cpdfdraw.drawops list) list ref