Proper font IDs
This commit is contained in:
parent
c9c8a06510
commit
6997a56661
|
@ -10,14 +10,12 @@ let rec of_utf8_with_newlines fontpack fontsize t =
|
||||||
(fun u ->
|
(fun u ->
|
||||||
match Cpdfembed.get_char fontpack u with
|
match Cpdfembed.get_char fontpack u with
|
||||||
| Some (c, n, f) ->
|
| Some (c, n, f) ->
|
||||||
(*Printf.printf "Charcode %i, font number %i\n" c n;*)
|
|
||||||
begin if n <> !currfont then
|
begin if n <> !currfont then
|
||||||
begin
|
begin
|
||||||
if !currtext <> [] then items := Cpdftype.Text (rev !currtext)::!items;
|
if !currtext <> [] then items := Cpdftype.Text (rev !currtext)::!items;
|
||||||
currtext := [];
|
currtext := [];
|
||||||
currfont := n;
|
currfont := n;
|
||||||
(* FIXME font id *)
|
items := Cpdftype.Font (string_of_int n, f, fontsize)::!items;
|
||||||
items := Cpdftype.Font ("", f, fontsize)::!items;
|
|
||||||
currtext := char_of_int c::!currtext;
|
currtext := char_of_int c::!currtext;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
10
cpdftoc.ml
10
cpdftoc.ml
|
@ -38,10 +38,9 @@ let of_utf8 fontpack fontsize t =
|
||||||
(map
|
(map
|
||||||
(function
|
(function
|
||||||
| [] -> []
|
| [] -> []
|
||||||
| (_, _, font) as h::t ->
|
| (_, n, font) as h::t ->
|
||||||
let charcodes = map (fun (c, _, _) -> char_of_int c) (h::t) in
|
let charcodes = map (fun (c, _, _) -> char_of_int c) (h::t) in
|
||||||
(*FIXME id *)
|
[Cpdftype.Font (string_of_int n, font, fontsize); Cpdftype.Text charcodes])
|
||||||
[Cpdftype.Font ("", font, fontsize); Cpdftype.Text charcodes])
|
|
||||||
collated)
|
collated)
|
||||||
|
|
||||||
(* Cpdftype codepoints from a font and PDFDocEndoding string *)
|
(* Cpdftype codepoints from a font and PDFDocEndoding string *)
|
||||||
|
@ -68,12 +67,11 @@ let rec shorten_text_inner l t =
|
||||||
let shorten_text fontpack fontsize l t =
|
let shorten_text fontpack fontsize l t =
|
||||||
let short = shorten_text_inner l t in
|
let short = shorten_text_inner l t in
|
||||||
if short = t then t else
|
if short = t then t else
|
||||||
let charcode, _, dotfont =
|
let charcode, dotfontnum, dotfont =
|
||||||
unopt (Cpdfembed.get_char fontpack (int_of_char '.'))
|
unopt (Cpdfembed.get_char fontpack (int_of_char '.'))
|
||||||
in
|
in
|
||||||
let charcode = char_of_int charcode in
|
let charcode = char_of_int charcode in
|
||||||
(* FIXME ID *)
|
short @ [Cpdftype.Font (string_of_int dotfontnum, dotfont, fontsize); Cpdftype.Text [charcode; charcode; charcode]]
|
||||||
short @ [Cpdftype.Font ("", dotfont, fontsize); Cpdftype.Text [charcode; charcode; charcode]]
|
|
||||||
|
|
||||||
(* Calculate the used codepoints *)
|
(* Calculate the used codepoints *)
|
||||||
let used pdf fastrefnums labels title marks =
|
let used pdf fastrefnums labels title marks =
|
||||||
|
|
Loading…
Reference in New Issue