Vai al contenuto principale
Ricetta numero 189

Ricettario · Capitolo 10 · Output e integrazione

Un quinto inchiostro per il colore aziendale

Quadricromia più un Pantone aziendale esatto: la tabella degli inchiostri riunisce su una lastra, PANTONE 286 C, ogni nome che prende il blu.

In questa pagina
  • Esempio in inglese: non c’è ancora un’edizione italiana
  • Formato 210 × 297 mm
  • 2 colonne, Intercolonna di 7 mm
  • Source Serif 4 9,6/13,2
  • Source Sans 3
  • 8 pagine
  • Livello
  • Postext 1.84.0
  • Impaginato in 145 ms
  • 298 righe di codice

In breve

Il bilancio annuale di una fondazione che cura un fiume, stampato con i soliti quattro inchiostri e un blu esatto che è il colore della fondazione. Ogni file chiama il blu in un altro modo, e il file di stampa lo mette tutto su una lastra.

Che cosa comporrai

Un bilancio annuale di otto pagine A4 per una fondazione inventata che risana un fiume, stampato in quadricromia più un quinto inchiostro, il suo blu aziendale. Il blu sta dove lo metterebbe un marchio: la fascia della copertina, la barra sopra ogni sezione, i titoli, le intestazioni delle tabelle, le barre del grafico e la quarta di copertina. I suoi retini al 40 % e al 12 % riempiono le barre del previsto, le righe dei totali e il riquadro delle cifre chiave, e si stampano come retini dello stesso inchiostro, mai come una miscela di quadricromia. Le fotografie e il testo restano in quadricromia. Il PDF/X-4 ha cinque lastre, e la quinta porta il nome con cui il tipografo tiene l’inchiostro, PANTONE 286 C, anche se nel progetto niente lo chiama così.

Questa ricetta risponde a

  • Come stampo un rapporto in quadricromia più il nostro Pantone aziendale, se ogni file chiama l’inchiostro in un altro modo?

La risposta breve

script.js · righe 20–37nel codice completo
// The corporate blue as each source named it: the designer's swatch, an older palette that
// wrote it without the space, and the chart, drawn in Spanish, which says 'Azul Cauce'. The
// tints are the same ink at 40 % and 12 %: no process mix stands in for them.
const BLUE = { c: 100, m: 75, y: 0, k: 0 }; // what the ink looks like at 100 %, for a proof
const spot = (hex, name, tint) => ({ hex, model: 'spot', spot: { name, cmyk: BLUE, tint } });
const palette = {
  ink: { hex: '#1c2129', model: 'hex' }, // text, in process black
  muted: { hex: '#5d6573', model: 'hex' },
  blue: spot('#0033a0', 'Brand Blue'),
  blue40: spot('#99add9', 'Pantone 286C', 40),
  blue12: spot('#e0e6f3', 'Brand Blue', 12),
  ochre: { hex: '#c98a1b', model: 'hex' }, // the one process accent: the second data series
  paper: { hex: '#ffffff', model: 'hex' },
};
// The ink table: the plate's name is the printer's, and every other name prints on it.
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra51', convertImages: false,
  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
    cmyk: BLUE }] };

Ingredienti

Tipo
Source Serif 4, Source Sans 3 (SIL OFL 1.1)
Risorse
  • director-800.jpg
  • kingfisher-1050.jpg
  • meander-1120.jpg
  • sample-900.jpg
  • volunteers-1200.jpg
  • The river from the air, on the cover (Generated With Diffusion Models, originale)
  • The director on the river bank (Generated With Diffusion Models, originale)
  • Volunteers planting willow stakes (Generated With Diffusion Models, originale)
  • A water sample at a gauging station (Generated With Diffusion Models, originale)
  • A kingfisher on a willow branch (Generated With Diffusion Models, originale)

Preparazione

#1 · Un inchiostro con tre nomi

