From 1c8ee8623a0add0d54485b4713142706c8a79bfe Mon Sep 17 00:00:00 2001 From: John Whitington Date: Thu, 22 Jun 2023 14:43:52 +0100 Subject: [PATCH] Begin higher fonts at charcode 33 --- cpdftexttopdf.ml | 2 +- cpdftruetype.ml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cpdftexttopdf.ml b/cpdftexttopdf.ml index bd59c6f..64c9d33 100644 --- a/cpdftexttopdf.ml +++ b/cpdftexttopdf.ml @@ -10,7 +10,7 @@ let rec of_utf8_with_newlines fontpack fontsize t = (fun u -> match Cpdfembed.get_char fontpack u with | Some (c, n, f) -> - (*Printf.printf "Charcode %i, font number %i\n" c n;*) + Printf.printf "Charcode %i, font number %i\n" c n; begin if n <> !currfont then begin if !currtext <> [] then items := Cpdftype.Text (rev !currtext)::!items; diff --git a/cpdftruetype.ml b/cpdftruetype.ml index e3259ad..e89c575 100644 --- a/cpdftruetype.ml +++ b/cpdftruetype.ml @@ -2,6 +2,8 @@ open Pdfutil open Pdfio +(* FIXME No need for bitstream - everything is byte based, so we can use a normal input *) + let dbg = ref false type t = @@ -595,7 +597,7 @@ let parse ?(subset=[]) data encoding = let flags_1 = calculate_flags false italicangle in let flags_2 = calculate_flags true italicangle in let firstchar_1, lastchar_1 = calculate_limits subset_1 in - let firstchar_2, lastchar_2 = (0, length subset_2 - 1) in + let firstchar_2, lastchar_2 = (33, length subset_2 + 33 - 1) in let numOfLongHorMetrics = match keep (function (t, _, _, _) -> string_of_tag t = "hhea") !tables with | (_, _, o, l)::_ -> let b = mk_b (i32toi o) in read_hhea_table b @@ -635,7 +637,7 @@ let parse ?(subset=[]) data encoding = (fun n u -> let s = implode (tl (tl (explode (Pdftext.utf16be_of_codepoints [u])))) in Hashtbl.add h n s) - (indx0 subset_2) + (map (( + ) 33) (indx0 subset_2)) subset_2; Some h in