more
This commit is contained in:
parent
4e2bd4ce5d
commit
cc04a3e2c3
|
@ -435,7 +435,7 @@ let
|
||||||
| Cpdfembed.EmbedInfo {fontfile; fontname; encoding} ->
|
| Cpdfembed.EmbedInfo {fontfile; fontname; encoding} ->
|
||||||
let embedded = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints:[] ~encoding in
|
let embedded = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints:[] ~encoding in
|
||||||
Some (hd (fst embedded))
|
Some (hd (fst embedded))
|
||||||
| Cpdfembed.ExistingNamedFont _ -> None
|
| Cpdfembed.ExistingNamedFont -> None
|
||||||
in
|
in
|
||||||
let fontpdfobj =
|
let fontpdfobj =
|
||||||
match font with
|
match font with
|
||||||
|
|
|
@ -3076,7 +3076,7 @@ let embed_font () =
|
||||||
PreMadeFontPack (fontpack_of_standardfont (Pdftext.StandardFont (f, args.fontencoding)))
|
PreMadeFontPack (fontpack_of_standardfont (Pdftext.StandardFont (f, args.fontencoding)))
|
||||||
end
|
end
|
||||||
| OtherFont f ->
|
| OtherFont f ->
|
||||||
ExistingNamedFont f
|
ExistingNamedFont
|
||||||
| FontToEmbed fontfile ->
|
| FontToEmbed fontfile ->
|
||||||
EmbedInfo {fontfile; fontname = args.fontname; encoding = args.fontencoding}
|
EmbedInfo {fontfile; fontname = args.fontname; encoding = args.fontencoding}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ type t = Pdftext.font list * (int, int * int) Hashtbl.t (* Table returns font nu
|
||||||
type cpdffont =
|
type cpdffont =
|
||||||
PreMadeFontPack of t
|
PreMadeFontPack of t
|
||||||
| EmbedInfo of {fontfile : Pdfio.bytes; fontname : string; encoding : Pdftext.encoding}
|
| EmbedInfo of {fontfile : Pdfio.bytes; fontname : string; encoding : Pdftext.encoding}
|
||||||
| ExistingNamedFont of string
|
| ExistingNamedFont
|
||||||
|
|
||||||
let get_char (fonts, table) u =
|
let get_char (fonts, table) u =
|
||||||
match Hashtbl.find table u with
|
match Hashtbl.find table u with
|
||||||
|
|
|
@ -13,7 +13,7 @@ type t = Pdftext.font list * (int, int * int) Hashtbl.t
|
||||||
type cpdffont =
|
type cpdffont =
|
||||||
PreMadeFontPack of t
|
PreMadeFontPack of t
|
||||||
| EmbedInfo of {fontfile : Pdfio.bytes; fontname : string; encoding : Pdftext.encoding}
|
| EmbedInfo of {fontfile : Pdfio.bytes; fontname : string; encoding : Pdftext.encoding}
|
||||||
| ExistingNamedFont of string
|
| ExistingNamedFont
|
||||||
|
|
||||||
val get_char : t -> int -> (int * int * Pdftext.font) option
|
val get_char : t -> int -> (int * int * Pdftext.font) option
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ let typeset ~papersize ~font ~fontsize text =
|
||||||
| Cpdfembed.EmbedInfo {fontfile; fontname; encoding} ->
|
| Cpdfembed.EmbedInfo {fontfile; fontname; encoding} ->
|
||||||
let embedded = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding in
|
let embedded = Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding in
|
||||||
(hd (fst embedded), embedded)
|
(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
|
in
|
||||||
let instrs = of_utf8_with_newlines fontpack (Pdfio.string_of_bytes text) in
|
let instrs = of_utf8_with_newlines fontpack (Pdfio.string_of_bytes text) in
|
||||||
let margin =
|
let margin =
|
||||||
|
|
|
@ -48,7 +48,7 @@ let typeset_table_of_contents ~font ~fontsize ~title ~bookmark pdf =
|
||||||
| Cpdfembed.PreMadeFontPack t -> hd (fst t)
|
| Cpdfembed.PreMadeFontPack t -> hd (fst t)
|
||||||
| Cpdfembed.EmbedInfo {fontfile; fontname; encoding} ->
|
| Cpdfembed.EmbedInfo {fontfile; fontname; encoding} ->
|
||||||
hd (fst (Cpdfembed.embed_truetype pdf ~fontfile ~fontname ~codepoints ~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
|
in
|
||||||
let marks = Pdfmarks.read_bookmarks pdf in
|
let marks = Pdfmarks.read_bookmarks pdf in
|
||||||
if marks = [] then (Printf.eprintf "No bookmarks, not making table of contents\n%!"; pdf) else
|
if marks = [] then (Printf.eprintf "No bookmarks, not making table of contents\n%!"; pdf) else
|
||||||
|
|
Loading…
Reference in New Issue