This commit is contained in:
John Whitington 2023-05-02 15:25:16 +01:00
parent 95115786d9
commit d0cdba9c1e
2 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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.