This commit is contained in:
John Whitington 2022-09-09 18:59:46 +01:00
parent df0a33a805
commit 319cee30af
3 changed files with 29 additions and 1 deletions

View File

@ -1,8 +1,12 @@
2.6 (next version, to come) 2.6 (next version, to come)
New features:
o Embed TrueType fonts for -add-text with -font-ttf
o Add links to parts of text with -add-text as %URL[|].
Extended features: Extended features:
o Add links to parts of text with -add-text as %URL[|].
o Allow -utf8 with -split-bookmarks -o @B.pdf to produce UTF8 filenames o Allow -utf8 with -split-bookmarks -o @B.pdf to produce UTF8 filenames
o -merge-add-bookmarks now works with unicode filenames o -merge-add-bookmarks now works with unicode filenames
o Better transformation of some annotation types o Better transformation of some annotation types

View File

@ -380,6 +380,8 @@ type args =
mutable direction : int; mutable direction : int;
mutable effect_duration : float; mutable effect_duration : float;
mutable font : font; mutable font : font;
mutable fontfile : string option;
mutable fontencoding : Pdftext.encoding;
mutable fontname : string; mutable fontname : string;
mutable fontsize : float; mutable fontsize : float;
mutable color : Cpdfaddtext.color; mutable color : Cpdfaddtext.color;
@ -501,6 +503,8 @@ let args =
direction = 0; direction = 0;
effect_duration = 1.; effect_duration = 1.;
font = StandardFont Pdftext.TimesRoman; font = StandardFont Pdftext.TimesRoman;
fontfile = None;
fontencoding = Pdftext.WinAnsiEncoding;
fontname = "Times-Roman"; fontname = "Times-Roman";
fontsize = 12.; fontsize = 12.;
color = Cpdfaddtext.RGB (0., 0., 0.); color = Cpdfaddtext.RGB (0., 0., 0.);
@ -622,6 +626,8 @@ let reset_arguments () =
args.direction <- 0; args.direction <- 0;
args.effect_duration <- 1.; args.effect_duration <- 1.;
args.font <- StandardFont Pdftext.TimesRoman; args.font <- StandardFont Pdftext.TimesRoman;
args.fontfile <- None;
args.fontencoding <- Pdftext.WinAnsiEncoding;
args.fontname <- "Times-Roman"; args.fontname <- "Times-Roman";
args.fontsize <- 12.; args.fontsize <- 12.;
args.color <- Cpdfaddtext.RGB (0., 0., 0.); args.color <- Cpdfaddtext.RGB (0., 0., 0.);
@ -1717,6 +1723,17 @@ let setidironlypdfs () =
let setnowarnrotate () = let setnowarnrotate () =
args.no_warn_rotate <- true args.no_warn_rotate <- true
let setfontttf s =
args.fontfile <- Some s
let setfontttfencoding s =
args.fontencoding <-
match s with
| "MacRomanEncoding" -> Pdftext.MacRomanEncoding
| "WinAnsiEncoding" -> Pdftext.WinAnsiEncoding
| "StandardEncoding" -> Pdftext.StandardEncoding
| _ -> error "Unknown encoding"
let whingemalformed () = let whingemalformed () =
prerr_string "Command line must be of exactly the form\ncpdf <infile> -gs <path> -gs-malformed-force -o <outfile>\n"; prerr_string "Command line must be of exactly the form\ncpdf <infile> -gs <path> -gs-malformed-force -o <outfile>\n";
exit 1 exit 1
@ -2021,6 +2038,12 @@ and specs =
("-font", ("-font",
Arg.String setfont, Arg.String setfont,
" Set the font"); " Set the font");
("-font-ttf",
Arg.String setfontttf,
" Load a TrueType font");
("-font-ttf-encoding",
Arg.String setfontttfencoding,
" Set the encoding for the TrueType font");
("-font-size", ("-font-size",
Arg.Float setfontsize, Arg.Float setfontsize,
" Set the font size"); " Set the font size");

View File

@ -1,4 +1,5 @@
%Document %URL - does not work for diagonal %Document %URL - does not work for diagonal
%Document -font-ttf
\documentclass{book} \documentclass{book}
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf, % Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
% dotnetcpdflibmanual.pdf, jcpdflibmanual.pdf jscpdflibmanual.pdf etc. % dotnetcpdflibmanual.pdf, jcpdflibmanual.pdf jscpdflibmanual.pdf etc.