2022-01-13 16:35:03 +00:00
|
|
|
(** Experimental typesetter for cpdf *)
|
2021-11-18 14:48:25 -08:00
|
|
|
type element =
|
2021-12-01 16:11:33 -08:00
|
|
|
Text of char list
|
2023-07-10 14:36:34 +01:00
|
|
|
| HGlue of float
|
|
|
|
| VGlue of float
|
2021-11-18 11:09:09 -08:00
|
|
|
| NewLine
|
|
|
|
| NewPage
|
2023-07-20 12:56:20 +01:00
|
|
|
| Font of string * Pdftext.font * float
|
2021-11-19 16:28:13 -08:00
|
|
|
| BeginDest of Pdfdest.t
|
|
|
|
| EndDest
|
2021-12-14 14:07:52 +00:00
|
|
|
| BeginDocument
|
2024-10-02 16:39:16 +01:00
|
|
|
| Tag of string * int
|
2024-10-02 13:27:57 +01:00
|
|
|
| EndTag
|
2021-11-18 11:09:09 -08:00
|
|
|
|
2021-11-18 14:48:25 -08:00
|
|
|
type t = element list
|
2021-11-15 17:42:17 -08:00
|
|
|
|
2023-07-27 13:21:15 +01:00
|
|
|
(** Debug printing *)
|
2021-11-21 14:15:06 -08:00
|
|
|
val to_string : t -> string
|
|
|
|
|
2023-07-27 13:21:15 +01:00
|
|
|
(** Return the font width table for a given (id, font, fontsize) combination. *)
|
2023-07-20 12:56:20 +01:00
|
|
|
val font_widths : string -> Pdftext.font -> float -> float array
|
2021-12-14 12:57:27 +00:00
|
|
|
|
2023-07-27 13:21:15 +01:00
|
|
|
(** Calculate the widths of a string given a font width table, and list of char codes *)
|
2021-12-14 12:57:27 +00:00
|
|
|
val width_of_string : float array -> char list -> float
|
|
|
|
|
2024-10-23 15:26:14 +01:00
|
|
|
(** [typeset process_struct_tree lmargin rmargin tmargin bmargin papersize pdf contents] builds a
|
|
|
|
list of pages of typset content. *)
|
2024-10-03 12:32:26 +01:00
|
|
|
val typeset : process_struct_tree:bool -> float -> float -> float -> float -> Pdfpaper.t -> Pdf.t -> t -> Pdfpage.t list * (string * int) list list
|
2024-10-02 13:27:57 +01:00
|
|
|
|
2024-10-23 15:26:14 +01:00
|
|
|
(** Add artifact markers to any un-marked part of the content stream. *)
|
2024-10-02 13:27:57 +01:00
|
|
|
val add_artifacts : Pdfops.t list -> Pdfops.t list
|