diff --git a/Changes b/Changes index c41c084..35b3440 100644 --- a/Changes +++ b/Changes @@ -1,8 +1,12 @@ 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: -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 -merge-add-bookmarks now works with unicode filenames o Better transformation of some annotation types diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 374151f..389cd79 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -380,6 +380,8 @@ type args = mutable direction : int; mutable effect_duration : float; mutable font : font; + mutable fontfile : string option; + mutable fontencoding : Pdftext.encoding; mutable fontname : string; mutable fontsize : float; mutable color : Cpdfaddtext.color; @@ -501,6 +503,8 @@ let args = direction = 0; effect_duration = 1.; font = StandardFont Pdftext.TimesRoman; + fontfile = None; + fontencoding = Pdftext.WinAnsiEncoding; fontname = "Times-Roman"; fontsize = 12.; color = Cpdfaddtext.RGB (0., 0., 0.); @@ -622,6 +626,8 @@ let reset_arguments () = args.direction <- 0; args.effect_duration <- 1.; args.font <- StandardFont Pdftext.TimesRoman; + args.fontfile <- None; + args.fontencoding <- Pdftext.WinAnsiEncoding; args.fontname <- "Times-Roman"; args.fontsize <- 12.; args.color <- Cpdfaddtext.RGB (0., 0., 0.); @@ -1717,6 +1723,17 @@ let setidironlypdfs () = let setnowarnrotate () = 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 () = prerr_string "Command line must be of exactly the form\ncpdf -gs -gs-malformed-force -o \n"; exit 1 @@ -2021,6 +2038,12 @@ and specs = ("-font", Arg.String setfont, " 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", Arg.Float setfontsize, " Set the font size"); diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 7802086..29830f4 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -1,4 +1,5 @@ %Document %URL - does not work for diagonal +%Document -font-ttf \documentclass{book} % Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf, % dotnetcpdflibmanual.pdf, jcpdflibmanual.pdf jscpdflibmanual.pdf etc.