From f5c47c926c223bcddb11f005d6744878391926bc Mon Sep 17 00:00:00 2001 From: John Whitington Date: Wed, 12 Jul 2023 15:51:29 +0100 Subject: [PATCH] Beginning on fontpacks for -add-text --- cpdfaddtext.ml | 4 ++-- cpdftruetype.ml | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cpdfaddtext.ml b/cpdfaddtext.ml index 4f934f3..d917faa 100644 --- a/cpdfaddtext.ml +++ b/cpdfaddtext.ml @@ -523,14 +523,14 @@ let !pdf; voffset := !voffset +. (linespacing *. fontsize)) lines; - (*begin match cpdffont with + begin match cpdffont with | Cpdfembed.EmbedInfo {fontfile; fontname; encoding} -> let codepoints = map fst (list_of_hashtbl used) in let objnum = match fontpdfobj with Pdf.Indirect i -> i | _ -> failwith "bad fontpdfobj" in let font = hd (fst (Cpdfembed.embed_truetype !pdf ~fontfile ~fontname ~codepoints ~encoding)) in ignore (Pdftext.write_font ~objnum !pdf font) | _ -> () - end;*) + end; !pdf diff --git a/cpdftruetype.ml b/cpdftruetype.ml index e942e9f..c7e9f20 100644 --- a/cpdftruetype.ml +++ b/cpdftruetype.ml @@ -2,6 +2,8 @@ open Pdfutil open Pdfio +(* FIXME revisit widths for mono font - the new code returning the notdef width is making the notdef width turn up in /Widths, where missing entries should be 0! *) + let dbg = (* Pdfe.logger := (fun s -> print_string s; flush stdout) *) ref false @@ -288,7 +290,7 @@ let write_glyf_table subset cmap bs mk_b glyfoffset loca = Not_found -> ()) subset; let locnums = (*expand_composites mk_b loca glyfoffset*) (sort compare (map fst (list_of_hashtbl locnums))) in - (*if !dbg then*) + if !dbg then (Printf.printf "We want glyfs for locations: "; iter (Printf.printf "%i ") locnums; Printf.printf "\n"); let byteranges = map (fun x -> (loca.(x), loca.(x + 1))) locnums in