Fix regression in 2.6 re: UTF8 in -add-text contents

This commit is contained in:
John Whitington 2023-09-06 16:15:04 +01:00
parent d8e9ec079c
commit c96f785f7e
1 changed files with 6 additions and 4 deletions

View File

@ -50,7 +50,7 @@ let colour_op_stroke = function
| Grey g -> Pdfops.Op_G g | Grey g -> Pdfops.Op_G g
| CYMK (c, y, m, k) -> Pdfops.Op_K (c, y, m, k) | CYMK (c, y, m, k) -> Pdfops.Op_K (c, y, m, k)
let ops fontpack fontpackpdfobjs fontname longest_w x y rotate hoffset voffset outline linewidth unique_fontname unique_fontnames unique_extgstatename colour fontsize text = let ops font fontpack fontpackpdfobjs fontname longest_w x y rotate hoffset voffset outline linewidth unique_fontname unique_fontnames unique_extgstatename colour fontsize text =
let textops = let textops =
match fontpack with match fontpack with
| Some fontpack -> | Some fontpack ->
@ -65,7 +65,9 @@ let ops fontpack fontpackpdfobjs fontname longest_w x y rotate hoffset voffset o
Pdfops.Op_Tj (implode (map (fun (charcode, _, _) -> char_of_int charcode) l))]) Pdfops.Op_Tj (implode (map (fun (charcode, _, _) -> char_of_int charcode) l))])
collated) collated)
| None -> | None ->
[Pdfops.Op_Tf (unique_fontname, fontsize); Pdfops.Op_Tj text] match font with
| Some font -> [Pdfops.Op_Tf (unique_fontname, fontsize); Pdfops.Op_Tj (charcodes_of_utf8 font text)]
| None -> [Pdfops.Op_Tf (unique_fontname, fontsize); Pdfops.Op_Tj text]
in in
[Pdfops.Op_q; [Pdfops.Op_q;
Pdfops.Op_BMC "/CPDFSTAMP"; Pdfops.Op_BMC "/CPDFSTAMP";
@ -346,11 +348,11 @@ let addtext
in in
match font with match font with
| Some f -> | Some f ->
ops fontpack fontpackpdfobjs fontname longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth ops font fontpack fontpackpdfobjs fontname longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
unique_fontname unique_fontnames unique_extgstatename colour fontsize text, unique_fontname unique_fontnames unique_extgstatename colour fontsize text,
urls, x, y, hoffset, voffset, text, joffset urls, x, y, hoffset, voffset, text, joffset
| None -> | None ->
ops fontpack fontpackpdfobjs fontname longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth ops font fontpack fontpackpdfobjs fontname longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
fontname unique_fontnames None colour fontsize text, fontname unique_fontnames None colour fontsize text,
urls, x, y, hoffset, voffset, text, joffset urls, x, y, hoffset, voffset, text, joffset
in in