This commit is contained in:
John Whitington 2022-09-27 16:59:04 +01:00
parent 4d666417e1
commit 89a82b553d
1 changed files with 17 additions and 7 deletions

View File

@ -19,6 +19,22 @@ let initial_file_size = ref 0
let empty = Pdf.empty () let empty = Pdf.empty ()
let emptypage = Pdfpage.blankpage Pdfpaper.a4 let emptypage = Pdfpage.blankpage Pdfpaper.a4
let fontnames =
[(Pdftext.TimesRoman, ["NimbusRoman-Regular.ttf"]);
(Pdftext.TimesBold, ["NimbusRoman-Bold.ttf"]);
(Pdftext.TimesItalic, ["NimbusRoman-Italic.ttf"]);
(Pdftext.TimesBoldItalic, ["NimbusRoman-BoldItalic.ttf"]);
(Pdftext.Helvetica, ["NimbusSans-Regular.ttf"]);
(Pdftext.HelveticaBold, ["NimbusSans-Bold.ttf"]);
(Pdftext.HelveticaOblique, ["NimbusSans-Italic.ttf"]);
(Pdftext.HelveticaBoldOblique, ["NimbusSans-BoldItalic.ttf"]);
(Pdftext.Courier, ["NimbusMonoPS-Regular.ttf"]);
(Pdftext.CourierBold, ["NimbusMonoPS-Bold.ttf"]);
(Pdftext.CourierOblique, ["NimbusMonoPS-Italic.ttf"]);
(Pdftext.CourierBoldOblique, ["NimbusMonoPS-BoldItalic.ttf"]);
(Pdftext.Symbol, ["StandardSymbolsPS.ttf"]);
(Pdftext.ZapfDingbats, ["D050000L.ttf"])]
(* Wrap up the file reading functions to exit with code 1 when an encryption (* Wrap up the file reading functions to exit with code 1 when an encryption
problem occurs. This happens when object streams are in an encrypted document problem occurs. This happens when object streams are in an encrypted document
and so it can't be read without the right password... The existing error and so it can't be read without the right password... The existing error
@ -384,7 +400,7 @@ type args =
mutable fontname : string; mutable fontname : string;
mutable fontencoding : Pdftext.encoding; mutable fontencoding : Pdftext.encoding;
mutable fontsize : float; mutable fontsize : float;
mutable fontttfmore : bool; mutable embedstd14 : string option;
mutable color : Cpdfaddtext.color; mutable color : Cpdfaddtext.color;
mutable opacity : float; mutable opacity : float;
mutable position : Cpdfposition.position; mutable position : Cpdfposition.position;
@ -449,7 +465,6 @@ type args =
mutable was_decrypted_with_owner : bool; mutable was_decrypted_with_owner : bool;
mutable creator : string option; mutable creator : string option;
mutable producer : string option; mutable producer : string option;
mutable embedstd14 : string option;
mutable extract_text_font_size : float option; mutable extract_text_font_size : float option;
mutable padwith : string option; mutable padwith : string option;
mutable alsosetxml : bool; mutable alsosetxml : bool;
@ -506,7 +521,6 @@ let args =
fontname = "Times-Roman"; fontname = "Times-Roman";
fontsize = 12.; fontsize = 12.;
fontencoding = Pdftext.WinAnsiEncoding; fontencoding = Pdftext.WinAnsiEncoding;
fontttfmore = false;
color = Cpdfaddtext.RGB (0., 0., 0.); color = Cpdfaddtext.RGB (0., 0., 0.);
opacity = 1.; opacity = 1.;
position = Cpdfposition.TopLeft 100.; position = Cpdfposition.TopLeft 100.;
@ -628,7 +642,6 @@ let reset_arguments () =
args.fontname <- "Times-Roman"; args.fontname <- "Times-Roman";
args.fontsize <- 12.; args.fontsize <- 12.;
args.fontencoding <- Pdftext.WinAnsiEncoding; args.fontencoding <- Pdftext.WinAnsiEncoding;
args.fontttfmore <- false;
args.color <- Cpdfaddtext.RGB (0., 0., 0.); args.color <- Cpdfaddtext.RGB (0., 0., 0.);
args.opacity <- 1.; args.opacity <- 1.;
args.position <- Cpdfposition.TopLeft 100.; args.position <- Cpdfposition.TopLeft 100.;
@ -1719,9 +1732,6 @@ let setfontttf s =
args.font <- FontToEmbed (Pdfio.bytes_of_string (contents_of_file s)); args.font <- FontToEmbed (Pdfio.bytes_of_string (contents_of_file s));
args.fontname <- Filename.remove_extension (Filename.basename s) args.fontname <- Filename.remove_extension (Filename.basename s)
let setfontttfmore () =
args.fontttfmore <- true
let setfontttfencoding s = let setfontttfencoding s =
args.fontencoding <- args.fontencoding <-
match s with match s with