This commit is contained in:
John Whitington 2022-10-19 16:45:52 +01:00
parent 4e2bd4ce5d
commit cc04a3e2c3
6 changed files with 6 additions and 6 deletions

View File

@ -435,7 +435,7 @@ let
| Cpdfembed.EmbedInfo {fontfile; fontname; encoding} ->
let embedded = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints:[] ~encoding in
Some (hd (fst embedded))
| Cpdfembed.ExistingNamedFont _ -> None
| Cpdfembed.ExistingNamedFont -> None
in
let fontpdfobj =
match font with

View File

@ -3076,7 +3076,7 @@ let embed_font () =
PreMadeFontPack (fontpack_of_standardfont (Pdftext.StandardFont (f, args.fontencoding)))
end
| OtherFont f ->
ExistingNamedFont f
ExistingNamedFont
| FontToEmbed fontfile ->
EmbedInfo {fontfile; fontname = args.fontname; encoding = args.fontencoding}

View File

@ -6,7 +6,7 @@ type t = Pdftext.font list * (int, int * int) Hashtbl.t (* Table returns font nu
type cpdffont =
PreMadeFontPack of t
| EmbedInfo of {fontfile : Pdfio.bytes; fontname : string; encoding : Pdftext.encoding}
| ExistingNamedFont of string
| ExistingNamedFont
let get_char (fonts, table) u =
match Hashtbl.find table u with

View File

@ -13,7 +13,7 @@ type t = Pdftext.font list * (int, int * int) Hashtbl.t
type cpdffont =
PreMadeFontPack of t
| EmbedInfo of {fontfile : Pdfio.bytes; fontname : string; encoding : Pdftext.encoding}
| ExistingNamedFont of string
| ExistingNamedFont
val get_char : t -> int -> (int * int * Pdftext.font) option

View File

@ -42,7 +42,7 @@ let typeset ~papersize ~font ~fontsize text =
| Cpdfembed.EmbedInfo {fontfile; fontname; encoding} ->
let embedded = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding in
(hd (fst embedded), embedded)
| Cpdfembed.ExistingNamedFont _ -> raise (Pdf.PDFError "Can't use existing named font for text-to-PDF")
| Cpdfembed.ExistingNamedFont -> raise (Pdf.PDFError "Can't use existing named font for text-to-PDF")
in
let instrs = of_utf8_with_newlines fontpack (Pdfio.string_of_bytes text) in
let margin =

View File

@ -48,7 +48,7 @@ let typeset_table_of_contents ~font ~fontsize ~title ~bookmark pdf =
| Cpdfembed.PreMadeFontPack t -> hd (fst t)
| Cpdfembed.EmbedInfo {fontfile; fontname; encoding} ->
hd (fst (Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding))
| Cpdfembed.ExistingNamedFont _ -> raise (Pdf.PDFError "Cannot use existing font with -table-of-contents")
| Cpdfembed.ExistingNamedFont -> raise (Pdf.PDFError "Cannot use existing font with -table-of-contents")
in
let marks = Pdfmarks.read_bookmarks pdf in
if marks = [] then (Printf.eprintf "No bookmarks, not making table of contents\n%!"; pdf) else