more
This commit is contained in:
parent
022ada3283
commit
42e4c6689d
|
@ -34,12 +34,12 @@ let embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding =
|
|||
let name_1 = basename () in
|
||||
let module TT = Cpdftruetype in
|
||||
let fontfile =
|
||||
let len = Pdfio.bytes_size f.TT.subset in
|
||||
let len = Pdfio.bytes_size f.TT.subset_fontfile in
|
||||
Pdf.Stream
|
||||
{contents =
|
||||
(Pdf.Dictionary
|
||||
[("/Length", Pdf.Integer len); ("/Length1", Pdf.Integer len)],
|
||||
Pdf.Got f.TT.subset)}
|
||||
Pdf.Got f.TT.subset_fontfile)}
|
||||
in
|
||||
let fontfile_num = Pdf.addobj pdf fontfile in
|
||||
let open Pdftext in
|
||||
|
|
|
@ -19,7 +19,8 @@ type t =
|
|||
firstchar : int;
|
||||
lastchar : int;
|
||||
widths : int array;
|
||||
subset : Pdfio.bytes;
|
||||
subset_fontfile : Pdfio.bytes;
|
||||
subset : int list;
|
||||
tounicode : Pdfio.bytes option}
|
||||
|
||||
let dbg = ref false
|
||||
|
@ -554,7 +555,11 @@ let parse ?(subset=[]) data encoding =
|
|||
| (_, _, o, l)::_ -> o, l
|
||||
| [] -> raise (Pdf.PDFError "No glyf table found in TrueType font")
|
||||
in
|
||||
let subset = remove_unneeded_tables major minor !tables indexToLocFormat subset encoding !glyphcodes loca mk_b glyfoffset data in
|
||||
let main_subset = remove_unneeded_tables major minor !tables indexToLocFormat (tl subset) encoding !glyphcodes loca mk_b glyfoffset data in
|
||||
let second_subset = remove_unneeded_tables major minor !tables indexToLocFormat [hd subset] encoding !glyphcodes loca mk_b glyfoffset data in
|
||||
[{flags; minx; miny; maxx; maxy; italicangle; ascent; descent;
|
||||
capheight; stemv; xheight; avgwidth; maxwidth; firstchar; lastchar;
|
||||
widths; subset; tounicode = None}]
|
||||
capheight; stemv; xheight; avgwidth; maxwidth; firstchar; lastchar;
|
||||
widths; subset_fontfile = main_subset; subset = tl subset; tounicode = None};
|
||||
{flags; minx; miny; maxx; maxy; italicangle; ascent; descent;
|
||||
capheight; stemv; xheight; avgwidth; maxwidth; firstchar; lastchar;
|
||||
widths; subset_fontfile = second_subset; subset = [hd subset]; tounicode = None}]
|
||||
|
|
|
@ -18,7 +18,8 @@ type t =
|
|||
firstchar : int;
|
||||
lastchar : int;
|
||||
widths : int array;
|
||||
subset : Pdfio.bytes;
|
||||
subset_fontfile : Pdfio.bytes;
|
||||
subset : int list;
|
||||
tounicode : Pdfio.bytes option}
|
||||
|
||||
(* Parse the given TrueType font file. It will return one or more fonts. The
|
||||
|
|
Loading…
Reference in New Issue