This commit is contained in:
John Whitington 2022-10-04 22:15:14 +01:00
parent 1f6afaccd8
commit 3c10f50d68
3 changed files with 11 additions and 7 deletions

View File

@ -48,7 +48,7 @@ let embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding =
let accepted_unicodepoints =
calc_accepted_unicodepoints encoding_table glyphlist_table codepoints
in
let f = hd (Cpdftruetype.parse ~subset:accepted_unicodepoints fontfile ~encoding) in
let f = hd (Cpdftruetype.parse ~subset:accepted_unicodepoints fontfile encoding) in
let name_1 = basename () in
let module TT = Cpdftruetype in
let fontfile =

View File

@ -356,7 +356,7 @@ let remove_unneeded_tables major minor tables indexToLocFormat subset encoding c
close_out o;
bytes
let parse ?(subset=[]) data ~encoding =
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
let b = mk_b 0 in
let major, minor = read_fixed b in

View File

@ -1,4 +1,6 @@
(* Parse a TrueType font *)
(* Parse and subset TrueType fonts *)
(* The type of a single parsed font, including everything needed to build a PDF font. *)
type t =
{flags : int;
minx : int;
@ -19,7 +21,9 @@ type t =
subset : Pdfio.bytes;
tounicode : Pdfio.bytes option}
(* Parse the font, given the list of Unicode codepoints required for the subset
and optionally their PDF codepoint too. Returns the information required for
embedding this font in a PDF. *)
val parse : ?subset:int list -> Pdfio.bytes -> encoding:Pdftext.encoding -> t list
(* Parse the given TrueType font file. It will return one or more fonts. The
first, a plain Latin font in the given encoding. Others are for the
additional characters in the font. For subsetting, or to return a full
font-pack, you should supply a subset (a list of unicode codepoints whose
corresponding glyphs are required). *)
val parse : ?subset:int list -> Pdfio.bytes -> Pdftext.encoding -> t list