Pular para o conteúdo principal
Receita número 133

Receitas · Capítulo 1 · Página e grade

Um jornal standard em seis colunas

Quatro páginas de um diário em formato standard: seis colunas com fio, fotos e boxes em duas a cinco delas, anúncios na largura da página e opinião em cinco.

Nesta página
  • Amostra em inglês: ainda sem edição em português
  • Refile 375 × 597 mm
  • 6 colunas, medianiz de 4 mm
  • Newsreader 9/12,2
  • Archivo Narrow
  • Playfair Display
  • 4 páginas
  • Nível
  • Postext 1.65.0
  • Diagramado em 140 ms
  • 247 linhas de código

Em poucas palavras

Quatro páginas de um jornal diário grande, compostas em seis colunas estreitas. Mostra como pôr uma foto ou um boxe sobre várias colunas e como dar cinco colunas a uma página.

O que você vai compor

Quatro páginas do The Corrington Despatch, um diário inventado, num formato standard de 375 × 597 mm. O texto corre em seis colunas de 55,2 mm com medianizes de 4 mm e um fio fino em cada uma: uma medida de uns 38 caracteres em 9 pt, a de um jornal standard de verdade. A primeira página traz o cabeçalho com duas orelhas, uma faixa de chamadas, uma matéria principal cuja manchete e foto ocupam quatro colunas, uma segunda matéria com foto em duas colunas, uma coluna de notas, uma tabela de financiamento e um boxe de dados em duas colunas, e um anúncio no pé. A página 2 abre com a continuação de uma matéria da capa, a página 3 passa para cinco colunas com os editoriais, um artigo de opinião e as cartas, e a última página traz uma crítica de teatro e a previsão do tempo.

Esta receita responde a

  • Como componho uma página de jornal: cinco colunas em formato standard, uma foto sobre duas delas e um boxe de matéria sobre três?
  • O Postext consegue compor três ou mais colunas de texto, ou fazer o texto contornar uma imagem?

A resposta curta

script.js · linhas 69–85no código completo
const layout = { layoutType: 'multiple', columnCount: 6, gutterWidth: mm(GUTTER),
  columnRule: { enabled: true, color: col('rule'), lineWidth: pt(0.4) } };
// A float across k columns takes the head of the first run of k empty columns that start
// level, counted left to right from the column the text is in, or the foot of that column
// and the empty ones after it. So the order of the fences places them:
//   :::callout{type="head" placement="top" columns="4"}  ← columns 1–4, the text not begun
//   ::resource{id="quays"}                              ← columns 1–4 again, under the box
//   …the lead runs in columns 1–4…
//   :::callout{type="head" placement="top" columns="2"}  ← columns 5–6: 1–4 hold text now
const photo = (id, file, [w, h], columns, extra) => ({ id, typeId: 'photo', kind: 'bitmap',
  createdAt: 0, updatedAt: 0, bitmap: { fileId: file, format: 'jpeg', width: w, height: h },
  placement: { position: 'top', span: 'column', columns },
  note: 'Photograph: Despatch picture desk', ...extra });
// A table across two columns, at the foot of the column that cites it and the next one.
const panel = (id, model, extra) => ({ id, typeId: 'panel', kind: 'table', createdAt: 0,
  updatedAt: 0, table: { model }, placement: { position: 'bottom', columns: 2 }, ...extra });
// As many columns as the page has (or more) is page-wide: columns: 6 = span: 'page'.

Ingredientes

Tipografia
Newsreader, Playfair Display, Archivo Narrow (SIL OFL 1.1)
Materiais
  • barrier-1152.jpg
  • baths-1536x768.jpg
  • quays-1440.jpg
  • stage-1800.jpg
  • terrace-1440.jpg
  • The Eastern Quays at sunrise (the front-page lead photograph) (Generated With Diffusion Models, CC BY 4.0)
  • Engineers watching a river flood gate (front page, second story) (Generated With Diffusion Models, CC BY 4.0)
  • A terraced street on moving day (page 2) (Generated With Diffusion Models, CC BY 4.0)
  • A Victorian swimming baths on a weekday morning (page 3) (Generated With Diffusion Models, CC BY 4.0)
  • A period drama on a theatre stage (page 4) (Generated With Diffusion Models, CC BY 4.0)

