diff --git a/cpdfaddtext.ml b/cpdfaddtext.ml index a2e0e56..7086b07 100644 --- a/cpdfaddtext.ml +++ b/cpdfaddtext.ml @@ -535,7 +535,7 @@ let map (fun c -> unicode_codepoint_of_pdfcode encoding_table glyphlist_table (int_of_char c)) charcodes in let objnum = match fontpdfobj with Pdf.Indirect i -> i | _ -> failwith "bad fontpdfobj" in - let font = snd (hd (Cpdfembed.embed_truetype !pdf ~fontfile ~fontname ~codepoints ~encoding)) in + let font = hd (fst (Cpdfembed.embed_truetype !pdf ~fontfile ~fontname ~codepoints ~encoding)) in ignore (Pdftext.write_font ~objnum !pdf font) end; !pdf diff --git a/cpdfcommand.ml b/cpdfcommand.ml index bc1bd93..7436f08 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -3059,7 +3059,7 @@ let embed_font pdf = Pdfio.bytes_of_string (contents_of_file (Filename.concat dirname filename)), Filename.remove_extension filename in - let font = snd (hd (Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints:[] ~encoding:args.fontencoding)) in + let font = hd (fst (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)) @@ -3069,7 +3069,7 @@ let embed_font pdf = end | OtherFont f -> None, None (* it's in fontname *) | FontToEmbed fontfile -> - Some (snd (hd (Cpdfembed.embed_truetype pdf ~fontfile ~fontname:args.fontname ~codepoints:[] ~encoding:args.fontencoding))), + Some (hd (fst (Cpdfembed.embed_truetype pdf ~fontfile ~fontname:args.fontname ~codepoints:[] ~encoding:args.fontencoding))), Some (pdf, fontfile, args.fontname, args.fontencoding) (* Main function *) diff --git a/cpdftexttopdf.ml b/cpdftexttopdf.ml index 8d9dca5..9bde028 100644 --- a/cpdftexttopdf.ml +++ b/cpdftexttopdf.ml @@ -44,7 +44,7 @@ let typeset ?embedinfo ~papersize ~font ~fontsize text = match embedinfo with | None -> font | Some (pdf, fontfile, fontname, encoding) -> - snd (hd (Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding)) + hd (fst (Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding)) in let pages = Cpdftype.typeset diff --git a/cpdftoc.ml b/cpdftoc.ml index 8471830..76bac91 100644 --- a/cpdftoc.ml +++ b/cpdftoc.ml @@ -115,7 +115,7 @@ let typeset_table_of_contents ?embedinfo ~font ~fontsize ~title ~bookmark pdf = match embedinfo with | None -> font | Some (pdf, fontfile, fontname, encoding) -> - snd (hd (Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding)) + hd (fst (Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding)) in Cpdftype.typeset lm rm tm bm firstpage_papersize pdf ([Cpdftype.Font (font, bfs); Cpdftype.BeginDocument] @ title @