more
This commit is contained in:
parent
d43e7c71da
commit
34b60f69fa
1
Changes
1
Changes
|
@ -1,5 +1,6 @@
|
||||||
2.5 (Upcoming 2022)
|
2.5 (Upcoming 2022)
|
||||||
|
|
||||||
|
o Text added in existing fonts is now encoding-aware
|
||||||
o New operation -print-font-encoding
|
o New operation -print-font-encoding
|
||||||
o New -print-dict-entry operation prints values for a given key
|
o New -print-dict-entry operation prints values for a given key
|
||||||
o Extend -remove-dict-entry to allow search
|
o Extend -remove-dict-entry to allow search
|
||||||
|
|
22
cpdf.ml
22
cpdf.ml
|
@ -1119,17 +1119,15 @@ let print_fonts pdf =
|
||||||
|
|
||||||
(* \section{Superimpose text, page numbers etc.} *)
|
(* \section{Superimpose text, page numbers etc.} *)
|
||||||
|
|
||||||
|
(* Process UTF8 text to /WinAnsiEncoding string (for standard 14) or whatever
|
||||||
(* Process UTF8 text to /WinAnsiEncoding string. *)
|
is in the font (for existing fonts). *)
|
||||||
let winansi_of_utf8 s =
|
let charcodes_of_utf8 s =
|
||||||
(*flprint "winansi_of_utf8:";
|
let encoding =
|
||||||
iter (Printf.printf "%C ") (explode s);
|
(* FIXME: read from font *)
|
||||||
flprint "\n";*)
|
Pdftext.WinAnsiEncoding
|
||||||
let extractor = Pdftext.charcode_extractor_of_encoding Pdftext.WinAnsiEncoding
|
in
|
||||||
and codepoints = Pdftext.codepoints_of_utf8 s in
|
let extractor = Pdftext.charcode_extractor_of_encoding encoding in
|
||||||
(*flprint "codepoints after Pdftext.codepoints_of_utf8\n";
|
let codepoints = Pdftext.codepoints_of_utf8 s in
|
||||||
iter (Printf.printf "%i ") codepoints;
|
|
||||||
flprint "\ndone\n";*)
|
|
||||||
implode (map char_of_int (option_map extractor codepoints))
|
implode (map char_of_int (option_map extractor codepoints))
|
||||||
|
|
||||||
(* Process codepoints back to UTF8, assuming it came from UTF8 to start with *)
|
(* Process codepoints back to UTF8, assuming it came from UTF8 to start with *)
|
||||||
|
@ -1550,7 +1548,7 @@ let
|
||||||
Printf.printf "relative-to-cropbox = %b" cropbox;
|
Printf.printf "relative-to-cropbox = %b" cropbox;
|
||||||
flprint "\n";*)
|
flprint "\n";*)
|
||||||
ops_metrics := [];
|
ops_metrics := [];
|
||||||
let text = winansi_of_utf8 text in
|
let text = charcodes_of_utf8 text in
|
||||||
let lines = map unescape_string (split_at_newline text) in
|
let lines = map unescape_string (split_at_newline text) in
|
||||||
let pdf = ref pdf in
|
let pdf = ref pdf in
|
||||||
let voffset =
|
let voffset =
|
||||||
|
|
Loading…
Reference in New Issue