Preparo

#1 · Seis colunas num formato standard

O código deste passo está na resposta curta, mais acima. page.sizePreset: 'broadsheet' define o formato de 375 × 597 mm, e layoutType: 'multiple' com columnCount: 6 corta os 351 mm de largura do texto em seis colunas iguais (Tipos de diagramação). Cada uma tem (351 − 5 × 4) / 6 = 55,2 mm, o que em Newsreader de 9 pt comporta uns 38 caracteres, por isso o texto precisa de hifenização, de minWordSpacing: 0.8 para manter os espaços abertos e de maxJustifyTracking: 15 para distribuir uma linha frouxa entre as letras. O fio de coluna desenha uma linha de 0,4 pt em cada medianiz, interrompida onde um flutuante ou um boxe a cruza. Até o postext 1.17, o corpo tinha no máximo duas colunas, e por isso a Nº 027 compunha as quatro colunas de notas dentro de um boxe.

#2 · Um flutuante em k colunas ocupa a primeira sequência de colunas vazias

script.js · linhas 257–286no código completo
const resources = [
  photo('quays', 'quays-1440.jpg', [1440, 1080], 4, {
    altText: 'A cobbled harbour quay at sunrise, with old rail tracks, three dockside cranes '
      + 'and brick warehouses beside calm water.',
    caption: '**The end of the line.** The Eastern Quays at sunrise. The trams will run on '
      + 'the old dock railway’s route past the bonded warehouses.' }),
  photo('barrier', 'barrier-1152.jpg', [1152, 1152], 2, {
    altText: 'Three engineers in orange jackets watch a steel flood gate hold back a high '
      + 'tide between two concrete towers.',
    caption: '**Holding.** Engineers watch the gate at 6.40 yesterday morning.' }),
  photo('terrace', 'terrace-1440.jpg', [1440, 1080], 4, {
    altText: 'A woman carries a box up the steps of a red-brick terraced house on an '
      + 'autumn street.',
    caption: '**Moving day** on Albion Terrace, where a two-bedroom flat now lets for £1,240.' }),
  photo('baths', 'baths-1536x768.jpg', [1536, 768], 3, {
    altText: 'A long Victorian swimming pool under an iron and glass roof, with one woman '
      + 'swimming and wooden cubicles along both sides.',
    caption: '**Forty lengths.** The Albert Baths, opened in 1894, on a weekday morning.' }),
  photo('stage', 'stage-1800.jpg', [1800, 1350], 5, {
    altText: 'Three actors in 1920s costume in a shipping office set on a theatre stage.',
    caption: '**Ledgers and lies.** The shipping office of *The Tally Clerk*.',
    note: 'Photograph: Corrington Playhouse' }),
  panel('funding', funding, { caption: '**Paying for the line**',
    note: 'Source: Corrington City Council, cabinet report, October 2026.' }),
  { ...panel('forecast', forecast(), { placement: { position: 'here' },
    caption: '**The next five days in Corrington**',
    note: 'High water at Salter’s Cut, Arle gate. Forecast: Despatch weather desk.' }) },
  ...Object.keys(SKY).map((id) => ({ id, typeId: 'photo', kind: 'svg', createdAt: 0,
    updatedAt: 0, svg: { fileId: `${id}.svg`, width: 240, height: 120 }, altText: id.slice(4) })),
];

