From 3c10f50d68fcb2e690c2ba62355bb845051f758f Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 4 Oct 2022 22:15:14 +0100 Subject: [PATCH] more --- cpdfembed.ml | 2 +- cpdftruetype.ml | 2 +- cpdftruetype.mli | 14 +++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cpdfembed.ml b/cpdfembed.ml index 21d7525..99e879c 100644 --- a/cpdfembed.ml +++ b/cpdfembed.ml @@ -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 = diff --git a/cpdftruetype.ml b/cpdftruetype.ml index c76d128..b942a74 100644 --- a/cpdftruetype.ml +++ b/cpdftruetype.ml @@ -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 diff --git a/cpdftruetype.mli b/cpdftruetype.mli index 79139f8..193b7e0 100644 --- a/cpdftruetype.mli +++ b/cpdftruetype.mli @@ -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