2023-07-27 13:33:44 +01:00
|
|
|
(** Embed a TrueType font in a PDF *)
|
|
|
|
|
2022-09-20 14:54:45 +01:00
|
|
|
(* Embed a TrueType font for the given set of unicode codepoints in the given
|
2022-10-13 17:00:33 +01:00
|
|
|
encoding, adding the fontfiles to the PDF and returning a list of font objects,
|
|
|
|
together with a unicode codepoint --> (font number in list, charcode) table *)
|
|
|
|
|
|
|
|
type t = Pdftext.font list * (int, int * int) Hashtbl.t
|
2022-10-10 16:08:07 +01:00
|
|
|
|
2022-10-18 19:13:02 +01:00
|
|
|
type cpdffont =
|
|
|
|
PreMadeFontPack of t
|
2022-10-19 13:48:13 +01:00
|
|
|
| EmbedInfo of {fontfile : Pdfio.bytes; fontname : string; encoding : Pdftext.encoding}
|
2022-10-19 16:45:52 +01:00
|
|
|
| ExistingNamedFont
|
2022-10-18 19:13:02 +01:00
|
|
|
|
2023-07-27 13:33:44 +01:00
|
|
|
(** Build a fontpack for a Standard 14 font *)
|
2023-02-20 12:56:59 +00:00
|
|
|
val fontpack_of_standardfont : Pdftext.font -> t
|
|
|
|
|
2023-07-27 13:33:44 +01:00
|
|
|
(** Look up a unicode codepoint in a font page. Returns (charcode, fontnumber, font) *)
|
2022-10-19 14:47:20 +01:00
|
|
|
val get_char : t -> int -> (int * int * Pdftext.font) option
|
|
|
|
|
2023-07-27 13:33:44 +01:00
|
|
|
(** Build a fontpack from a TrueType font and list of codepoints, embedding its fonts in the document *)
|
2022-09-12 17:02:48 +01:00
|
|
|
val embed_truetype :
|
2022-09-20 14:54:45 +01:00
|
|
|
Pdf.t -> fontfile:Pdfio.bytes -> fontname:string -> codepoints:int list ->
|
2022-10-13 17:00:33 +01:00
|
|
|
encoding:Pdftext.encoding -> t
|
2023-07-13 14:44:57 +01:00
|
|
|
|
2023-07-27 13:33:44 +01:00
|
|
|
(** Collate outputs of [get_char] with like font *)
|
2023-07-13 14:44:57 +01:00
|
|
|
val collate_runs : ('a * 'b * 'c) list -> ('a * 'b * 'c) list list
|
2024-04-01 19:03:31 +01:00
|
|
|
|
|
|
|
(** Load substitute Standard 14 font *)
|
|
|
|
val load_substitute : string -> Pdftext.standard_font -> Pdfio.bytes * string
|