placement.columns dá a uma foto ou tabela a largura em colunas, medianizes incluídas: quatro colunas da primeira página são 232,7 mm. O motor procura o espaço a partir da coluna em que o texto está, da esquerda para a direita. Um flutuante top ocupa o alto da primeira sequência de k colunas que ainda não têm texto e começam na mesma altura; um flutuante bottom ocupa o pé da coluna em que está o texto e das vazias depois dela. Assim, a tabela de financiamento, citada num parágrafo da coluna 3, fica no pé das colunas 3 e 4, e na página 2 o boxe de dados, aberto primeiro, ocupa as colunas 1 e 2, o que deixa as colunas 3 a 6 como a primeira sequência nivelada para a foto de quatro colunas aberta depois dele. Na ordem inversa, o boxe se empilharia sob a foto. Um k igual ao número de colunas da página (ou maior) ocupa a largura da página, o mesmo que span: 'page'.

#3 · Boxes de manchete, boxes de dados e anúncios

script.js · linhas 89–119no código completo
const NO_PAD = { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) };
const head = { id: 'head', backgroundEnabled: false, padding: NO_PAD, // a headline and its deck
  titleStyle: { ...caps(8.5, 700, 'accent'), gap: mm(1.5) }, // the kicker: the fence's title
  marginBottom: pt(LEAD), keepTogether: true,
  body: { fontFamily: 'Newsreader', fontSize: pt(13), lineHeight: pt(16.5), italic: true,
    textAlign: 'left', firstLineIndent: pt(0) } };
const jump = { ...head, id: 'jump', marginTop: pt(LEAD), // a page-wide head under a 1 pt rule
  stripe: { enabled: true, side: 'top', width: pt(1), color: col('ink') },
  padding: { ...NO_PAD, top: mm(2.5) } };
const facts = { id: 'facts', background: col('tint'), keepTogether: true,
  stripe: { enabled: true, side: 'top', width: pt(2.5), color: col('accent') },
  padding: { top: mm(2.5), right: mm(3), bottom: mm(3), left: mm(3) },
  titleStyle: { ...caps(8.5, 700, 'accent'), gap: mm(1.5) }, marginBottom: pt(LEAD),
  body: { fontFamily: 'Archivo Narrow', fontSize: pt(9), lineHeight: pt(11.5),
    textAlign: 'left', firstLineIndent: pt(0), paragraphSpacing: true } };
const weather = { ...facts, id: 'weather', keepTogether: true,
  padding: { top: mm(3), right: mm(4), bottom: mm(4), left: mm(4) },
  body: { ...facts.body, fontFamily: 'Newsreader', fontSize: pt(10.5), lineHeight: pt(14) } };
const ad = { id: 'ad', backgroundEnabled: false, keepTogether: true,
  border: { enabled: true, color: col('ink'), width: pt(0.75) },
  padding: { top: mm(5), right: mm(6), bottom: mm(5), left: mm(6) },
  titleStyle: { ...caps(7, 600, 'muted'), gap: mm(3) }, // "Advertisement"
  body: { fontFamily: 'Archivo Narrow', fontSize: pt(13), lineHeight: pt(17),
    textAlign: 'left', firstLineIndent: pt(0), paragraphSpacing: true } };
const sky = { id: 'sky', background: col('tint'), columnGap: mm(GUTTER), // the teaser strip
  padding: { top: mm(2.5), right: mm(3), bottom: mm(2.5), left: mm(3) }, marginBottom: pt(LEAD),
  body: { fontFamily: 'Archivo Narrow', fontSize: pt(9.5), lineHeight: pt(12),
    textAlign: 'left', firstLineIndent: pt(0) } };
const headline = (id, size, look = {}) => ({ id, fontFamily: 'Playfair Display', fontWeight: 700,
  fontSize: pt(size), lineHeight: pt(size * 1.06), marginTop: pt(0),
  marginBottom: pt(size * 0.22), ...look });

