This commit is contained in:
John Whitington 2022-09-27 18:10:09 +01:00
parent 7531cf6a15
commit e165a3bf5f
1 changed files with 6 additions and 3 deletions

View File

@ -3053,14 +3053,17 @@ let embed_font pdf =
(* FIXME proper error handling *) (* FIXME proper error handling *)
begin match args.embedstd14 with begin match args.embedstd14 with
| Some dirname -> | Some dirname ->
let fontfile, fontname = begin try
let fontfile, fontname =
let filename = hd (List.assoc f fontnames) in 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)), Pdfio.bytes_of_string (contents_of_file (Filename.concat dirname filename)),
Filename.remove_extension filename Filename.remove_extension filename
in in
let font = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints:[] ~encoding:args.fontencoding in let font = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints:[] ~encoding:args.fontencoding in
Some font, Some (pdf, fontfile, fontname, args.fontencoding) 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 -> | None ->
Some (Pdftext.StandardFont (f, args.fontencoding)), None Some (Pdftext.StandardFont (f, args.fontencoding)), None
end end