# Un fanzine en negre i rosa fluorescent

> Una feina a dues planxes, negre i un rosa fluorescent: fotos en duotò, un negre que sobreimprimeix i un rosa que brilla a Folio.

- Versió HTML: https://postext.dev/ca/cookbook/fluorescent-pink-zine
- Recepta Núm. 190 · Sortida i integració · Nivell 3 (Avançat) · Sortides: Canvas, PDF
- Gèneres: Revistes i fanzins
- Requereix postext ≥ 1.84.0, postext-pdf ≥ 1.84.0 · provada amb 1.84.0, postext-pdf 1.84.0 el 2026-11-13
- Pàgines: [1](https://postext.dev/cookbook/fluorescent-pink-zine/es/p01.webp?v=7c6fb1e4), [2](https://postext.dev/cookbook/fluorescent-pink-zine/es/p02.webp?v=7c6fb1e4), [3](https://postext.dev/cookbook/fluorescent-pink-zine/es/p03.webp?v=7c6fb1e4), [4](https://postext.dev/cookbook/fluorescent-pink-zine/es/p04.webp?v=7c6fb1e4), [5](https://postext.dev/cookbook/fluorescent-pink-zine/es/p05.webp?v=7c6fb1e4), [6](https://postext.dev/cookbook/fluorescent-pink-zine/es/p06.webp?v=7c6fb1e4), [7](https://postext.dev/cookbook/fluorescent-pink-zine/es/p07.webp?v=7c6fb1e4), [8](https://postext.dev/cookbook/fluorescent-pink-zine/es/p08.webp?v=7c6fb1e4)
- PDF: https://postext.dev/cookbook/fluorescent-pink-zine/es/fluorescent-pink-zine.pdf?v=7c6fb1e4
- Obre al Sandbox: https://postext.dev/ca/sandbox#recipe=fluorescent-pink-zine&lang=es (.postext: https://postext.dev/cookbook/fluorescent-pink-zine/es/fluorescent-pink-zine.postext)
- Última actualització: 2026-11-13
- Altres idiomes: [en](https://postext.dev/en/cookbook/fluorescent-pink-zine.md), [es](https://postext.dev/es/cookbook/fluorescent-pink-zine.md), [de](https://postext.dev/de/cookbook/fluorescent-pink-zine.md), [fr](https://postext.dev/fr/cookbook/fluorescent-pink-zine.md), [it](https://postext.dev/it/cookbook/fluorescent-pink-zine.md), [pt](https://postext.dev/pt/cookbook/fluorescent-pink-zine.md), [zh](https://postext.dev/zh/cookbook/fluorescent-pink-zine.md), [ja](https://postext.dev/ja/cookbook/fluorescent-pink-zine.md), [ar](https://postext.dev/ar/cookbook/fluorescent-pink-zine.md)

## En poques paraules

Una revista petita de música impresa només amb dues tintes, negre i un rosa neó molt viu. Les fotos surten en negre i rosa, el rosa brilla a la vista 3D, i el fitxer d'impremta té exactament dues planxes.

## Què compondràs

El número 7 de *Pink Noise*, un fanzine de música inventat: vuit pàgines A5 grapades, impreses en una màquina de dos tambors. Un imprimeix negre i l'altre un rosa fluorescent, i res més no arriba al paper. El rosa compon el títol de la coberta, la franja de l'obertura de l'entrevista, les preguntes, la cita destacada i la contracoberta; un tint al 30 % omple la caixa de l'agenda. Les tres fotografies són originals en gris que s'imprimeixen en duotò, negre a les ombres i rosa als tons mitjans. Folio deixa el fanzine obert sobre una taula fosca, on el rosa destaca sobre el paper.

**Aquesta recepta respon a:**

- Com imprimeixo un fanzine només en negre i rosa fluorescent, amb les fotos en duotò?

## La resposta curta

```js
// script.js, línies 20–32
// The pink is a spot ink; the ink table says it is fluorescent, as the printer will be told.
// The screen paints its hex, Folio makes it stand brighter than the paper, and the PDF puts it
// on a plate of its own. The ink table also takes the name the poster files gave it.
const PINK = { name: 'PANTONE 806 C', cmyk: { c: 0, m: 77, y: 0, k: 0 } };
const pink = (hex, tint) => ({ hex, model: 'spot', spot: { ...PINK, tint } });
// The job prints these two plates and nothing else. Pictures print as duotones: each
// plate takes the grey of a pixel through its curve, [tone, ink] in percent.
const CURVES = { Black: [[0, 0], [45, 8], [100, 92]], // the shadows
  'PANTONE 806 C': [[0, 0], [35, 45], [70, 80], [100, 60]] }; // the middle tones
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra51',
  inks: [{ name: 'PANTONE 806 C', aliases: ['Fluo pink'], finish: { kind: 'fluorescent' } }],
  plates: { inks: ['Black', 'PANTONE 806 C'], images: ['Black', 'PANTONE 806 C'],
    curves: CURVES } };
```

## Ingredients

**Ensenya**

- [Tintes especials](https://postext.dev/ca/docs/special-inks-die-cuts.md#acabats): Una tinta plana amb acabat: metàl·lica, daurat en calent, fluorescent, blanc opac o vernís. S'imprimeix en una planxa pròpia, el canvas en pot mostrar la brillantor o un mapa d'acabats, i Folio la il·lumina.
- [Tintes planes i taula de tintes](https://postext.dev/ca/docs/configuration-pdf-output.md#tintes-planes): Un color amb model 'spot' s'imprimeix en una planxa pròpia, al seu percentatge. La taula de tintes anomena la planxa com la coneix l'impressor i aplega els altres noms que la paleta, els SVG i els fitxers importats donen a la mateixa tinta.

**També fa servir**

- [PDF en CMYK i en escala de grisos](https://postext.dev/ca/docs/configuration-fonts-colors-viewers.md#generació-de-pdf-configuració)
- [Visor de llibre en 3D (Folio)](https://postext.dev/ca/docs/configuration-html-folio-epub.md#un-llibre-en-3d-postext-folio)
- [Paper, enquadernació, taula i llum (Folio)](https://postext.dev/ca/docs/configuration-fonts-colors-viewers.md#visor-folio-configuració)
- [Paleta de color semàntica](https://postext.dev/ca/docs/configuration-fonts-colors-viewers.md#paleta-de-colors)
- [Cobertes, portades i colofons](https://postext.dev/ca/docs/configuration-styles.md#estils-dencapçalament)
- [Estils de títol](https://postext.dev/ca/docs/configuration-styles.md#estils-dencapçalament)
- [Obertures dissenyades](https://postext.dev/ca/docs/configuration-headings.md#extensió-i-disseny-avançat)
- [Textos, filets i caixes als dissenys de pàgina](https://postext.dev/ca/docs/configuration-headers-footers.md#capçaleres-i-peus)
- [Imatges als dissenys de pàgina](https://postext.dev/ca/docs/configuration-headers-footers.md#elements-dimatge)
- [Requadres](https://postext.dev/ca/docs/configuration-callouts.md#estils-de-requadre)
- [Figures i taules com a recursos](https://postext.dev/ca/docs/document-format-resources.md#recursos)
- [Exportació a PDF](https://postext.dev/ca/docs/configuration-pdf-output.md#generació-de-pdf)
- [Pàgines en un canvas](https://postext.dev/ca/docs/configuration-programmatic-usage.md#renderitzar-una-pàgina-en-un-mapa-de-bits)
- [Columnes en un requadre o al text](https://postext.dev/ca/docs/document-format-directives.md#columns)
- [Atributs de títol](https://postext.dev/ca/docs/document-format.md#atributs-dencapçalament)
- [Figures just aquí](https://postext.dev/ca/docs/document-format-resources.md#inserció-en-bloc-opcional-collocació-en-línia-explícita)
- [Banda de capítol d'amplada completa](https://postext.dev/ca/docs/configuration-headings.md#extensió-i-disseny-avançat)
- [Color del paper](https://postext.dev/ca/docs/configuration-page-layout.md#pàgina)
- [Fonts incrustades al PDF](https://postext.dev/ca/docs/configuration-pdf-output.md#per-què-un-proveïdor-de-fonts)
- [Tipus de recurs propis](https://postext.dev/ca/docs/configuration-resources.md#tipus-de-recurs)
- [Capçaleres per secció](https://postext.dev/ca/docs/configuration-styles.md#estils-dencapçalament)
- [Requadres a tota l'amplada](https://postext.dev/ca/docs/configuration-callouts.md#el-contenidor-callout)
- [Capítols sense número](https://postext.dev/ca/docs/configuration-styles.md#estils-dencapçalament)

**La configuració d'un cop d'ull**

- [`bodyText`](https://postext.dev/ca/docs/configuration-text.md#text-de-cos), [`calloutStyles`](https://postext.dev/ca/docs/configuration-callouts.md#estils-de-requadre), [`captionStyle`](https://postext.dev/ca/docs/configuration-resources.md#estil-dels-peus-de-recurs), [`colorPalette`](https://postext.dev/ca/docs/configuration-fonts-colors-viewers.md#paleta-de-colors), [`folio`](https://postext.dev/ca/docs/configuration-html-folio-epub.md#aspecte), [`footer`](https://postext.dev/ca/docs/configuration-headers-footers.md#capçaleres-i-peus), [`header`](https://postext.dev/ca/docs/configuration-headers-footers.md#capçaleres-i-peus), [`headingStyles`](https://postext.dev/ca/docs/configuration-styles.md#estils-dencapçalament), [`headings`](https://postext.dev/ca/docs/configuration-headings.md#encapçalaments), [`layout`](https://postext.dev/ca/docs/configuration-page-layout.md#disposició), [`locale`](https://postext.dev/ca/docs/configuration-language.md#partició-de-mots), [`page`](https://postext.dev/ca/docs/configuration-page-layout.md#pàgina), [`print`](https://postext.dev/ca/docs/configuration-fonts-colors-viewers.md#producció-per-a-impremta-configuració), [`resourceTypes`](https://postext.dev/ca/docs/configuration-resources.md#tipus-de-recurs), [`unorderedLists`](https://postext.dev/ca/docs/configuration-lists-math.md#llistes-amb-pics)

**API**

- [`buildDocumentWithFonts`](https://postext.dev/ca/docs/configuration-programmatic-usage.md#carregar-les-fonts-abans-de-compondre), [`createFolioFromDocument`](https://postext.dev/ca/docs/configuration-html-folio-epub.md#un-llibre-en-3d-postext-folio), [`decompressWoff2`](https://postext.dev/ca/docs/configuration-pdf-output.md#proveïdor-de-fonts-al-navegador-fontsource--woff2), [`registerResourceImage`](https://postext.dev/ca/docs/architecture.md#superfície-dapi), [`renderPageToCanvas`](https://postext.dev/ca/docs/configuration-programmatic-usage.md#renderitzar-una-pàgina-en-un-mapa-de-bits), [`renderToPdf`](https://postext.dev/ca/docs/configuration-pdf-output.md#generació-de-pdf)

**Tipus de lletra**

- Archivo Black (OFL-1.1), IBM Plex Sans (OFL-1.1), IBM Plex Mono (OFL-1.1)

## Elaboració

### 1 · Dues planxes, i el rosa és fluorescent

El codi és [la resposta curta](https://postext.dev/ca/cookbook/fluorescent-pink-zine.md#la-resposta-curta) de més amunt. `print.plates` anomena les planxes que imprimeix la feina, `Black` i `PANTONE 806 C`, i el PDF té aquestes dues separacions i cap altra ([impressió a dues tintes](https://postext.dev/ca/docs/configuration-pdf-output.md#tintes-planes)). El rosa és una tinta plana; el seu acabat va a la taula de tintes, com aniria a la comanda a la impremta, i la converteix en fluorescent: té una planxa pròpia i Folio la il·lumina més que el paper ([acabats](https://postext.dev/ca/docs/special-inks-die-cuts.md#acabats)). `images` posa les fotografies a les dues planxes, i `CURVES` dona forma a cadascuna: el negre només a les ombres, el rosa als tons mitjans i afluixant als foscos, perquè el rosa no embruti mai el negre.

### 2 · La pantalla també mostra el duotò

```js
// script.js, línies 280–305
// The PDF separates the grey original through CURVES. The screen would paint it grey, so the
// picture registered for the canvas and Folio is the same grey run through the same curves:
// the black over the pink, multiplied as inks lie on paper. The PDF still gets the original.
const ink = (curve, tone) => { // a curve read at a tone, both 0–1
  const i = curve.findIndex(([x]) => x / 100 >= tone);
  const [[x0, y0], [x1, y1]] = [curve[Math.max(0, i - 1)], curve[Math.max(0, i)]];
  return (x1 === x0 ? y1 : y0 + ((tone * 100 - x0) * (y1 - y0)) / (x1 - x0)) / 100;
};
const PINK_RGB = [0xff, 0x3e, 0xa5];
async function loadDuotone(fileId, url) {
  await loadImage(fileId, url); // the grey bytes, kept for the PDF
  const grey = await createImageBitmap(new Blob([imageBytes(fileId)]));
  const canvas = new OffscreenCanvas(grey.width, grey.height);
  const g = canvas.getContext('2d');
  g.drawImage(grey, 0, 0);
  const img = g.getImageData(0, 0, canvas.width, canvas.height);
  for (let i = 0; i < img.data.length; i += 4) {
    const tone = 1 - img.data[i] / 255;
    const [k, p] = [ink(CURVES.Black, tone), ink(CURVES['PANTONE 806 C'], tone)];
    for (let c = 0; c < 3; c++) {
      img.data[i + c] = 255 * (1 - k) * (1 - p * (1 - PINK_RGB[c] / 255));
    }
  }
  g.putImageData(img, 0, 0);
  registerResourceImage(fileId, canvas.transferToImageBitmap());
}
```

El canvas i Folio pinten una imatge tal com és el seu fitxer, de manera que una foto grisa s'hi veuria grisa, encara que s'imprimeixi en rosa i negre. La recepta registra una segona imatge per a la pantalla: el mateix gris llegit per les mateixes `CURVES`, el negre multiplicat sobre el rosa com se superposen les tintes al paper. El PDF continua rebent l'original gris, d'`imageBytes`, i el separa ell mateix.

### 3 · Negre sobre rosa

```js
// script.js, línies 60–74
const BAND = 134; // mm from the top of the bleed to the black band
const cover = { ...bare, id: 'cover', advancedDesign: { enabled: true, minHeight: mm(150),
  slot: { elements: [
    { kind: 'image', id: 'photo', resourceId: 'crowd', fit: 'cover', focus: { x: 0.35, y: 0.5 },
      placement: at('bleed', 'top-left', 0, 0, { width: 'fill', height: mm(BAND + 4) }) },
    { kind: 'box', id: 'band', style: { backgroundColor: col('black') },
      placement: at('bleed', 'top-left', 0, BAND + 3, { width: 'fill', height: mm(90) }) },
    text('issue', '{attr.issue}', label(8, col('pink')), at('page', 'top-left', 12, 12)),
    text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(70), lineHeight: 0.82,
      textTransform: 'uppercase', color: col('pink') },
    at('page', 'top-left', 10, BAND + 9, { width: mm(130) })),
    text('lines', '{attr.lines}', { fontFamily: SANS, fontWeight: 700, fontSize: pt(11),
      lineHeight: 1.25, color: col('paper') }, at('page', 'top-left', 12, BAND + 55,
      { width: mm(110) })),
  ] } } };
```

El negre és només la planxa K, definit com a color CMYK amb `overprint: true`. On la lletra negra o la franja negra de la coberta toquen el rosa, s'imprimeixen al damunt en lloc de calar-lo, i un plec que surti una mica fora de registre no mostra cap vora blanca. El títol rosa sí que cala el negre, com ha de fer la lletra sobre una franja fosca.

### 4 · Folio sobre una taula fosca

```js
// script.js, línies 119–125
const folio = {
  tilt: 22, yaw: -14,
  paper: { type: 'uncoated', grammage: 100, shade: '#ffffff' },
  binding: { type: 'saddleStitch', cover: 'pages' },
  surface: { type: 'plain', color: { hex: '#2b2b30', model: 'hex' } },
  lighting: { environment: 'overcast', intensity: 1.05 },
};
```

Una tinta fluorescent necessita una mica de foscor al voltant per llegir-se com a tal. El fanzine queda obert per l'entrevista sobre una superfície llisa i fosca, sota la llum plana d'un cel ennuvolat, i la franja rosa i el rosa de la foto destaquen sobre el paper blanc.

## La recepta completa

Un sol fitxer, compost a partir de la carpeta de la recepta amb el text d'exemple i el kit comú del Receptari ja inclosos; construeix la seva pròpia pàgina. Per executar-lo, posa'l en un `<script type="module">` d'una pàgina buida o enganxa'l al tauler JS d'un pen nou de CodePen (com a mòdul). Importa postext des d'esm.sh, així que no cal instal·lar ni compilar res.

- Carpeta de la recepta: https://github.com/drnachio/postext/tree/main/cookbook/fluorescent-pink-zine

### script.js

```js
// ═══ Postext Cookbook · Nº 190 · A zine in black and fluorescent pink ════════════════════
// https://postext.dev/en/cookbook/fluorescent-pink-zine
// Code: MIT · Text: original (CC BY 4.0) · Photographs: diffusion models
// Fonts: Archivo Black, IBM Plex Sans, IBM Plex Mono (SIL OFL 1.1) · Needs postext ≥ 1.84.0
//
// A music zine printed on two plates, black and a fluorescent pink. The pink is a spot ink
// with a fluorescent finish; the job prints those two plates and nothing else, so the grey
// photographs print as duotones and every other colour is projected onto the two inks.
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
import { createFolioFromDocument } from 'https://esm.sh/postext-folio';

const LANG = 'es'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'fluorescent-pink-zine';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region answer: two plates: black and a fluorescent pink that glows
// The pink is a spot ink; the ink table says it is fluorescent, as the printer will be told.
// The screen paints its hex, Folio makes it stand brighter than the paper, and the PDF puts it
// on a plate of its own. The ink table also takes the name the poster files gave it.
const PINK = { name: 'PANTONE 806 C', cmyk: { c: 0, m: 77, y: 0, k: 0 } };
const pink = (hex, tint) => ({ hex, model: 'spot', spot: { ...PINK, tint } });
// The job prints these two plates and nothing else. Pictures print as duotones: each
// plate takes the grey of a pixel through its curve, [tone, ink] in percent.
const CURVES = { Black: [[0, 0], [45, 8], [100, 92]], // the shadows
  'PANTONE 806 C': [[0, 0], [35, 45], [70, 80], [100, 60]] }; // the middle tones
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra51',
  inks: [{ name: 'PANTONE 806 C', aliases: ['Fluo pink'], finish: { kind: 'fluorescent' } }],
  plates: { inks: ['Black', 'PANTONE 806 C'], images: ['Black', 'PANTONE 806 C'],
    curves: CURVES } };
// #endregion
// Black is the K plate alone, and it overprints: on the pink it prints over the ink instead of
// knocking a hole that a sheet out of register would show as a white rim.
const palette = {
  black: { hex: '#1b1a1d', model: 'cmyk', cmyk: { c: 0, m: 0, y: 0, k: 100 }, overprint: true },
  pink: pink('#ff3ea5'),
  pink30: pink('#ffc5e4', 30),
  paper: { hex: '#ffffff', model: 'hex' },
};
const col = (id) => ({ ...palette[id], paletteId: id });
const colorPalette = [...Object.entries(palette).map(([id, value]) => ({ id, name: id, value })),
  { id: 'main-color', name: 'pink (defaults)', value: palette.pink }];

const [TRIM_W, TRIM_H] = [148, 210]; // A5, an A4 sheet folded once
const MARGIN = { top: 16, bottom: 18, inner: 14, outer: 12 };
const LEAD = 12.4; // pt
const [DISPLAY, SANS, MONO] = ['Archivo Black', 'IBM Plex Sans', 'IBM Plex Mono'];
const at = (to, edge, x = 0, y = 0, size) => ({ anchor: { to, edge },
  offset: { x: mm(x), y: mm(y) }, ...(size && { size }) });
const text = (id, content, look, placement) => ({ kind: 'text', id, content, align: 'left',
  overflow: 'wrap', placement, ...look });
const label = (size, color) => ({ fontFamily: MONO, fontWeight: 500, fontSize: pt(size),
  letterSpacing: pt(size * 0.12), textTransform: 'uppercase', color });
const bare = { numbered: false, toc: false, span: 'page', header: { elements: [] },
  footer: { elements: [] } };

// #region cover: the crowd over a black band, the title in pink on the black
const BAND = 134; // mm from the top of the bleed to the black band
const cover = { ...bare, id: 'cover', advancedDesign: { enabled: true, minHeight: mm(150),
  slot: { elements: [
    { kind: 'image', id: 'photo', resourceId: 'crowd', fit: 'cover', focus: { x: 0.35, y: 0.5 },
      placement: at('bleed', 'top-left', 0, 0, { width: 'fill', height: mm(BAND + 4) }) },
    { kind: 'box', id: 'band', style: { backgroundColor: col('black') },
      placement: at('bleed', 'top-left', 0, BAND + 3, { width: 'fill', height: mm(90) }) },
    text('issue', '{attr.issue}', label(8, col('pink')), at('page', 'top-left', 12, 12)),
    text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(70), lineHeight: 0.82,
      textTransform: 'uppercase', color: col('pink') },
    at('page', 'top-left', 10, BAND + 9, { width: mm(130) })),
    text('lines', '{attr.lines}', { fontFamily: SANS, fontWeight: 700, fontSize: pt(11),
      lineHeight: 1.25, color: col('paper') }, at('page', 'top-left', 12, BAND + 55,
      { width: mm(110) })),
  ] } } };
// #endregion

// #region feature: a photograph to the head of the page, the title in black on a pink band
const feature = { ...bare, id: 'feature', span: 'page', advancedDesign: { enabled: true,
  minHeight: mm(128), slot: { elements: [
    { kind: 'image', id: 'photo', resourceId: '{attr.photo}', fit: 'cover',
      placement: at('bleed', 'top-left', 0, 0, { width: 'fill', height: mm(96) }) },
    { kind: 'box', id: 'band', style: { backgroundColor: col('pink') },
      placement: at('bleed', 'top-left', 0, 93, { width: 'fill', height: mm(36) }) },
    text('kicker', '{attr.kicker}', label(7.5, col('black')), at('page', 'top-left', 12, 98)),
    text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(21), lineHeight: 1,
      textTransform: 'uppercase', color: col('black') },
    at('#kicker', 'below', 0, 2, { width: mm(124) })),
  ] } } };
// #endregion

// An ordinary section: a pink kicker over a black title.
const opener = { enabled: true, minHeight: mm(26), slot: { elements: [
  text('kicker', '{attr.kicker}', label(7.5, col('pink')), at('container', 'top-left')),
  text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(22), lineHeight: 1,
    textTransform: 'uppercase', color: col('black') },
  at('#kicker', 'below', 0, 1.5, { width: mm(122) })),
] } };

// The back cover: a pink flood to the bleed, the colophon over it in black.
const back = { ...bare, id: 'back', breakBefore: { enabled: true, parity: 'even' },
  advancedDesign: { enabled: true, minHeight: mm(150), slot: { elements: [
    { kind: 'box', id: 'flood', style: { backgroundColor: col('pink') },
      placement: at('bleed', 'top-left', 0, 0, { width: 'fill', height: 'fill' }) },
    text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(40), lineHeight: 0.85,
      textTransform: 'uppercase', color: col('black') }, at('page', 'top-left', 12, 120,
      { width: mm(120) })),
    text('colophon', '{attr.colophon}', { fontFamily: SANS, fontSize: pt(8), lineHeight: 1.35,
      color: col('black') }, at('#title', 'below', 0, 6, { width: mm(100) })),
  ] } } };

const footer = { elements: [
  text('folio', '{pageNumber}  ·  {title}', { ...label(6.5, col('black')), parity: 'even' },
    at('page', 'bottom-left', MARGIN.outer, -10)),
  text('folio-r', '{chapterTitle}  ·  {pageNumber}', { ...label(6.5, col('black')),
    parity: 'odd', align: 'right' }, at('page', 'bottom-right', -MARGIN.outer, -10)),
] };

// #region folio: a saddle-stitched zine on a dark table under a dim, flat light
const folio = {
  tilt: 22, yaw: -14,
  paper: { type: 'uncoated', grammage: 100, shade: '#ffffff' },
  binding: { type: 'saddleStitch', cover: 'pages' },
  surface: { type: 'plain', color: { hex: '#2b2b30', model: 'hex' } },
  lighting: { environment: 'overcast', intensity: 1.05 },
};
// #endregion

const config = () => ({
  locale: t({ en: 'en-gb', es: 'es' }),
  colorPalette,
  page: { sizePreset: 'custom', width: mm(TRIM_W), height: mm(TRIM_H), dpi: 150,
    backgroundColor: col('paper'), margins: { top: mm(MARGIN.top), bottom: mm(MARGIN.bottom),
      left: mm(MARGIN.inner), right: mm(MARGIN.outer), mirror: true } },
  layout: { layoutType: 'double', gutterWidth: mm(5) },
  bodyText: { fontFamily: SANS, fontSize: pt(8.8), lineHeight: pt(LEAD), color: col('black'),
    boldColor: col('black'), italicColor: col('black'), referenceColor: col('black'),
    textAlign: 'left', firstLineIndent: mm(3), indentAfterHeading: false,
    hyphenation: { enabled: true }, avoidWidows: true, avoidOrphans: true },
  headings: { fontFamily: SANS, fontWeight: 700, color: col('black'), levels: [
    { level: 1, span: 'page', breakBefore: { enabled: true, parity: 'any' },
      advancedDesign: opener },
    { level: 2, fontSize: pt(8.8), lineHeight: pt(LEAD), color: col('pink'),
      marginTop: pt(LEAD), marginBottom: pt(0) }] },
  headingStyles: [cover, feature, back],
  calloutStyles: [{ id: 'quote', background: col('pink'), marginTop: pt(LEAD),
    marginBottom: pt(LEAD), padding: { top: mm(3), right: mm(3), bottom: mm(3), left: mm(3) },
    body: { fontFamily: DISPLAY, fontSize: pt(13), lineHeight: pt(15), color: col('black'),
      textTransform: 'uppercase', textAlign: 'left', firstLineIndent: pt(0) } },
  { id: 'gigs', background: col('pink30'), columnGap: mm(4), marginTop: pt(LEAD),
    marginBottom: pt(LEAD),
    padding: { top: mm(5), right: mm(4), bottom: mm(5), left: mm(4) },
    body: { fontFamily: SANS, fontSize: pt(9.6), lineHeight: pt(14), color: col('black'),
      boldColor: col('black'), textAlign: 'left', firstLineIndent: pt(0) } }],
  unorderedLists: { bulletChar: '+', color: col('pink'), marginTop: pt(0), marginBottom: pt(0) },
  captionStyle: { fontFamily: MONO, fontSize: pt(6.5), color: col('black'), gap: mm(1.5) },
  print: PRINT,
  header: { elements: [] }, footer, folio,
});

// ─── 2 · Content ────────────────────────────────────────────────────────────
const markdown = String.raw`---
title: "Pink Noise"
author: "Pink Noise"
---

# Pink Noise {style="cover" issue="Nº 7 · Primavera 2026 · Gratis" lines="Lena Ros, de Hollín: tres acordes y un ampli prestado · La pared de carteles del Lavadero · Todos los conciertos hasta junio"}

# Hola otra vez {kicker="Editorial"}

Siete números, y este es el primero impreso a dos tintas. La copistería de la calle Ancha compró en enero una máquina de dos tambores de segunda mano, y la dueña dijo que nos tiraría una prueba a precio de coste si prometíamos no pedirle oro. Así que: negro, y un rosa que parece un subrayador olvidado al sol. Con las luces de un bar, brilla. Levántalo y mira.

La escena tuvo un invierno raro. El Lavadero perdió la licencia seis semanas por el ruido, dos grupos se separaron y tres nuevos dieron sus primeros conciertos en un garaje del polígono porque no había otro sitio. Luego volvió la licencia, el garaje siguió abriendo los domingos, y marzo fue el mes con más conciertos desde que empezamos a contarlos.

Este número va de la gente que lo mantuvo en marcha. Lena Ros, de Hollín, cuenta cómo aprendió a tocar con una guitarra de cinco cuerdas y un ampli que le prestó su tío. Recorrimos el callejón de detrás del Lavadero, donde cada cartel desde 2019 sigue en la pared bajo los nuevos. Y la agenda llega hasta junio, la más larga que hemos impreso.

Como siempre, el fanzine es gratis, lo hacen cuatro personas en la mesa de una cocina, y cualquiera puede mandarnos una crítica, una foto o una queja. La dirección está en la contraportada.

## En este número

- Tres acordes y un ampli prestado: entrevista con Lena Ros
- La pared: siete años de carteles detrás del Lavadero
- Todos los conciertos hasta junio

# Tres acordes y un ampli prestado {style="feature" photo="guitarist" kicker="Entrevista · Lena Ros, Hollín"}

Hollín han dado once conciertos, han sacado una casete y la han agotado dos veces. Su guitarrista y cantante, Lena Ros, tiene diecinueve años. Quedamos con ella en el bar de enfrente del Lavadero un martes de lluvia.

## ¿Cómo empezó Hollín?

Con una guitarra de cinco cuerdas. Era de mi tío, y me prestó también el ampli, con la condición de devolvérselo cuando tuviera uno mío. Todavía lo tengo. Aprendí tres acordes en un vídeo y esa misma noche escribí una canción con ellos. Era horrible. La segunda fue menos horrible.

## ¿Quién más está en el grupo?

Iker a la batería, al que conocí en el instituto porque aporreaba todos los pupitres, y Sara al bajo, que contestó a una nota que dejé en la tienda de discos. En su respuesta decía que tenía un bajo pero que nunca lo había tocado. No pasaba nada. Yo, en realidad, tampoco.

:::callout{type="quote"}
Fuimos malos un año y a nadie le importó. Para eso está una escena.
:::

## ¿Cómo fue el primer concierto?

Duró doce minutos. Tocamos seis canciones, dos de ellas dos veces porque se nos olvidó que ya las habíamos tocado. Había unas treinta personas, todas amigas, así que pidieron otra, y no teníamos más. Volvimos a tocar la primera.

## ¿Por qué casetes?

Porque una casete nos cuesta un euro y la gente la guarda. Nadie guarda un enlace. La grabamos en el salón de la abuela de Sara un domingo que ella estaba en casa de su hermana, con mantas en las ventanas. En la tercera canción se oye el reloj.

## ¿Qué le falta a la escena?

Un sitio donde tocar un miércoles, para grupos que todavía no son buenos. Ahora todo es en viernes, y un viernes tienes que vender entradas. Fuimos malos un año, el Lavadero nos dejó tocar igual y a nadie le importó. Para eso está una escena: para ser malo delante de la gente hasta que dejas de serlo.

## ¿Y ahora qué?

Una segunda casete en mayo, y un concierto en otro pueblo, que sería el primero. Todavía no sabemos cuál. Cualquiera que tenga autobús de vuelta.

# La pared {kicker="Escena"}

::resource{id="posters"}

Detrás del Lavadero hay un callejón que no tiene nombre en el mapa. Todo el mundo lo llama la pared. Desde que abrió la sala en 2019, cada grupo que ha tocado allí ha pegado un cartel en los ladrillos entre la puerta de atrás y los contenedores, y nadie ha arrancado nunca ninguno.

Así que la pared es un archivo. Bajo los carteles de los conciertos de esta primavera están los del otoño pasado, y debajo los del año anterior, hasta el primero: una fotocopia para un grupo llamado Lunes que tocó ante diecinueve personas un lunes de octubre de 2019. Una esquina se ve todavía junto al bajante, si sabes dónde mirar.

El engrudo es harina y agua, cocido en el fogón de la sala. Los carteles son casi todos fotocopias, algunos serigrafías, y uno, de un concierto que nunca se celebró, se pintó directamente en la pared en 2022 y desde entonces lo han tapado once veces. Cuando llueve se despegan las capas de arriba y los nombres viejos vuelven una semana.

El ayuntamiento ha pedido dos veces a los dueños que la limpien. Las dos veces han dicho que lo pensarían. Esperamos que sigan pensándolo.

# Todos los conciertos hasta junio {kicker="Agenda"}

:::callout{type="gigs" span="page"}
:::columns{count=3 breaks="6,11"}
**Abril**

- **Vie 3** · Hollín, Ciervo · el Lavadero, 21:00, 6 €
- **Sáb 11** · Las Bajas, Polvo Fino · Garaje 4, 20:00, gratis
- **Mié 15** · Escenario abierto, cualquier grupo · el Lavadero, 20:30, gratis
- **Vie 24** · Marea Roja, Lunes (reunión) · el Lavadero, 21:00, 8 €

**Mayo**

- **Sáb 2** · Noche de casete: presentación de Hollín · Sala Norte, 21:00, 7 €
- **Dom 10** · Matinal: tres grupos nuevos · Garaje 4, 18:00, gratis
- **Mié 20** · Escenario abierto · el Lavadero, 20:30, gratis
- **Vie 29** · Polvo Fino, Los Grillos · el Lavadero, 21:00, 6 €

**Junio**

- **Vie 5** · Feria de verano: ocho grupos junto al río · Paseo del Río, 17:00, gratis
- **Mié 17** · Escenario abierto · el Lavadero, 20:30, gratis
- **Sáb 27** · Fiesta Pink Noise, sale el número 8 · el Lavadero, 21:00, 5 €
:::
:::

Los escenarios abiertos de los miércoles son nuevos esta primavera, y son lo que pedía Lena. Cualquier grupo puede tocar tres canciones; apúntate en la barra antes de las nueve. Trae tus cables.

La agenda es gratis. Mándanos la fecha, los grupos, el sitio, la hora y el precio antes del día uno de cada mes, y lo publicamos si hay hueco. Siempre hay hueco.

# Lo que sonó esta primavera {kicker="Críticas"}

## Hollín, *Cinta uno* (casete, autoeditada)

Ocho canciones en diecinueve minutos, grabadas en un salón con mantas en las ventanas, y se nota, para bien. Lena Ros canta como si le hubieran apagado el micro y quisiera que la oyeran igual. «Cinco cuerdas» es la que todo el mundo corea en los conciertos; «Reloj» es la tranquila, y se oye el reloj. Agotada dos veces. Prometen una tercera tirada en mayo.

## Polvo Fino, en directo en Garaje 4, 8 de marzo

En el garaje caben sesenta si nadie trae la bici. Polvo Fino tocaron ante unos ochenta, con la puerta abierta al aparcamiento y el hermano del batería sujetando el pie del platillo en las tres últimas. Canciones nuevas, más lentas y largas que las del año pasado, y mejores. La bajista ha empezado a cantar, y debería seguir.

## Marea Roja, *Lejos* (single de siete pulgadas)

El primer vinilo de alguien del pueblo en años, una tirada de 150 en rosa, cómo no. La cara A es la canción con la que cierran; la B, una versión de una canción que nadie supo nombrar, y la funda no lo dice. Voló en un fin de semana. Pregunta en la tienda de discos: guardaron cinco.

## Escenario abierto en el Lavadero, 18 de marzo

El primer escenario abierto de un miércoles, y se apuntaron nueve grupos. Tres no habían tocado nunca en ningún sitio. Uno tocó la misma canción tres veces, y a nadie le importó.

# Pink Noise {style="back" colophon="Pink Noise lo hacen cuatro personas en la mesa de una cocina y se imprime en negro y rosa flúor en una máquina de dos tambores de la copistería de la calle Ancha. Gratis, número 7, primavera 2026. Escríbenos a hola@pinknoise.example. Pink Noise, el Lavadero y cada grupo y persona que aparece en él son inventados. Fotografías generadas con modelos de difusión."}
`; // content.<lang>.md, inlined by the Cookbook

// #region duotone: the screen shows each photograph as the two plates will print it
// The PDF separates the grey original through CURVES. The screen would paint it grey, so the
// picture registered for the canvas and Folio is the same grey run through the same curves:
// the black over the pink, multiplied as inks lie on paper. The PDF still gets the original.
const ink = (curve, tone) => { // a curve read at a tone, both 0–1
  const i = curve.findIndex(([x]) => x / 100 >= tone);
  const [[x0, y0], [x1, y1]] = [curve[Math.max(0, i - 1)], curve[Math.max(0, i)]];
  return (x1 === x0 ? y1 : y0 + ((tone * 100 - x0) * (y1 - y0)) / (x1 - x0)) / 100;
};
const PINK_RGB = [0xff, 0x3e, 0xa5];
async function loadDuotone(fileId, url) {
  await loadImage(fileId, url); // the grey bytes, kept for the PDF
  const grey = await createImageBitmap(new Blob([imageBytes(fileId)]));
  const canvas = new OffscreenCanvas(grey.width, grey.height);
  const g = canvas.getContext('2d');
  g.drawImage(grey, 0, 0);
  const img = g.getImageData(0, 0, canvas.width, canvas.height);
  for (let i = 0; i < img.data.length; i += 4) {
    const tone = 1 - img.data[i] / 255;
    const [k, p] = [ink(CURVES.Black, tone), ink(CURVES['PANTONE 806 C'], tone)];
    for (let c = 0; c < 3; c++) {
      img.data[i + c] = 255 * (1 - k) * (1 - p * (1 - PINK_RGB[c] / 255));
    }
  }
  g.putImageData(img, 0, 0);
  registerResourceImage(fileId, canvas.transferToImageBitmap());
}
// #endregion

const photo = (id, [w, h], altText, extra) => ({ id, typeId: 'photo', kind: 'bitmap',
  createdAt: 0, updatedAt: 0, bitmap: { fileId: `${id}.jpg`, format: 'jpeg', width: w,
    height: h }, altText, ...extra });
const resourceTypes = [{ id: 'photo', name: '', captionPrefix: '', numberingTemplate: '' }];
const resources = [
  photo('crowd', [900, 600], t({ en: 'A crowd with raised arms in front of a singer in a low '
    + 'basement.', es: 'Un público con los brazos en alto ante un cantante en un sótano bajo.' })),
  photo('guitarist', [600, 750], t({ en: 'A young guitarist on a small stage under fairy '
    + 'lights.', es: 'Un guitarrista joven en un escenario pequeño bajo unas luces.' })),
  photo('posters', [560, 700], t({ en: 'A wet alley at night, its brick wall layered with torn '
    + 'posters.', es: 'Un callejón mojado de noche, con la pared cubierta de carteles rotos.' }),
  { placement: { position: 'top' }, caption: t({ en: 'The wall behind the Lavadero, March.',
    es: 'La pared de detrás del Lavadero, en marzo.' }) }),
];
await Promise.all([loadDuotone('crowd.jpg', asset('crowd-900.jpg')),
  loadDuotone('guitarist.jpg', asset('guitarist-600.jpg')),
  loadDuotone('posters.jpg', asset('posters-560.jpg'))]);

// ─── 3 · Fonts ──────────────────────────────────────────────────────────────
const FONTS = { 'Archivo Black': ['400'], 'IBM Plex Sans': ['400', '400i', '700'],
  'IBM Plex Mono': ['500'] };

// ─── 4 · Build & show ───────────────────────────────────────────────────────
const doc = await buildDocumentWithFonts({ markdown, resources }, { ...config(), resourceTypes },
  kitFonts(FONTS));
showPages(doc, { title: t({ en: 'Pink Noise · a zine in black and fluorescent pink',
  es: 'Pink Noise · un fanzine en negro y rosa flúor' }) });
offerPdf(() => renderToPdf(doc, { fontProvider: fontsourceProvider, resourceBytes: imageBytes,
  profileBaseUrl: 'https://postext.dev/icc/' }), `${RECIPE}.pdf`);

// The zine in the hand, under a dim light where the pink stands out from the paper.
const stage = document.createElement('section');
stage.id = 'folio';
stage.ariaLabel = t({ en: 'The zine in 3D', es: 'El fanzine en 3D' });
stage.style.cssText = 'height: min(78vh, 720px); margin: 0 auto; max-width: 1280px';
document.getElementById('pages').before(stage);
createFolioFromDocument(stage, doc, { at: 2, // open at the interview
  appearance: { textureBaseUrl: 'https://postext.dev/folio/textures' } });

// ─── Kit ── helpers shared by every Cookbook recipe · postext.dev/cookbook ─────

// ─── Kit · core v1 ── the same in every recipe · postext.dev/cookbook
function mm(value) { return { value, unit: 'mm' }; }
function pt(value) { return { value, unit: 'pt' }; }
function em(value) { return { value, unit: 'em' }; }
/** The sample language's string: t({ en: 'Figure', es: 'Figura' }). */
function t(strings) { return strings[LANG] ?? Object.values(strings)[0]; }
/** A file in this recipe's assets folder, served from the Postext repo by jsDelivr. */
function asset(file) { return `https://cdn.jsdelivr.net/gh/drnachio/postext@main/cookbook/${RECIPE}/assets/${file}`; }

// ─── Kit · fonts v3 ── the same in every recipe · postext.dev/cookbook
// Postext loads the faces a config asks for before layout and asks the kit
// for Fontsource's files, the ones the PDF embeds too.

/** buildDocumentWithFonts' options: the resolver, and FONTS' faces loaded
 *  with the config's. FONTS = { 'Family Name': ['400', '400i', '700'] }. */
function kitFonts(FONTS = {}) {
  const faces = Object.entries(FONTS).flatMap(([family, specs]) => specs.map((spec) =>
    ({ family, weight: parseInt(spec, 10), style: spec.endsWith('i') ? 'italic' : 'normal' })));
  return { resolve: fontsourceResolver, faces };
}

/** A face's files with their ranges: latin, then latin-ext and greek when
 *  `text` needs them (kitSubsetsFor). Null for a face Fontsource lacks. */
async function fontsourceResolver(family, weight, style, { text = '' } = {}) {
  const id = fontsourceId(family);
  const meta = await fontsourceMeta(family);
  if (meta && !(await fontsourceWeights(family, style)).includes(weight)) return null;
  kitStatus('Loading fonts…');
  const at = await fontsourceAt(id);
  return ['latin', ...kitSubsetsFor(text, meta)].map((subset) => ({
    source: `${at}files/${id}-${subset}-${weight}-${style}.woff2`,
    unicodeRange: kitRanges()[subset],
  }));
}

/** Each file's unicode-range (a function: the kit runs after the pen's code). */
function kitRanges() {
  return {
    latin: 'U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,'
      + 'U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD',
    'latin-ext': 'U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,'
      + 'U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF',
    greek: 'U+0370-03FF',
  };
}

/** For the cjk, arabic and comics blocks: loads `faces` (as FONTS) for the
 *  sample `text`; `optional` skips a face Fontsource lacks. Files are added in
 *  the order asked, the last winning a shared character. Resolves to the count. */
async function loadFonts(faces, text = '', { optional = false } = {}) {
  kitStatus('Loading fonts…');
  const ranges = kitRanges();
  const jobs = [];
  for (const [family, specs] of Object.entries(faces)) {
    const id = fontsourceId(family);
    const todo = [...new Set(specs)].map((spec) => [parseInt(spec, 10), spec.endsWith('i') ? 'italic' : 'normal'])
      .filter(([weight, style]) => !hasFace(family, weight, style)); // before any await
    const at = fontsourceAt(id);
    const meta = optional || /[^\0-ÿ]/u.test(text) ? await fontsourceMeta(family) : null;
    const subsets = ['latin', ...kitSubsetsFor(text, meta)];
    for (const [weight, style] of todo) {
      if (optional && !(meta && (await fontsourceWeights(family, style)).includes(weight))) continue;
      for (const subset of subsets) {
        const url = `${await at}files/${id}-${subset}-${weight}-${style}.woff2`;
        const face = new FontFace(family, `url(${url}) format('woff2')`,
          { weight: String(weight), style, unicodeRange: ranges[subset] });
        jobs.push(face.load().catch(() => {
          if (subset === 'latin' && !optional) throw new Error(`Fontsource has no ${family} ${weight} ${style}`);
        }));
      }
    }
  }
  const ready = await Promise.all(jobs).catch((error) => { kitFail(error); throw error; });
  return ready.filter((face) => face && document.fonts.add(face)).length;
}

/** A loaded FontFace covers this face (fonts.check() says yes to any family). */
function hasFace(family, weight, style) {
  for (const face of document.fonts) {
    if (face.status !== 'loaded' || face.style !== style) continue;
    if (face.family.replace(/^["']|["']$/g, '') !== family) continue;
    const [low, high = low] = face.weight.split(' ').map(Number);
    if (weight >= low && weight <= high) return true;
  }
  return false;
}

/** The files beyond latin `text` needs that `meta`'s family ships. */
function kitSubsetsFor(text, meta) {
  return [[/[Ā-˿ᴀ-ᶿḀ-ỿ†ℓⱠ-Ɀ꜠-ꟿ]/u, 'latin-ext'], [/[Ͱ-Ͽ]/u, 'greek']]
    .filter(([re, x]) => re.test(text) && meta?.subsets?.includes(x)).map(([, x]) => x);
}

/** Fontsource's id for a family: 'Source Serif 4' → 'source-serif-4'. */
function fontsourceId(family) { return family.toLowerCase().replace(/\s+/g, '-'); }

/** A package's folder at the one version @5 names now (#766). */
function fontsourceAt(id, u = `https://cdn.jsdelivr.net/npm/@fontsource/${id}@`) {
  return (fontsourceAt.c ??= {})[id] ??= fetch(u + '5/package.json').then((r) => r.json())
    .then((p) => p.version || 5, () => 5).then((v) => `${u}${v}/`);
}

/** The family's Fontsource metadata (weights, styles, subsets), or null. */
function fontsourceMeta(family, id = fontsourceId(family)) {
  return (fontsourceMeta.c ??= {})[id] ??= fetch(`https://api.fontsource.org/v1/fonts/${id}`)
    .then((res) => (res.ok ? res.json() : null), () => null);
}

/** The weights the package ships in `style`: the API pairs none (no Libre
 *  Caslon 700 italic file), so italics are read from latin-italic.css. */
function fontsourceWeights(family, style, id = fontsourceId(family)) {
  return (fontsourceWeights.c ??= {})[id + style] ??= fontsourceMeta(family).then(async (m) => {
    if (!m?.styles.includes(style)) return m ? [] : [400, 700];
    const css = style === 'italic' ? await fetch(`${await fontsourceAt(id)}latin-italic.css`).then((r) => (r.ok ? r.text() : ''), () => '') : '';
    const w = [...css.matchAll(/weight: (\d+)/g)].map((x) => +x[1]);
    return w.length ? w : m.weights;
  });
}

// ─── Kit · viewer v2 ── the same in every recipe · postext.dev/cookbook
/** The pages as spreads on a dark desk, page 1 alone, then verso | recto,
 *  each painted when it scrolls near. Other options go to renderPageToCanvas. */
function showPages(docs, { title, width = 460, ...render } = {}) {
  const root = viewer(title);
  const pages = [docs].flat().flatMap((doc) =>
    doc.pages.map((page) => ({ doc, page, n: (doc.pageIndexOffset ?? 0) + page.index })));
  const spreads = [];
  let verso = null;
  for (const p of pages) {
    if (p.n % 2 === 1) { if (verso) spreads.push([verso, null]); verso = p; }
    else { spreads.push([verso, p]); verso = null; }
  }
  if (verso) spreads.push([verso, null]);
  const density = Math.min(window.devicePixelRatio || 1, 2);
  showPages.painter?.disconnect();
  const painter = new IntersectionObserver((entries) => {
    for (const { isIntersecting, target } of entries) {
      if (!isIntersecting) continue;
      painter.unobserve(target);
      const { doc, page } = target.postext;
      renderPageToCanvas(page, doc, target, { ...render, scale: (width * density) / page.width });
    }
  }, { rootMargin: '800px' });
  showPages.painter = painter;
  root.replaceChildren(...spreads.map((pair) => {
    const spread = document.createElement('div');
    spread.className = 'pt-spread';
    for (const p of pair) {
      const figure = document.createElement('figure');
      if (p) {
        const label = p.page.pageLabel || String(p.n + 1);
        const canvas = document.createElement('canvas');
        canvas.postext = p;
        canvas.style.aspectRatio = `${p.page.width} / ${p.page.height}`;
        canvas.setAttribute('role', 'img');
        canvas.setAttribute('aria-label', `Page ${label}`);
        const folio = document.createElement('figcaption');
        folio.textContent = label;
        figure.append(canvas, folio);
        painter.observe(canvas);
      } else figure.className = 'pt-blank';
      spread.append(figure);
    }
    return spread;
  }));
  kitStatus(`${pages.length} ${pages.length === 1 ? 'page' : 'pages'}`);
  document.documentElement.dataset.postext = 'ready';
  return pages.length;
}

/** The desk, the bar and the error reporting, created once. */
function viewer(title) {
  if (!document.getElementById('pt-kit')) {
    document.head.insertAdjacentHTML('beforeend', `<style id="pt-kit">
      :root { color-scheme: dark; }
      body { margin: 0; background: #0e1014; color: #b9bcc4; font: 13px/1.45 system-ui, sans-serif; }
      #pt-bar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center;
        gap: 6px 16px; padding: 10px 16px; background: rgb(14 16 20 / .92); backdrop-filter: blur(6px);
        border-bottom: 1px solid #23262d; }
      #pt-bar strong { color: #f4f1ea; font-weight: 600; }
      #pt-actions { display: flex; gap: 12px; margin-left: auto; }
      #pt-actions a, #pt-actions button { color: #d8a21a; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
      #pages { display: grid; justify-items: center; gap: 48px; padding: 32px 16px 72px; }
      .pt-spread { display: flex; }
      .pt-spread figure { margin: 0; width: min(460px, 44vw); }
      .pt-spread canvas { display: block; width: 100%; background: #fff;
        box-shadow: 0 1px 2px rgb(0 0 0 / .5), 0 22px 44px -16px rgb(0 0 0 / .8); }
      .pt-spread figure:first-child canvas { box-shadow: inset -14px 0 14px -14px rgb(0 0 0 / .18), 0 1px 2px rgb(0 0 0 / .5), 0 22px 44px -16px rgb(0 0 0 / .8); }
      .pt-spread figcaption { margin-top: 10px; text-align: center; font: 600 10px/1 system-ui, sans-serif;
        letter-spacing: .18em; text-transform: uppercase; color: #6c7079; }
      .pt-blank { visibility: hidden; }
      @media (max-width: 760px) {
        .pt-spread { flex-direction: column; gap: 32px; }
        .pt-spread figure { width: min(460px, 92vw); }
        .pt-blank { display: none; }
      }
    </style>`);
    document.body.insertAdjacentHTML('afterbegin',
      '<header id="pt-bar"><strong id="pt-title"></strong><span id="pt-status" role="status"></span><span id="pt-actions"></span></header>');
    document.getElementById('pt-title').textContent = document.title || 'Postext';
    addEventListener('error', (event) => kitFail(event.error ?? event.message));
    addEventListener('unhandledrejection', (event) => kitFail(event.reason));
  }
  if (title) document.getElementById('pt-title').textContent = title;
  return document.getElementById('pages')
    ?? document.body.appendChild(Object.assign(document.createElement('main'), { id: 'pages' }));
}

function kitStatus(text) {
  viewer();
  document.getElementById('pt-status').textContent = text;
}

function kitFail(error) {
  document.documentElement.dataset.postext = 'error';
  kitStatus(`Error: ${error?.message ?? error}`);
}

// ─── Kit · pdf v3 ── the same in every recipe that exports a PDF
/** The Fontsource files the screen used, as TrueType, with their range and
 *  place: the nearest weight the family ships in that style, upright with no italic;
 *  latin, then what its letters need (kitSubsetsFor). */
async function fontsourceProvider(family, weight, style, request) {
  const id = fontsourceId(family);
  const meta = await fontsourceMeta(family);
  const s = style === 'italic' && meta && !meta.styles.includes('italic') ? 'normal' : style;
  const shipped = meta ? await fontsourceWeights(family, s) : [];
  const weights = shipped.length ? shipped : [400, 700];
  const w = weights.reduce((a, b) => (Math.abs(b - weight) < Math.abs(a - weight) ? b : a));
  const text = String.fromCodePoint(...(request?.codePoints ?? []));
  const files = await Promise.all(['latin', ...kitSubsetsFor(text, meta)].map(async (subset, order) => {
    const res = await fetch(`${await fontsourceAt(id)}files/${id}-${subset}-${w}-${s}.woff2`);
    if (!res.ok) throw new Error(`Fontsource has no ${family} ${w} ${s} ${subset}`);
    return Object.assign(await decompressWoff2(new Uint8Array(await res.arrayBuffer())),
      { unicodeRange: kitRanges()[subset], order });
  }));
  return files.length === 1 ? files[0] : files;
}

/** A "Build the PDF" button; then "Open the PDF" (a new tab: CodePen's frame
 *  shows no PDFs) and a download link. */
function offerPdf(makePdf, filename) {
  viewer();
  const button = Object.assign(document.createElement('button'), { type: 'button', textContent: 'Build the PDF' });
  button.dataset.postextPdf = filename;
  button.addEventListener('click', async () => {
    button.disabled = true;
    button.textContent = 'Building the PDF…';
    try {
      const bytes = await makePdf();
      const url = URL.createObjectURL(new Blob([bytes], { type: 'application/pdf' }));
      const size = `${Math.max(1, Math.round(bytes.length / 1024))} KB`;
      button.replaceWith(
        Object.assign(document.createElement('a'), { href: url, target: '_blank', rel: 'noopener', textContent: 'Open the PDF ↗' }),
        Object.assign(document.createElement('a'), { href: url, download: filename, textContent: `Download ${filename} · ${size}` }));
    } catch (error) {
      button.disabled = false;
      button.textContent = 'Build the PDF';
      kitFail(error);
    }
  });
  document.getElementById('pt-actions').append(button);
}

// ─── Kit · images v3 ── recipes with pictures · postext.dev/cookbook
/** Registers a photo or PNG for the canvas and keeps its bytes for the PDF.
 *  fetch → ImageBitmap never taints the canvas (a plain cross-origin <img> would). */
async function loadImage(fileId, url) {
  const res = await fetch(url);
  if (!res.ok) throw new Error(`Image not found (${res.status}): ${url}`);
  const bytes = new Uint8Array(await res.arrayBuffer());
  registerResourceImage(fileId, await createImageBitmap(new Blob([bytes])));
  (loadImage.bytes ??= new Map()).set(fileId, bytes);
}

/** Registers SVG markup as a vector image, its fonts inside (inlineSvgFonts, ≥ 1.25).
 *  `options` go to registerResourceImage: { singleInk: true } tints it on the canvas. */
async function loadSvg(fileId, svg, options) {
  if (typeof inlineSvgFonts === 'function') svg = await inlineSvgFonts(svg, svgFaces);
  const img = new Image();
  img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
  await img.decode();
  registerResourceImage(fileId, img, options);
  (loadImage.bytes ??= new Map()).set(fileId, new TextEncoder().encode(svg));
}

/** A face's Fontsource files: nearest weight; latin + what the SVG sets. */
async function svgFaces(family, weight, style, { codePoints = [] } = {}) {
  const [id, m] = [fontsourceId(family), await fontsourceMeta(family)];
  const w = m?.weights.reduce((a, b) => (Math.abs(b - weight) < Math.abs(a - weight) ? b : a)) ?? weight;
  const s = m?.styles.includes(style) === false ? 'normal' : style;
  return Promise.all(['latin', ...kitSubsetsFor(String.fromCodePoint(...codePoints), m)].map(async (x) => new Uint8Array(
    await (await fetch(`${await fontsourceAt(id)}files/${id}-${x}-${w}-${s}.woff2`)).arrayBuffer())));
}

/** renderToPdf({ resourceBytes: imageBytes }) */
function imageBytes(fileId) { return loadImage.bytes?.get(fileId); }

/** renderToHtml({ resourceImageUrl: imageUrl }) */
function imageUrl(fileId) {
  const bytes = imageBytes(fileId);
  if (!bytes) return undefined;
  imageUrl.urls ??= new Map();
  if (!imageUrl.urls.has(fileId)) {
    const type = /\.svg$/i.test(fileId) ? 'image/svg+xml' : /\.png$/i.test(fileId) ? 'image/png' : 'image/jpeg';
    imageUrl.urls.set(fileId, URL.createObjectURL(new Blob([bytes], { type })));
  }
  return imageUrl.urls.get(fileId);
}

// ─── /Kit ───────────────────────────────────────────────────────────────────────
```

## Variants

### Imprimeix les fotos només en negre

Amb una sola planxa per a les imatges, les fotos s'imprimeixen en gris sobre el negre, i el rosa queda per a la lletra i les caixes.

```diff
-  plates: { inks: ['Black', 'PANTONE 806 C'], images: ['Black', 'PANTONE 806 C'],
+  plates: { inks: ['Black', 'PANTONE 806 C'], images: ['Black'],
```

### Un groc fluorescent

Canvia la tinta i el seu color en pantalla; les planxes, l'acabat i les corbes segueixen el nom.

```diff
-const PINK = { name: 'PANTONE 806 C', cmyk: { c: 0, m: 77, y: 0, k: 0 } };
+const PINK = { name: 'PANTONE 803 C', cmyk: { c: 0, m: 0, y: 92, k: 0 } };
```

Reanomena igual `PANTONE 806 C` a `CURVES`, a `PRINT` i als hex de la paleta.

## Errors freqüents

- Un color que no imprimeix cap de les dues planxes es projecta sobre les dues tintes. Un blau de quadricromia oblidat en un estil surt com un rosa negrós; llegeix els avisos `offPlateColor` de la comprovació prèvia abans d'enviar el fitxer.
- Una tinta fluorescent no té cap alternativa CMYK fidel. Una prova o un PDF en RGB mostren el hex, més apagat que la tinta sobre el paper.

## Crèdits

- Recepta: Ignacio Ferro ([@drnachio](https://github.com/drnachio))
- Imatges: A crowd at a basement gig, on the cover: Generated With Diffusion Models, original
- Imatges: A guitarist on a small stage: Generated With Diffusion Models, original
- Imatges: An alley wall layered with posters: Generated With Diffusion Models, original
- Tipus de lletra: Archivo Black (OFL-1.1), IBM Plex Sans (OFL-1.1), IBM Plex Mono (OFL-1.1)
- Codi: MIT · Contingut d'exemple: CC-BY-4.0

## Relacionades

- [Núm. 051 · Fanzín riso a dues tintes: il·lustració a una tinta](https://postext.dev/ca/cookbook/riso-zine-single-ink.md): Fanzín per a risògraf de dos tambors: els dibuixos a tot color surten en tons de rosa, recolorits pel motor al canvas i al PDF. · Nivell 3 (Avançat) · Revistes i fanzins
- [Núm. 188 · Or en calent sobre una coberta blava](https://postext.dev/ca/cookbook/gold-foil-poetry-cover.md): L'or en calent com a tinta plana amb acabat: planxa pròpia al PDF, brillantor a Folio, i cartolina blava i paper crema sense tinta. · Nivell 3 (Avançat) · Poesia
- [Núm. 192 · Brillantor selectiva sobre una revista amb tacte suau](https://postext.dev/ca/cookbook/spot-uv-photo-magazine.md): Dos vernissos com a tintes planes: tacte suau a totes les pàgines i brillantor sobre les fotos i la capçalera, vistos a Folio i a les vistes d'acabats. · Nivell 3 (Avançat) · Revistes i fanzins
