From a81fc4ef8dbe079a2af27d84ae9bc9d2276aaf6f Mon Sep 17 00:00:00 2001 From: John Whitington Date: Mon, 13 Apr 2015 14:17:48 +0100 Subject: [PATCH] Began -no-embed-fonts work --- cpdf.ml | 4 ++++ cpdfcommand.ml | 17 +++++++++++++---- xmlm.ml | 0 xmlm.mli | 0 4 files changed, 17 insertions(+), 4 deletions(-) mode change 100755 => 100644 cpdf.ml mode change 100755 => 100644 xmlm.ml mode change 100755 => 100644 xmlm.mli diff --git a/cpdf.ml b/cpdf.ml old mode 100755 new mode 100644 index 7de99d8..8fa3d30 --- a/cpdf.ml +++ b/cpdf.ml @@ -1532,6 +1532,10 @@ let extract_widths_firstlast width_data = let make_font fontname = let font = unopt (Pdftext.standard_font_of_name ("/" ^ fontname)) in let header, width_data, _ = Pdfstandard14.afm_data font in + (* Print out the width data *) + Hashtbl.iter + (Printf.printf "%i -> %i\n") + width_data; let firstchar, lastchar, widths = extract_widths_firstlast width_data in let flags = Pdfstandard14.flags_of_standard_font font in let fontbbox = extract_fontbbox header "FontBBox" in diff --git a/cpdfcommand.ml b/cpdfcommand.ml index e7374d0..63a7be0 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -369,7 +369,8 @@ type args = mutable recrypt : bool; mutable was_decrypted_with_owner : bool; mutable creator : string option; - mutable producer : string option} + mutable producer : string option; + mutable embedfonts : bool} let args = {op = None; @@ -450,7 +451,8 @@ let args = recrypt = false; was_decrypted_with_owner = false; producer = None; - creator = None} + creator = None; + embedfonts = true} let reset_arguments () = args.op <- None; @@ -526,9 +528,10 @@ let reset_arguments () = args.labelstartval <- 1; args.squeeze <- false; args.producer <- None; - args.creator <- None + args.creator <- None; + args.embedfonts <- true (* Do not reset original_filename or cpdflin or was_encrypted or - * was_decrypted_with_owner or recrypt, since we want it to work across ANDs. *) + * was_decrypted_with_owner or recrypt, since we want these to work across ANDs. *) let string_of_permission = function | Pdfcrypt.NoEdit -> "No edit" @@ -1356,6 +1359,9 @@ let setsqueezelogto s = let setstayonerror () = set stay_on_error +let setnoembedfont () = + args.embedfonts <- false + (* 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 @@ -1587,6 +1593,9 @@ and specs = ("-font-size", Arg.Float setfontsize, " Set the font size"); + ("-no-embed-font", + Arg.Unit setnoembedfont, + "Do not embed fonts"); ("-color", Arg.String setcolor, " Set the color"); diff --git a/xmlm.ml b/xmlm.ml old mode 100755 new mode 100644 diff --git a/xmlm.mli b/xmlm.mli old mode 100755 new mode 100644