Il codice è la risposta breve qui sopra. Il blu arriva nel bilancio con tre nomi, come accade nei lavori veri: il campione del grafico dice Brand Blue, una vecchia palette scriveva Pantone 286C per il retino al 40 %, e il grafico, disegnato dall’ufficio spagnolo, dice Azul Cauce. Senza tabella degli inchiostri ogni nome uscirebbe su una lastra propria, e il tipografo riceverebbe tre blu da miscelare. La voce della tabella degli inchiostri dà il nome alla lastra ed elenca gli altri nomi come alias; i nomi si confrontano senza badare a maiuscole e spazi, così ogni retino di ogni nome finisce sull’unica separazione PANTONE 286 C. Il suo cmyk è il colore alternativo che mostra una prova.

#2 · Il grafico nomina il suo inchiostro

script.js · righe 328–371nel codice completo
// Kilometres of bank restored each year: the bars in the blue (data-spot="Azul Cauce"), the
// plan in its 40 % tint, the labels in process black. An alias brings both onto the plate.
const YEARS = [[2021, 3.1, 4], [2022, 4.6, 5], [2023, 6.2, 6], [2024, 7.4, 8], [2025, 9.8, 9]];
function chartArt() {
  const [W, H, BASE, LEFT, MAX] = [84, 56, 46, 8, 12];
  const y = (v) => BASE - (v / MAX) * (BASE - 4);
  const lines = [0, 4, 8, 12].map((v) => `<path d="M${LEFT} ${y(v)}H${W}" stroke="#c4cad4" `
    + `stroke-width="0.2"/><text x="${LEFT - 1.5}" y="${y(v) + 1}" font-size="2.6" `
    + `text-anchor="end" fill="#5d6573">${v}</text>`).join('');
  const bars = YEARS.map(([year, done, plan], i) => {
    const x = LEFT + 3 + i * 15;
    return `<rect x="${x}" y="${y(plan)}" width="5" height="${BASE - y(plan)}" fill="#99add9" `
      + `data-spot="Azul Cauce" data-spot-tint="40"/><rect x="${x + 5.6}" y="${y(done)}" `
      + `width="5" height="${BASE - y(done)}" fill="#0033a0" data-spot="Azul Cauce"/>`
      + `<text x="${x + 5.3}" y="${BASE + 5}" font-size="2.8" text-anchor="middle" `
      + `fill="#1c2129">${year}</text>`;
  }).join('');
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${W * 10}" height="${H * 10}" `
    + `viewBox="0 0 ${W} ${H}" font-family="'Source Sans 3'">${lines}${bars}</svg>`;
}
// Where each euro went: one bar across the text block, the river in the full ink, schools in
// its 40 % tint, the running costs in process grey.
const SPENT = [[1520, '#0033a0', 100, t({ en: 'Work on the river', es: 'Obras en el río' })],
  [340, '#99add9', 40, t({ en: 'Schools', es: 'Escuelas' })],
  [180, '#9aa1ad', 0, t({ en: 'Running costs', es: 'Funcionamiento' })]];
function euroArt() {
  const [W, H] = [174, 22];
  const total = SPENT.reduce((sum, [v]) => sum + v, 0);
  let x = 0;
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${W * 10}" height="${H * 10}" `
    + `viewBox="0 0 ${W} ${H}" font-family="'Source Sans 3'">`
    + `${SPENT.map(([v, hex, tint, name], i) => {
      const w = (v / total) * W;
      const ink = tint ? ` data-spot="Azul Cauce" data-spot-tint="${tint}"` : '';
      const end = i === SPENT.length - 1; // the last label sets flush right, under its segment
      const tx = `x="${end ? W : x}" text-anchor="${end ? 'end' : 'start'}"`;
      const part = `<rect x="${x}" y="0" width="${w - 0.6}" height="10" fill="${hex}"${ink}/>`
        + `<text ${tx} y="15.5" font-size="3.2" font-weight="700" fill="#1c2129">`
        + `${Math.round((v / total) * 100)} %</text><text ${tx} y="20" font-size="2.8" `
        + `fill="#5d6573">${name}</text>`;
      x += w;
      return part;
    }).join('')}</svg>`;
}