Um :::callout com placement="top" e columns="4" flutua sobre quatro colunas como uma foto. A manchete e a linha fina da matéria principal são um boxe assim, aberto antes do texto dela, de modo que ele ocupa as colunas 1 a 4 e a foto se empilha embaixo. O boxe da manchete da segunda matéria vem depois da principal no texto, após um :::columnbreak: o texto já está na coluna 5 nesse ponto, e as colunas 5 e 6 são o primeiro par vazio. Cada anúncio é um boxe com columns="6", na largura da página, aberto primeiro na página para que o pé fique reservado antes de chegar qualquer texto, e os títulos de continuação das páginas 2 e 4 são boxes na largura da página, como na Nº 027. balancing.trailing: false deixa cada página encher as colunas até o pé, já que aqui toda página fecha uma seção. fillShortColumns: true dá uma linha dos próprios parágrafos à coluna que as regras de viúvas e órfãs deixaram uma linha curta: na página 4, nivela a terceira coluna da crítica.

#4 · O cabeçalho é o H1 da primeira página

script.js · linhas 45–65no código completo
const ear = (side, lines) => lines.map(([id, content, look], i) => text(id, content,
  { ...look, align: side }, { ...(i === 0 ? at('container', `top-${side}`, 0, 4)
    : at(`#${lines[i - 1][0]}`, 'below', 0, 0.8)), size: { width: mm(30) } }));
const nameplate = { enabled: true, slot: { elements: [
  depth(9), // nine grid lines; the rules and the dateline hang from the foot
  { kind: 'rule', id: 'foot', thickness: pt(0.5), color: col('ink'),
    placement: { ...at('#depth', 'align-bottom', 0, -2), size: { width: 'fill' } } },
  ...[['left', '{attr.issue}'], ['center', '{publishDate}'], ['right', '{attr.price}']].map(
    ([align, content]) => text(`date-${align}`, content, { ...caps(8, 600), align },
      { ...at('#foot', 'above', 0, -1.5), size: { width: 'fill' } })),
  rule('thin', '#date-left', 0.5, 1.6), rule('heavy', '#thin', 3, 0.7),
  text('name', '{titleText}', { fontFamily: 'Playfair Display', fontSize: pt(64),
    fontWeight: 900, lineHeight: 1, align: 'center' },
  { ...at('#heavy', 'above', 0, -2.5), size: { width: 'fill' } }),
  ...ear('left', [['w-kicker', 'Weather', caps(7.5, 700, 'accent')],
    ['w-outlook', '{attr.outlook}', { fontFamily: 'Newsreader', fontSize: pt(9.5), italic: true,
      lineHeight: 1.25 }], ['w-temps', '{attr.temps}', sans(17, 700)]]),
  ...ear('right', [['t-kicker', 'Tides', caps(7.5, 700, 'accent')],
    ['t-times', '{attr.tides}', { fontFamily: 'Newsreader', fontSize: pt(9.5), italic: true,
      lineHeight: 1.25 }], ['t-height', '{attr.height}', sans(17, 700)]]),
] } };

# The Corrington Despatch usa o estilo de título front: o nome em Playfair Display Black de 64 pt, duas orelhas preenchidas com os atributos do título e a linha da data entre um fio fino e outro grosso. A abertura tem nove linhas da grade de altura. A faixa de chamadas com fundo de cor que vem abaixo é um boxe na largura da página, um elemento próprio da primeira página: ela fecha a faixa da abertura, e o boxe do título principal ocupa as colunas 1 a 4 da faixa que ela abre. Sem a faixa de chamadas, o boxe ocuparia essas mesmas quatro colunas logo abaixo da abertura, porque o topo da coluna 1 sob uma abertura é um espaço como os topos das outras colunas (até o postext 1.24 não era, e o boxe caía a partir da coluna 2).

#5 · A página de opinião corre em cinco colunas

