Successful codepoint gathering
This commit is contained in:
parent
8d46e15a7e
commit
bdc9d8e239
24
cpdfdraw.ml
24
cpdfdraw.ml
|
@ -104,9 +104,6 @@ let empty_res () =
|
|||
let resstack =
|
||||
ref [empty_res ()]
|
||||
|
||||
let res () =
|
||||
try hd !resstack with _ -> error "graphics stack empty"
|
||||
|
||||
let rescopy r =
|
||||
{r with
|
||||
images = Hashtbl.copy r.images;
|
||||
|
@ -114,6 +111,9 @@ let rescopy r =
|
|||
extgstates = Hashtbl.copy r.extgstates;
|
||||
form_xobjects = Hashtbl.copy r.form_xobjects}
|
||||
|
||||
let res () =
|
||||
try hd !resstack with _ -> error "graphics stack empty"
|
||||
|
||||
let respush () =
|
||||
resstack := (rescopy (res ()))::!resstack
|
||||
|
||||
|
@ -341,6 +341,12 @@ let rec contains_specials_drawop = function
|
|||
and contains_specials l =
|
||||
List.exists contains_specials_drawop l
|
||||
|
||||
let save_whole_stack () =
|
||||
map (fun r -> rescopy r) !resstack
|
||||
|
||||
let restore_whole_stack r =
|
||||
resstack := r
|
||||
|
||||
let draw_single ~fast ~underneath ~filename ~bates ~batespad fast range pdf drawops =
|
||||
(res ()).num <- max (res ()).num (minimum_resource_number pdf range);
|
||||
let endpage = Pdfpage.endpage pdf in
|
||||
|
@ -350,8 +356,10 @@ let draw_single ~fast ~underneath ~filename ~bates ~batespad fast range pdf draw
|
|||
then None
|
||||
else
|
||||
begin
|
||||
ignore (ops_of_drawops true pdf endpage filename bates batespad 0 (hd pages) drawops);
|
||||
Some (ops_of_drawops false pdf endpage filename bates batespad 0 (hd pages) drawops)
|
||||
let r = save_whole_stack () in
|
||||
ignore (ops_of_drawops true pdf endpage filename bates batespad 0 (hd pages) drawops);
|
||||
restore_whole_stack r;
|
||||
Some (ops_of_drawops false pdf endpage filename bates batespad 0 (hd pages) drawops)
|
||||
end
|
||||
in
|
||||
let ss =
|
||||
|
@ -362,8 +370,10 @@ let draw_single ~fast ~underneath ~filename ~bates ~batespad fast range pdf draw
|
|||
(match ops with
|
||||
| Some x -> x
|
||||
| None ->
|
||||
ignore (ops_of_drawops true pdf endpage filename bates batespad n p drawops);
|
||||
ops_of_drawops false pdf endpage filename bates batespad n p drawops)
|
||||
let r = save_whole_stack () in
|
||||
ignore (ops_of_drawops true pdf endpage filename bates batespad n p drawops);
|
||||
restore_whole_stack r;
|
||||
ops_of_drawops false pdf endpage filename bates batespad n p drawops)
|
||||
else [])
|
||||
(ilist 1 endpage)
|
||||
pages
|
||||
|
|
|
@ -496,13 +496,14 @@ let write_font filename data =
|
|||
close_out fh
|
||||
|
||||
let find_main encoding subset =
|
||||
let encoding_table = Pdftext.table_of_encoding encoding in
|
||||
(take subset 5, [drop subset 5])
|
||||
(*let encoding_table = Pdftext.table_of_encoding encoding in
|
||||
let first, rest =
|
||||
List.partition
|
||||
(fun u -> try ignore (Hashtbl.find encoding_table u); true with Not_found -> false)
|
||||
subset
|
||||
in
|
||||
(first, splitinto 224 rest)
|
||||
(first, splitinto 224 rest)*)
|
||||
|
||||
let parse ~subset data encoding =
|
||||
let mk_b byte_offset = bitbytes_of_input (let i = input_of_bytes data in i.seek_in byte_offset; i) in
|
||||
|
|
Loading…
Reference in New Issue