Begin higher fonts at charcode 33

This commit is contained in:
John Whitington 2023-06-22 14:43:52 +01:00
parent ebd407598a
commit 1c8ee8623a
2 changed files with 5 additions and 3 deletions

View File

@ -10,7 +10,7 @@ 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;*) 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;

View File

@ -2,6 +2,8 @@
open Pdfutil open Pdfutil
open Pdfio open Pdfio
(* FIXME No need for bitstream - everything is byte based, so we can use a normal input *)
let dbg = ref false let dbg = ref false
type t = type t =
@ -595,7 +597,7 @@ let parse ?(subset=[]) data encoding =
let flags_1 = calculate_flags false italicangle in let flags_1 = calculate_flags false italicangle in
let flags_2 = calculate_flags true italicangle in let flags_2 = calculate_flags true italicangle in
let firstchar_1, lastchar_1 = calculate_limits subset_1 in let firstchar_1, lastchar_1 = calculate_limits subset_1 in
let firstchar_2, lastchar_2 = (0, length subset_2 - 1) in let firstchar_2, lastchar_2 = (33, length subset_2 + 33 - 1) in
let numOfLongHorMetrics = let numOfLongHorMetrics =
match keep (function (t, _, _, _) -> string_of_tag t = "hhea") !tables with match keep (function (t, _, _, _) -> string_of_tag t = "hhea") !tables with
| (_, _, o, l)::_ -> let b = mk_b (i32toi o) in read_hhea_table b | (_, _, o, l)::_ -> let b = mk_b (i32toi o) in read_hhea_table b
@ -635,7 +637,7 @@ let parse ?(subset=[]) data encoding =
(fun n u -> (fun n u ->
let s = implode (tl (tl (explode (Pdftext.utf16be_of_codepoints [u])))) in let s = implode (tl (tl (explode (Pdftext.utf16be_of_codepoints [u])))) in
Hashtbl.add h n s) Hashtbl.add h n s)
(indx0 subset_2) (map (( + ) 33) (indx0 subset_2))
subset_2; subset_2;
Some h Some h
in in