From 7e27138211ab37fa52061f1c6a5d0506923438b9 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 13 Jun 2023 21:02:50 +0100 Subject: [PATCH] Debug font --- cpdftruetype.ml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpdftruetype.ml b/cpdftruetype.ml index d26f7b2..732936c 100644 --- a/cpdftruetype.ml +++ b/cpdftruetype.ml @@ -451,6 +451,11 @@ let subset_font major minor tables indexToLocFormat subset encoding cmap loca mk let _ = Pdfe.logger := (fun s -> print_string s; flush stdout) +let write_font filename data = + let fh = open_out_bin filename in + output_string fh (Pdfio.string_of_bytes data); + close_out fh + let parse ?(subset=[]) data encoding = if !dbg then begin @@ -624,6 +629,8 @@ let parse ?(subset=[]) data encoding = in Printf.printf "\nMain subset:\n"; debug_t one; + write_font "one.ttf" one.subset_fontfile; Printf.printf "\nHigher subset:\n"; debug_t two; + write_font "two.ttf" two.subset_fontfile; [one; two]