Guides/4 min
Crisp canvas type
Why fillText looks cheap on a retina screen, and the two-line fix.
HTML5 canvas is a bitmap. CSS pixels and device pixels are not the same thing. If you create a 800×400 canvas and stretch it with CSS to 800×400 CSS pixels on a 2× display, the browser upscales a 1× buffer. Glyphs go soft. That is not a font problem.
Scale the backing store
Keep the CSS size at the layout size you want. Multiply canvas.width and canvas.height by devicePixelRatio, then ctx.scale(dpr, dpr) so your drawing code still thinks in CSS pixels.
const dpr = Math.min(window.devicePixelRatio || 1, 2); canvas.width = cssW * dpr; canvas.height = cssH * dpr; canvas.style.width = cssW + 'px'; canvas.style.height = cssH + 'px'; ctx.scale(dpr, dpr);
CanvasFont does this in the preview. Exports ignore screen DPR and use the scale you pick (1×, 2×, 3×) so a 300×250 ad is actually 300×250 or 600×500 — not whatever the operator’s laptop happens to be.
Subpixel versus crisp
By default the browser places glyphs on subpixel positions. That is usually what you want for large type. For very small UI type (12–14px) on a 1× export, rounding x/y to integers and skipping fractional tracking often looks tighter. The studio’s Crisp toggle does exactly that.
Opaque canvases ({ alpha: false }) can also look slightly firmer because the compositor skips blending. Use it when the background is a solid fill, which is most ads.