diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 903501c..dd6d51f 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -4455,7 +4455,15 @@ let go () = let pdf = Cpdftexttopdf.typeset ~font:cpdffont ~papersize:args.createpdf_pagesize ~fontsize:args.fontsize text in write_pdf false pdf | Some (TextWidth s) -> - Printf.printf "%i\n" (1000) + let rawwidth = + match args.font with + | StandardFont f -> + Pdfstandard14.textwidth false WinAnsiEncoding f s + | _ -> + error "-text-width only works for the standard 14 fonts" + in + let w = (float rawwidth *. args.fontsize) /. 1000. in + Printf.printf "%f\n" w | Some Draw -> if !tdeep <> 0 then error "Unmatched -bt / -et" else let pdf = get_single_pdf args.op false in diff --git a/cpdfmanual.tex b/cpdfmanual.tex index ed97bd6..c4c10c5 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -12,7 +12,8 @@ %Document Topleft2 etc. %Test new camlpdf unit conversions %Document -non-full-screen-page-mode -%Documnet -open-at-page-custom +%Document -open-at-page-custom +%Document -text-width \documentclass{book} % Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf, % dotnetcpdflibmanual.pdf, jcpdflibmanual.pdf jscpdflibmanual.pdf etc.