This commit is contained in:
John Whitington 2022-09-24 17:29:04 +01:00
parent 6589824a8f
commit 983b087020
1 changed files with 34 additions and 23 deletions

View File

@ -55,8 +55,15 @@ let colour_op_stroke = function
| Grey g -> Pdfops.Op_G g
| CYMK (c, y, m, k) -> Pdfops.Op_K (c, y, m, k)
let ops longest_w x y rotate hoffset voffset outline linewidth unique_fontname unique_extgstatename colour fontsize text =
String.iter (fun x -> Hashtbl.replace used x ()) text;
let ops fontname longest_w x y rotate hoffset voffset outline linewidth unique_fontname unique_extgstatename colour fontsize text =
begin match Hashtbl.find used fontname with
| exception Not_found ->
let thisused = null_hash () in
String.iter (fun x -> Hashtbl.replace thisused x ()) text;
Hashtbl.add used fontname thisused
| thisused ->
String.iter (fun x -> Hashtbl.replace thisused x ()) text;
end;
[Pdfops.Op_q;
Pdfops.Op_BMC "/CPDFSTAMP";
Pdfops.Op_cm
@ -417,11 +424,11 @@ let addtext
in
match font with
| Some f ->
ops longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
ops fontname longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
unique_fontname unique_extgstatename colour fontsize text,
urls, x, y, hoffset, voffset, text, joffset
| None ->
ops longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
ops fontname longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
fontname None colour fontsize text,
urls, x, y, hoffset, voffset, text, joffset
in
@ -611,7 +618,11 @@ let
begin match embedinfo with
| None -> ()
| Some (_, fontfile, fontname, encoding) ->
let charcodes = map fst (list_of_hashtbl used) in
let charcodes =
match Hashtbl.find used fontname with
| exception Not_found -> []
| thisused -> map fst (list_of_hashtbl thisused)
in
let encoding_table = Pdftext.table_of_encoding encoding in
let glyphlist_table = Pdfglyphlist.glyph_hashes () in
let codepoints =