Quadrille.textZoom

Sets the glyph size for string cells, as a fraction of cellLength. The default is Quadrille.textZoom, which is 0.78 — a little under the full cell, so a glyph does not crowd the tile stroke.

Passing textZoom to drawQuadrille overrides the global default for that call only.

Example

edit, then run

Note

Drag the left slider and only q1 changes: a textZoom passed to drawQuadrille overrides the global default for that call. Drag the right one and q2, q3 and q4 follow it while q1 stays put — an explicit value always wins.

Push either past 1 and the glyph outgrows its cell. Nothing is clipped: string cells are drawn unboxed, so a glyph overflows into its neighbours rather than vanishing.

Warning

A cell's glyph count is what divides the zoom, and it counts characters.

Compare q4 against the others. A one-character cell draws at cellLength × textZoom; q4 holds two characters per cell, so each is drawn at half that. This is what keeps a whole word inside its cell.

An emoji counts as one character even though JavaScript stores most of them as two UTF-16 code units — '🎃'.length is 2, yet it fills a cell exactly like 'a'. q3 mixes emoji that carry variation selectors, which are also folded into a single character.

Syntax

drawQuadrille(quadrille, { textZoom })

Parameters

Param Description
textZoom Number: glyph size as a fraction of cellLength. Defaults to Quadrille.textZoom, which is 0.78
What this page's examples use
p5.quadrille
drawQuadrille createQuadrille cellLength textZoom
p5.js
createCanvas background value position input createSlider

Names the analysis can prove are called, and the line each one is documented on. Local variables and members of an unknown receiver are left out.