more
This commit is contained in:
parent
e29add66b1
commit
44f62e49ca
|
@ -499,8 +499,11 @@ let parse ?(subset=[]) data encoding =
|
|||
| (_, _, o, l)::_ -> o, l
|
||||
| [] -> raise (Pdf.PDFError "No loca table found in TrueType font")
|
||||
in
|
||||
let subset_1 = if subset = [] then [] else tl subset in
|
||||
let subset_2 = if subset = [] then [] else [hd subset] in
|
||||
let flags = calculate_flags italicangle in
|
||||
let firstchar, lastchar = calculate_limits subset in
|
||||
let firstchar_1, lastchar_1 = calculate_limits subset_1 in
|
||||
let firstchar_2, lastchar_2 = calculate_limits subset_2 in
|
||||
let numOfLongHorMetrics =
|
||||
match keep (function (t, _, _, _) -> string_of_tag t = "hhea") !tables with
|
||||
| (_, _, o, l)::_ -> let b = mk_b (i32toi o) in read_hhea_table b
|
||||
|
@ -511,7 +514,8 @@ let parse ?(subset=[]) data encoding =
|
|||
| (_, _, o, _)::_ -> read_hmtx_table numOfLongHorMetrics (mk_b (i32toi o))
|
||||
| [] -> raise (Pdf.PDFError "No hmtx table found in TrueType font")
|
||||
in
|
||||
let widths = calculate_widths unitsPerEm encoding firstchar lastchar subset !glyphcodes hmtxdata in
|
||||
let widths_1 = calculate_widths unitsPerEm encoding firstchar_1 lastchar_1 subset_1 !glyphcodes hmtxdata in
|
||||
let widths_2 = calculate_widths unitsPerEm encoding firstchar_2 lastchar_2 subset_2 !glyphcodes hmtxdata in
|
||||
let maxwidth = calculate_maxwidth unitsPerEm hmtxdata in
|
||||
let stemv = calculate_stemv () in
|
||||
let b = mk_b (i32toi locaoffset) in
|
||||
|
@ -522,11 +526,11 @@ let parse ?(subset=[]) data encoding =
|
|||
| [] -> raise (Pdf.PDFError "No glyf table found in TrueType font")
|
||||
in
|
||||
let main_subset =
|
||||
subset_font major minor !tables indexToLocFormat (if subset = [] then [] else tl subset)
|
||||
subset_font major minor !tables indexToLocFormat subset_1
|
||||
encoding !glyphcodes loca mk_b glyfoffset data
|
||||
in
|
||||
let second_subset =
|
||||
subset_font major minor !tables indexToLocFormat (if subset = [] then [] else [hd subset])
|
||||
subset_font major minor !tables indexToLocFormat subset_2
|
||||
encoding !glyphcodes loca mk_b glyfoffset data
|
||||
in
|
||||
let second_tounicode =
|
||||
|
@ -536,9 +540,9 @@ let parse ?(subset=[]) data encoding =
|
|||
Some h
|
||||
in
|
||||
[{flags; minx; miny; maxx; maxy; italicangle; ascent; descent;
|
||||
capheight; stemv; xheight; avgwidth; maxwidth; firstchar; lastchar;
|
||||
widths; subset_fontfile = main_subset; subset = if subset = [] then [] else tl subset; tounicode = None};
|
||||
capheight; stemv; xheight; avgwidth; maxwidth; firstchar = firstchar_1; lastchar = lastchar_1;
|
||||
widths = widths_1; subset_fontfile = main_subset; subset = subset_1; tounicode = None};
|
||||
{flags; minx; miny; maxx; maxy; italicangle; ascent; descent;
|
||||
capheight; stemv; xheight; avgwidth; maxwidth; firstchar; lastchar;
|
||||
widths; subset_fontfile = second_subset; subset = if subset = [] then [] else [hd subset];
|
||||
capheight; stemv; xheight; avgwidth; maxwidth; firstchar = firstchar_2; lastchar = lastchar_2;
|
||||
widths = widths_2; subset_fontfile = second_subset; subset = subset_2;
|
||||
tounicode = second_tounicode}]
|
||||
|
|
Loading…
Reference in New Issue