Un SVG dice con data-spot su quale inchiostro si stampa un colore, e con data-spot-tint con quale intensità, in percentuale. Le barre del grafico nominano Azul Cauce al 100 % e al 40 %, e l’alias le mette sulla stessa lastra del resto del blu. Le linee della griglia e le etichette sono colori comuni e restano nel nero di quadricromia. La barra delle uscite nella pagina dei conti fa lo stesso con tre segmenti, il terzo un grigio di quadricromia.

#3 · Il blu regge il progetto

script.js · righe 55–73nel codice completo
const BAND = 172; // mm from the top of the bleed to the top of the blue band
const cover = { id: 'cover', numbered: false, toc: false, span: 'page',
  header: { elements: [] }, footer: { elements: [] },
  margins: { top: mm(0), bottom: mm(0), left: mm(0), right: mm(0) },
  advancedDesign: { enabled: true, minHeight: mm(TRIM_H), slot: { elements: [
    { kind: 'image', id: 'photo', resourceId: 'meander', fit: 'cover',
      placement: at('bleed', 'top-left', 0, 0, { width: 'fill', height: mm(BAND + 1) }) },
    { kind: 'box', id: 'band', style: { backgroundColor: col('blue') },
      placement: at('bleed', 'top-left', 0, BAND, { width: 'fill', height: mm(TRIM_H) }) },
    text('name', '{author}', label(10, col('paper')), at('page', 'top-left', 20, BAND + 14)),
    text('title', '{titleText}', { fontFamily: SANS, fontWeight: 800, fontSize: pt(46),
      lineHeight: 1, color: col('paper') }, at('#name', 'below', 0, 6, { width: mm(170) })),
    { kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(3), color: col('blue40'),
      placement: at('#title', 'below', 0, 7, { width: mm(24) }) },
    text('strap', '{attr.strap}', { fontFamily: 'Source Serif 4', italic: true, fontSize: pt(15),
      lineHeight: 1.3, color: col('paper') }, at('#rule', 'below', 0, 6, { width: mm(120) })),
    text('credit', '{attr.credit}', { fontFamily: SANS, fontSize: pt(7), color: col('blue40') },
      at('page', 'bottom-left', 20, -14, { width: mm(170) })),
  ] } } };

La foto di copertina riempie la parte alta dell’abbondanza con fit: 'cover', e un riquadro nel blu riempie il resto; il testo sopra è bianco e fa da risparmio nella lastra. Le barre di sezione, i piè di pagina e le intestazioni delle tabelle usano la stessa voce della palette, quindi cambiare inchiostro è una riga.

script.js · righe 315–324nel codice completo
// A row whose first cell is bold is a total: it takes the tint. Figures align right.
function tsvTable(tsv, columnWidths) {
  let m = Object.assign(parseTSV(tsv, { headerRows: 1 }), { columnWidths });
  m.rows.forEach((row, r) => row.forEach((_, c) => {
    if (c > 0) m = setAlignment(m, { row: r, col: c }, 'right', 'middle');
    if (r && row[0].content.startsWith('**')) m = setCellBackground(m, { row: r, col: c },
      col('blue12'));
  }));
  return m;
}

Le tabelle vengono da file TSV accanto al testo. Una riga con la prima cella in grassetto è un totale e prende il retino al 12 %; le cifre sono allineate a destra.

#4 · Le fotografie restano in RGB

convertImages: false nelle impostazioni di stampa lascia le fotografie come JPEG RGB con profilo sRGB, che PDF/X-4 ammette; il RIP del tipografo le separa. Il file resta leggero, e la lastra del blu non riceve nulla dalle foto.

La ricetta completa

Sandbox
// ═══ Postext Cookbook · Nº 189 · A fifth ink for the corporate colour ═══════════════════
// https://postext.dev/en/cookbook/corporate-fifth-ink-report
// Code: MIT · Text: original (CC BY 4.0) · Photographs: diffusion models
// Fonts: Source Serif 4, Source Sans 3 (SIL OFL 1.1) · Needs postext ≥ 1.84.0
//
// An annual report printed in four colours and one exact corporate blue. The palette, the
// chart and an older swatch call the blue by three names; the ink table gathers them on one
// plate named as the printer stocks the ink, PANTONE 286 C.
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, parseTSV, setCellBackground,
  setAlignment, inlineSvgFonts,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'corporate-fifth-ink-report';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region answer: one spot ink, three names: the ink table puts them on one plate
