This commit is contained in:
John Whitington 2022-10-13 17:14:20 +01:00
parent d6a564daae
commit e29add66b1
4 changed files with 5 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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