script.js · linhas 123–144no código completo
const flag = { enabled: true, slot: { elements: [
  depth(4),
  { kind: 'rule', id: 'bar', thickness: pt(3), color: col('ink'),
    placement: { ...at('#depth', 'align-bottom', 0, -2.5), size: { width: 'fill' } } },
  text('flag', '{titleText}', { fontFamily: 'Playfair Display', fontSize: pt(30),
    fontWeight: 900, lineHeight: 1 }, at('#bar', 'above', 0, -1.5)),
  text('tag', '{attr.tag}', { ...caps(8, 600, 'muted'), align: 'right' },
    { ...at('#bar', 'above', 0, -2), size: { width: 'fill' } }),
] } };
const FOLIO = 8; // mm from the top edge to the folio line, its rule 4.5 mm lower
const folio = (parity, side, s) => [ // s: +1 on a verso, −1 on a recto
  text(`n-${parity}`, '{pageNumber}', { ...sans(10, 700), align: side },
    at('page', `top-${side}`, s * MARGIN.side, FOLIO)),
  text(`t-${parity}`, '{title} · {publishDate}', { ...caps(7.5, 600, 'muted'), align: side },
    at(`#n-${parity}`, s > 0 ? 'right-of' : 'left-of', s * 3, 0.9)),
].map((element) => ({ ...element, parity }));
const header = { elements: [...folio('even', 'left', 1), ...folio('odd', 'right', -1),
  { kind: 'rule', id: 'folio-rule', thickness: pt(0.5), color: col('ink'),
    placement: { ...at('page', 'top-left', MARGIN.side, FOLIO + 4.5),
      size: { width: mm(375 - 2 * MARGIN.side) } } }] };
const opinion = { id: 'opinion', advancedDesign: flag, // its section runs in five columns
  layout: { layoutType: 'multiple', columnCount: 5 } }; // 67 mm: a 47-character measure

# Opinion {style="opinion"} abre uma seção cujo estilo de título define layout: { layoutType: 'multiple', columnCount: 5 }. A seção mantém a medianiz e o fio de coluna do documento e só muda o número de colunas, por isso os editoriais, o artigo de opinião e as cartas correm numa medida de 67 mm, uns 47 caracteres. O boxe da manchete do artigo é columns="3", aberto quando o editorial já começou na coluna 1, e por isso cai nas colunas 2 a 4 com a foto embaixo; duas linhas :::columnbreak mandam o artigo para a coluna 2 e as cartas para a coluna 5.

A receita completa

