Restore plain fonts in -draw with new interface

This commit is contained in:
John Whitington 2023-07-07 14:42:57 +01:00
parent 7d1733b823
commit 45c0b52907
1 changed files with 8 additions and 5 deletions

View File

@ -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 | NewPage -> Pdfe.log ("NewPage remaining in graphic stream"); assert false
| Opacity v -> [Pdfops.Op_gs (extgstate "/ca" v)] | Opacity v -> [Pdfops.Op_gs (extgstate "/ca" v)]
| SOpacity v -> [Pdfops.Op_gs (extgstate "/CA" v)] | SOpacity v -> [Pdfops.Op_gs (extgstate "/CA" v)]
| Font (s, f) -> | Font (fontpack, size) ->
[] let font =
(*let font = Pdftext.StandardFont (s, Pdftext.WinAnsiEncoding) in match fontpack with
| PreMadeFontPack (f::_, _) -> f
| _ -> failwith "-font-ttf not impl"
in
let (n, _) = let (n, _) =
try Hashtbl.find (res ()).fonts font with try Hashtbl.find (res ()).fonts font with
Not_found -> 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); Hashtbl.add (res ()).fonts font (n, o);
(n, o) (n, o)
in in
(res ()).current_font <- font; (res ()).current_fontpack <- fontpack;
(res ()).page_names <- n::(res ()).page_names; (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] | 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)] | Text s -> [Pdfops.Op_Tj (charcodes_of_utf8 s)]
| SpecialText s -> | SpecialText s ->