// The corporate blue as each source named it: the designer's swatch, an older palette that
// wrote it without the space, and the chart, drawn in Spanish, which says 'Azul Cauce'. The
// tints are the same ink at 40 % and 12 %: no process mix stands in for them.
const BLUE = { c: 100, m: 75, y: 0, k: 0 }; // what the ink looks like at 100 %, for a proof
const spot = (hex, name, tint) => ({ hex, model: 'spot', spot: { name, cmyk: BLUE, tint } });
const palette = {
  ink: { hex: '#1c2129', model: 'hex' }, // text, in process black
  muted: { hex: '#5d6573', model: 'hex' },
  blue: spot('#0033a0', 'Brand Blue'),
  blue40: spot('#99add9', 'Pantone 286C', 40),
  blue12: spot('#e0e6f3', 'Brand Blue', 12),
  ochre: { hex: '#c98a1b', model: 'hex' }, // the one process accent: the second data series
  paper: { hex: '#ffffff', model: 'hex' },
};
// The ink table: the plate's name is the printer's, and every other name prints on it.
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra51', convertImages: false,
  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
    cmyk: BLUE }] };
// #endregion
const col = (id) => ({ ...palette[id], paletteId: id });
const colorPalette = [...Object.entries(palette).map(([id, value]) => ({ id, name: id, value })),
  { id: 'main-color', name: 'blue (defaults)', value: palette.blue }];

const [TRIM_W, TRIM_H] = [210, 297]; // A4
const MARGIN = { top: 24, bottom: 24, inner: 20, outer: 16 };
const LEAD = 13.2; // pt
const SANS = 'Source Sans 3';
const at = (to, edge, x = 0, y = 0, size) => ({ anchor: { to, edge },
  offset: { x: mm(x), y: mm(y) }, ...(size && { size }) });

Lo script.js composto funziona così com’è: incollalo nello script modulo di qualsiasi pagina, oppure apri la ricetta su CodePen. Cartella della ricetta su GitHub ↗ (si apre in una nuova scheda)

Varianti

#Stampa il blu in quadricromia

Quando la macchina non ha un quinto gruppo, una parola nella tabella degli inchiostri stampa ogni retino del blu in CMYK a partire dal suo colore alternativo.

-  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
-    cmyk: BLUE }] };
+  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
+    cmyk: BLUE, output: 'process' }] };

#Dai alla lastra il nome di un altro tipografo

Alcuni tipografi vogliono la lastra con il loro nome. pdfName la rinomina e conserva gli alias.

-  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
+  inks: [{ name: 'PANTONE 286 C', pdfName: 'PANTONE 286 U', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],

Errori frequenti

  • Un colore di un’immagine che non nomina il suo inchiostro né coincide esattamente con una tinta piatta della palette resta in quadricromia, anche se sembra il blu. Marca gli elementi con data-spot, oppure dai alla palette una tinta piatta con quell’hex esatto.
  • Un nome di famiglia con una cifra, come Source Sans 3, va tra virgolette nel font-family di un SVG; senza virgolette il browser scarta la dichiarazione e compone le etichette in un graziato.

Crediti

Testo
Testo originale, CC BY 4.0
Immagini
  • The river from the air, on the cover · Generated With Diffusion Models · originale
  • The director on the river bank · Generated With Diffusion Models · originale
  • Volunteers planting willow stakes · Generated With Diffusion Models · originale
  • A water sample at a gauging station · Generated With Diffusion Models · originale
  • A kingfisher on a willow branch · Generated With Diffusion Models · originale
Font
Source Serif 4 (SIL OFL 1.1) · Source Sans 3 (SIL OFL 1.1)
SandboxPDF