This commit is contained in:
John Whitington 2022-09-27 17:48:52 +01:00
parent 997176252d
commit 20b5d39a1c
1 changed files with 15 additions and 1 deletions

View File

@ -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),