From 45c0b52907afac59045cc429c4b8c3d9b743d3ac Mon Sep 17 00:00:00 2001 From: John Whitington Date: Fri, 7 Jul 2023 14:42:57 +0100 Subject: [PATCH] Restore plain fonts in -draw with new interface --- cpdfdraw.ml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cpdfdraw.ml b/cpdfdraw.ml index 6f34fa5..1cdd031 100644 --- a/cpdfdraw.ml +++ b/cpdfdraw.ml @@ -229,9 +229,12 @@ let rec ops_of_drawop pdf endpage filename bates batespad num page = function | NewPage -> Pdfe.log ("NewPage remaining in graphic stream"); assert false | Opacity v -> [Pdfops.Op_gs (extgstate "/ca" v)] | SOpacity v -> [Pdfops.Op_gs (extgstate "/CA" v)] - | Font (s, f) -> - [] - (*let font = Pdftext.StandardFont (s, Pdftext.WinAnsiEncoding) in + | Font (fontpack, size) -> + let font = + match fontpack with + | PreMadeFontPack (f::_, _) -> f + | _ -> failwith "-font-ttf not impl" + in let (n, _) = try Hashtbl.find (res ()).fonts font with Not_found -> @@ -240,9 +243,9 @@ let rec ops_of_drawop pdf endpage filename bates batespad num page = function Hashtbl.add (res ()).fonts font (n, o); (n, o) in - (res ()).current_font <- font; + (res ()).current_fontpack <- fontpack; (res ()).page_names <- n::(res ()).page_names; - [Pdfops.Op_Tf (n, f)]*) + [Pdfops.Op_Tf (n, size)] | TextSection ops -> [Pdfops.Op_BT] @ ops_of_drawops pdf endpage filename bates batespad num page ops @ [Pdfops.Op_ET] | Text s -> [Pdfops.Op_Tj (charcodes_of_utf8 s)] | SpecialText s ->