Fix missing_fonts for Type3

This commit is contained in:
John Whitington 2024-07-02 18:17:00 +01:00
parent 99e8d6d544
commit fc8d119347
2 changed files with 12 additions and 10 deletions

View File

@ -84,18 +84,21 @@ let copy_font frompdf fontname fontpage range pdf =
(* Missing Fonts *)
let is_missing pdf dict =
match Pdf.lookup_direct pdf "/FontDescriptor" dict with
| None -> true
| Some d ->
match Pdf.lookup_direct pdf "/FontFile" d with
| Some _ -> false
| None ->
match Pdf.lookup_direct pdf "/FontFile2" d with
match Pdf.lookup_direct pdf "/Subtype" dict with
| Some (Pdf.Name "/Type3") -> false
| _ ->
match Pdf.lookup_direct pdf "/FontDescriptor" dict with
| None -> true
| Some d ->
match Pdf.lookup_direct pdf "/FontFile" d with
| Some _ -> false
| None ->
match Pdf.lookup_direct pdf "/FontFile3" d with
match Pdf.lookup_direct pdf "/FontFile2" d with
| Some _ -> false
| None -> true
| None ->
match Pdf.lookup_direct pdf "/FontFile3" d with
| Some _ -> false
| None -> true
let missing_font ?l pdf page (name, dict) =
if is_missing pdf dict then

View File

@ -977,7 +977,6 @@ let matterhorn_31_008 _ _ pdf =
(* NB This, for now, reports all unembedded fonts, save for Type 3 ones... *)
let matterhorn_31_009 _ _ pdf =
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
raise (MatterhornError (`List (map (fun (a, b, c, d, e) -> `String (Printf.sprintf "%i %s %s %s %s" a b c d e)) l)))