Do not report Type3 as missing

This commit is contained in:
John Whitington 2024-07-02 18:12:18 +01:00
parent bcfff5250f
commit 99e8d6d544
3 changed files with 13 additions and 12 deletions

View File

@ -114,7 +114,7 @@ let missing_font ?l pdf page (name, dict) =
in in
match l with match l with
| None -> Printf.printf "%i, %s, %s, %s, %s\n" page name subtype basefont encoding | None -> Printf.printf "%i, %s, %s, %s, %s\n" page name subtype basefont encoding
| Some r -> r := Printf.sprintf "%i %s %s %s %s" page name subtype basefont encoding::!r | Some r -> r := (page, name, subtype, basefont, encoding)::!r
let missing_fonts ?l pdf range = let missing_fonts ?l pdf range =
Cpdfpage.iter_pages Cpdfpage.iter_pages

View File

@ -20,9 +20,9 @@ val embed_missing_fonts : string -> bool -> string -> string -> unit
val copy_font : Pdf.t -> string -> int -> int list -> Pdf.t -> Pdf.t val copy_font : Pdf.t -> string -> int -> int list -> Pdf.t -> Pdf.t
(** Report missing fonts *) (** Report missing fonts *)
val missing_fonts : ?l:string list ref -> Pdf.t -> int list -> unit val missing_fonts : ?l:(int * string * string * string * string) list ref -> Pdf.t -> int list -> unit
val missing_fonts_return : Pdf.t -> int list -> string list val missing_fonts_return : Pdf.t -> int list -> (int * string * string * string * string) list
(** Print a font table to Standard Output. *) (** Print a font table to Standard Output. *)
val print_font_table : Pdf.t -> string -> int -> unit val print_font_table : Pdf.t -> string -> int -> unit

View File

@ -28,23 +28,23 @@ let print_children (E (n, cs)) =
flprint "\n" flprint "\n"
(* Read attributes. *) (* Read attributes. *)
let rec read_single d = let rec read_single pdf d =
match d with match Pdf.direct pdf d with
| Pdf.Dictionary d -> map fst d | Pdf.Dictionary d -> map fst d
| Pdf.Stream s -> read_single (fst !s) | Pdf.Stream s -> read_single pdf (fst !s)
| Pdf.Name n -> [n] | Pdf.Name n -> [n]
| x -> error "read_single" | x -> error ("read_single: " ^ Pdfwrite.string_of_pdf x)
let read_a pdf n stnode = let read_a pdf n stnode =
match Pdf.lookup_direct pdf n stnode with match Pdf.lookup_direct pdf n stnode with
| Some (Pdf.Array attrs) -> | Some (Pdf.Array attrs) ->
let attrs = keep (function Pdf.Integer _ -> false | _ -> true) attrs in let attrs = keep (function Pdf.Integer _ -> false | _ -> true) attrs in
flatten (map read_single attrs) flatten (map (read_single pdf) attrs)
| Some (Pdf.Name n) -> [n] | Some (Pdf.Name n) -> [n]
| Some (Pdf.Dictionary d) -> | Some (Pdf.Dictionary d) ->
read_single (Pdf.Dictionary d) read_single pdf (Pdf.Dictionary d)
| Some (Pdf.Stream s) -> | Some (Pdf.Stream s) ->
read_single (Pdf.Stream s) read_single pdf (Pdf.Stream s)
| Some _ -> [] | Some _ -> []
| None -> [] | None -> []
@ -974,11 +974,12 @@ let matterhorn_31_008 _ _ pdf =
(* For a font used by text intended to be rendered the font program is not (* For a font used by text intended to be rendered the font program is not
embedded. *) embedded. *)
(* NB This, for now, reports all unembedded fonts. *) (* NB This, for now, reports all unembedded fonts, save for Type 3 ones... *)
let matterhorn_31_009 _ _ pdf = let matterhorn_31_009 _ _ pdf =
let l = Cpdffont.missing_fonts_return pdf (ilist 1 (Pdfpage.endpage pdf)) in let l = Cpdffont.missing_fonts_return pdf (ilist 1 (Pdfpage.endpage pdf)) in
let l = lose (function (_, _, "/Type3", _, _) -> true | _ -> false) l in
if l <> [] then if l <> [] then
raise (MatterhornError (`List (map (fun x -> `String x) l))) raise (MatterhornError (`List (map (fun (a, b, c, d, e) -> `String (Printf.sprintf "%i %s %s %s %s" a b c d e)) l)))
(* For a font used by text the font program is embedded but it does not contain (* For a font used by text the font program is embedded but it does not contain
glyphs for all of the glyphs referenced by the text used for rendering. *) glyphs for all of the glyphs referenced by the text used for rendering. *)