Sandbox
// ═══ Postext Cookbook · Nº 133 · A broadsheet on six columns ════════════════════
// https://postext.dev/en/cookbook/broadsheet-six-columns
// Code: MIT · Text: original (CC BY 4.0) · Photos: generated (CC BY 4.0)
// Fonts: Newsreader, Playfair Display, Archivo Narrow (SIL OFL 1.1) · Needs postext ≥ 1.65.0
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'broadsheet-six-columns';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: newsprint, a cool ink and one blue
const palette = {
  ink: '#15171a', // text, headlines and the heavy rules
  paper: '#f7f5ef', // newsprint; also type reversed out of a band
  accent: '#164a72', // the paper's blue: kickers, section flags, the fact boxes' stripe
  tint: '#e6ebef', // the fact boxes
  rule: '#8e9196', // hairlines: the column rules, table rules
  muted: '#55595f', // bylines, credits, the folio line
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [ // defaults link to 'main-color': point it at the ink
  ...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
  { id: 'main-color', name: 'ink (defaults)', value: { hex: palette.ink, model: 'hex' } },
];
// #endregion
const MARGIN = { top: 16, bottom: 14, side: 12 }; // mm: a broadsheet's narrow, even margins
const GUTTER = 4; // mm: six columns of 55.2 mm on the 351 mm text width
const LEAD = 12.2; // pt: the baseline grid under 9 pt text (× 1.36)
const sans = (size, weight, look = {}) => ({ fontFamily: 'Archivo Narrow', fontSize: pt(size),
  fontWeight: weight, color: col('ink'), ...look });
const caps = (size, weight, colour = 'ink') => sans(size, weight, { color: col(colour),
  textTransform: 'uppercase', letterSpacing: pt(size * 0.14) });
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const text = (id, content, look, placement) => ({ kind: 'text', id, content, align: 'left',
  overflow: 'wrap', color: col('ink'), ...look, placement });
const rule = (id, under, weight, gap = 0) => ({ kind: 'rule', id, thickness: pt(weight),
  color: col('ink'), placement: { ...at(under, 'above', 0, -gap), size: { width: 'fill' } } });
// An empty box sets each opener's depth: a whole number of grid lines.
const depth = (lines) => ({ kind: 'box', id: 'depth', style: {}, placement: {
  ...at('container', 'top-left'), size: { width: 'fill', height: pt(lines * LEAD) } } });

// #region nameplate: the front page's H1 is the paper's name, between two ears
const ear = (side, lines) => lines.map(([id, content, look], i) => text(id, content,
  { ...look, align: side }, { ...(i === 0 ? at('container', `top-${side}`, 0, 4)
    : at(`#${lines[i - 1][0]}`, 'below', 0, 0.8)), size: { width: mm(30) } }));
const nameplate = { enabled: true, slot: { elements: [

O script.js montado funciona como está: cole-o como script de módulo em qualquer página ou abra a receita no CodePen. Pasta da receita no GitHub ↗ (abre em uma nova aba)

Variações

#Compor um berliner em cinco colunas

O mesmo jornal num berliner de 315 × 470 mm: cinco colunas de 55 mm, a medida das seis do standard. O fio do fólio também fica com a largura menor; depois reajuste cada página.

-const layout = { layoutType: 'multiple', columnCount: 6, gutterWidth: mm(GUTTER),
+const layout = { layoutType: 'multiple', columnCount: 5, gutterWidth: mm(GUTTER),
-      size: { width: mm(375 - 2 * MARGIN.side) } }] };
+      size: { width: mm(315 - 2 * MARGIN.side) } }] };
-  page: { sizePreset: 'broadsheet', dpi: 150, backgroundColor: col('paper'), // 375 × 597 mm
+  page: { sizePreset: 'berliner', dpi: 150, backgroundColor: col('paper'), // 315 × 470 mm

Erros comuns

Erro comum

Bitmaps tiram o tamanho de impressão de uma resolução: declare-a, não calcule pixels de impressão

Um bitmap sem resolução é colocado a um pixel por pixel da diagramação na resolução do documento, então uma foto de 2400 px mede 406 mm de largura numa página de 150 dpi. Declare os pixels reais do arquivo e dê à imagem sua resolução (bitmap.resolution: 300), ou ajuste layout.bitmapResolution para todos os bitmaps: um valor de ppi, ou 'file' para ler o que o arquivo informa. A coluna continua limitando a imagem. Figuras e tabelas como recursos →

  • Um flutuante aberto depois que o texto já passou pelas colunas dele não encontra espaço na página e abre a seguinte. Na primeira página, a matéria principal precisa terminar na coluna 4: com um parágrafo a mais, o boxe da manchete e a foto da segunda matéria vão para a página 2.
  • Cada página aqui é ajustada à mão, como o editor de fechamento ajusta um jornal: as linhas :::space dos anúncios e o tamanho de cada matéria definem onde as colunas terminam. Mudou uma matéria, reajuste a página dela.

Créditos

Texto
Texto original, CC BY 4.0
Imagens
  • The Eastern Quays at sunrise (the front-page lead photograph) · Generated With Diffusion Models · CC BY 4.0
  • Engineers watching a river flood gate (front page, second story) · Generated With Diffusion Models · CC BY 4.0
  • A terraced street on moving day (page 2) · Generated With Diffusion Models · CC BY 4.0
  • A Victorian swimming baths on a weekday morning (page 3) · Generated With Diffusion Models · CC BY 4.0
  • A period drama on a theatre stage (page 4) · Generated With Diffusion Models · CC BY 4.0
Fontes
Newsreader (SIL OFL 1.1) · Playfair Display (SIL OFL 1.1) · Archivo Narrow (SIL OFL 1.1)
Sandbox