From 20b5d39a1c65046581154800c94b84ac8cc0754c Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 27 Sep 2022 17:48:52 +0100 Subject: [PATCH] more --- cpdfcommand.ml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index d4c07ac..867ae0b 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -3049,7 +3049,21 @@ let prerotate range pdf = let embed_font pdf = match args.font with - | StandardFont f -> Some (Pdftext.StandardFont (f, args.fontencoding)), None + | StandardFont f -> + (* FIXME proper error handling *) + begin match args.embedstd14 with + | Some dirname -> + let fontfile, fontname = + let filename = hd (List.assoc f fontnames) in + Printf.printf "%s %s\n" (Filename.concat dirname filename) (Filename.remove_extension filename); + Pdfio.bytes_of_string (contents_of_file (Filename.concat dirname filename)), + Filename.remove_extension filename + in + let font = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints:[] ~encoding:args.fontencoding in + Some font, Some (pdf, fontfile, args.fontname, args.fontencoding) + | None -> + Some (Pdftext.StandardFont (f, args.fontencoding)), None + end | OtherFont f -> None, None (* it's in fontname *) | FontToEmbed fontfile -> Some (Cpdfembed.embed_truetype pdf ~fontfile ~fontname:args.fontname ~codepoints:[] ~encoding:args.fontencoding),