cpdf-source/cpdftype.mli

26 lines
795 B
OCaml
Raw Normal View History

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