From e2bc9a29fcf0f66c439ecd8ba958d995f05c7e72 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Sat, 8 Jun 2024 14:57:02 +0100 Subject: [PATCH] Matterhorn 31_006 --- cpdfua.ml | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/cpdfua.ml b/cpdfua.ml index 7668260..fceef55 100644 --- a/cpdfua.ml +++ b/cpdfua.ml @@ -369,7 +369,78 @@ let matterhorn_31_005 pdf = () (* A CMap is neither listed as described in ISO 32000-1:2008, 9.7.5.2, Table 118 nor is it embedded. *) -let matterhorn_31_006 pdf = () +let cmap_names = + ["/GB-EUC-H"; + "/GB-EUC-V"; + "/GBpc-EUC-H"; + "/GBpc-EUC-V"; + "/GBK-EUC-H"; + "/GBK-EUC-V"; + "/GBKp-EUC-H"; + "/GBKp-EUC-V"; + "/GBK2K-H"; + "/GBK2K-V"; + "/UniGB-UCS32-H"; + "/UniGB-UCS32-V"; + "/UniGB-UTF16-H"; + "/UniGB-UTF16-V"; + "/B5pc-H"; + "/B5pc-V"; + "/HKscs-B5-H"; + "/HKscs-B5-V"; + "/ETen-B5-H"; + "/ETen-B5-V"; + "/ETenms-B5-H"; + "/ETenms-B5-V"; + "/CNS-EUC-H"; + "/CNS-EUC-V"; + "/UniCNS-UCS2-H"; + "/UniCNS-UCS2-V"; + "/UniCNS-UTF16-H"; + "/UniCNS-UTF16-V"; + "/83pv-RKSJ-H"; + "/90ms-RKSJ-H"; + "/90ms-RKSJ-V"; + "/90msp-RKSJ-H"; + "/90msp-RKSJ-V"; + "/90pv-RKSJ-H"; + "/Add-RKSJ-H"; + "/Add-RKSJ-V"; + "/EUC-H"; + "/EUC-V"; + "/Ext-RKSJ-H"; + "/Ext-RKSJ-V"; + "/H"; + "/V"; + "/UniJIS-UCS2-H"; + "/UniJIS-UCS2-V"; + "/UniJIS-UCS2-HW-H"; + "/UniJIS-UCS2-HW-V"; + "/UniJIS-UTF16-H"; + "/UniJIS-UTF16-V"; + "/KSC-EUC-H"; + "/KSC-EUC-V"; + "/KSCms-UHC-H"; + "/KSCms-UHC-V"; + "/KSCms-UHC-HW-H"; + "/KSCms-UHS-HW-V"; + "/KSCpc-EUC-H"; + "/UniKS-UCS2-H"; + "/UniKS-UCS2-V"; + "/Identity-H"; + "/Identity-V"] + +let matterhorn_31_006 pdf = + Pdf.objiter + (fun _ o -> + match Pdf.lookup_direct pdf "/Subtype" o with + | Some (Pdf.Name "/Type0") -> + begin match Pdf.lookup_direct pdf "/Encoding" o with + | Some (Pdf.Name n) when not (List.mem n cmap_names) -> merror_str n + | _ -> () + end + | _ -> ()) + pdf (* The WMode entry in a CMap dictionary is not identical to the WMode value in the CMap stream. *)