mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-09 10:46:38 +00:00
M11: PDF/A verify takes the primary colour components of all three device spaces (6.2.5)
Gray, Red, Green and Blue are primary colour components as well as Cyan, Magenta, Yellow and Black (ISO 32000-1 10.5.5.6, ISO 32000-2 10.6.5.6): their halftones need no transfer function and may not have one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pq7HyDBXygTf7jcqdsjcfn
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4c5fd46af7
commit
b4e99b6229
@@ -6,8 +6,10 @@
|
||||
//! - halftones of type 1 or 5 only, without a `/HalftoneName` (ISO 32000-1 10.5.5); the halftones
|
||||
//! a type 5 halftone holds for its colorants are checked the same way;
|
||||
//! - a halftone's `/TransferFunction` only where one is needed: a type 5 halftone's component for
|
||||
//! a non-primary colorant has one, and no other halftone does. The primary colorants are those
|
||||
//! of DeviceCMYK; the `Default` component is left as it is (ISO 32000-1 10.5.5.6, Table 130);
|
||||
//! a non-primary colorant has one, and no other halftone does. The primary colour components
|
||||
//! are those of the standard device spaces: Gray; Red, Green and Blue; Cyan, Magenta, Yellow
|
||||
//! and Black (ISO 32000-1 10.5.5.6; ISO 32000-2 10.6.5.6). The `Default` component is left as
|
||||
//! it is (ISO 32000-1 Table 130);
|
||||
//! - a rendering intent (`/RI`) that is one of the four of ISO 32000-1 8.6.5.8, Table 70.
|
||||
//!
|
||||
//! Graphics state dictionaries are found as the `/ExtGState` entries of resource dictionaries
|
||||
@@ -27,8 +29,9 @@ const MAX_DEPTH: u8 = 128;
|
||||
const INTENTS: [&[u8]; 4] = [b"AbsoluteColorimetric", b"RelativeColorimetric", b"Saturation", b"Perceptual"];
|
||||
/// The entries of a type 5 halftone that aren't colorant halftones.
|
||||
const HALFTONE_KEYS: [&[u8]; 3] = [b"Type", b"HalftoneType", b"HalftoneName"];
|
||||
/// The primary colorants, whose halftones take the graphics state's transfer function.
|
||||
const PRIMARY: [&[u8]; 4] = [b"Cyan", b"Magenta", b"Yellow", b"Black"];
|
||||
/// The primary colour components of DeviceGray, DeviceRGB and DeviceCMYK, whose halftones take
|
||||
/// the graphics state's transfer function.
|
||||
const PRIMARY: [&[u8]; 8] = [b"Gray", b"Red", b"Green", b"Blue", b"Cyan", b"Magenta", b"Yellow", b"Black"];
|
||||
/// The entries that hold resource dictionaries.
|
||||
const RESOURCES: [&[u8]; 2] = [b"Resources", b"DR"];
|
||||
|
||||
|
||||
@@ -545,9 +545,11 @@ fn extended_graphics_states_are_checked() {
|
||||
let in_halftone = "A halftone has a transfer function, which only a non-primary colorant's halftone may have";
|
||||
assert_eq!(gs("/A << /HT << /HalftoneType 1 /TransferFunction 4 0 R >> >>"), [in_halftone]);
|
||||
assert_eq!(gs("/A << /HT << /HalftoneType 5 /Default 5 0 R /Cyan << /HalftoneType 1 /TransferFunction /Identity >> >> >>"), [in_halftone]);
|
||||
// The primary components are those of DeviceGray, DeviceRGB and DeviceCMYK (ISO 32000-1 10.5.5.6).
|
||||
assert_eq!(gs("/A << /HT << /HalftoneType 5 /Default 5 0 R /Gray << /HalftoneType 1 /TransferFunction /Identity >> >> >>"), [in_halftone]);
|
||||
assert_eq!(
|
||||
gs("/A << /HT << /HalftoneType 5 /Default 5 0 R /Spot 5 0 R /Red 5 0 R >> >>"),
|
||||
["The halftone for the colorant Red has no transfer function", "The halftone for the colorant Spot has no transfer function"]
|
||||
gs("/A << /HT << /HalftoneType 5 /Default 5 0 R /Spot 5 0 R /Red 5 0 R /Gray 5 0 R >> >>"),
|
||||
["The halftone for the colorant Spot has no transfer function"]
|
||||
);
|
||||
assert!(gs("/A << /HT << /HalftoneType 5 /Default 5 0 R /Black 5 0 R /Spot << /HalftoneType 1 /TransferFunction 4 0 R >> >> >>").is_empty());
|
||||
// Private application data isn't graphics resources.
|
||||
|
||||
Reference in New Issue
Block a user