From e165a3bf5f0fd227bfd1d7b5439df4a5ecaece0d Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 27 Sep 2022 18:10:09 +0100 Subject: [PATCH] more --- cpdfcommand.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 30987f9..09202f9 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -3053,14 +3053,17 @@ let embed_font pdf = (* FIXME proper error handling *) begin match args.embedstd14 with | Some dirname -> - let fontfile, fontname = + begin try + 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 + in let font = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints:[] ~encoding:args.fontencoding in Some font, Some (pdf, fontfile, fontname, args.fontencoding) + with + e -> error (Printf.sprintf "Can't load font for embedding: %s\n" (Printexc.to_string e)) + end | None -> Some (Pdftext.StandardFont (f, args.fontencoding)), None end