Most name-and-number personalizers drop flat text on top of a photo. Shoppers can tell.
The jersey store I build for wanted the opposite: a preview that looks like the real printed shirt, in each club's own lettering. It now runs on 285 live jerseys across 83 kit styles, from one canvas script inside the theme. No app, no per-order fee.
How it works
The back photo of the shirt goes onto a canvas. The name and number are drawn in the club's font, warped through a mesh for perspective and curve (48 columns minimum, about 3 px wide on larger prints), then shaded with the photo itself. The finished image is attached to the order, so production prints what the shopper saw.
Three things broke on the way.
1. The font that rendered at 10px
The name appeared, but tiny. When ctx.font gets a family it can't parse, it doesn't throw. The context just keeps its previous font and moves on.
The culprit was a font family called "Madrid 2627 Reference Traced". An unquoted, multi-word family is only valid if every word is a legal bare CSS identifier, and "2627" isn't. The fix was boring: quote every family name before it goes into the shorthand.
2. The print that looked like a sticker
I shaded the print with a grayscale copy of the shirt photo, multiplied into the ink. On light shirts, which get dark ink, it still looked flat. Multiply can only darken, so any fabric texture baked into that layer vanished in dark ink.
Two changes fixed it. The weave became its own layer, the difference between a sharp and a blurred copy, screened on top. And the shading got a floor, so a white print on a dark shirt can't be crushed to nothing:
// simplified from the real code
sctx.filter = 'grayscale(1)';
sctx.drawImage(image, 0, 0, w, h); // sharp copy
sctx.globalCompositeOperation = 'difference';
sctx.drawImage(blurredGray, 0, 0); // |sharp - blurred| = weave detail
ctx.globalCompositeOperation = 'lighten';
ctx.fillStyle = '#5c5c5c'; // floor for the multiply layer
ctx.fillRect(0, 0, w, h);
3. document.fonts.check() tells you nothing
Every club has its own fonts, and a wrong-looking font on a club shirt is worse than no print. So the rule is hard: exact font or no print.
The catch is that document.fonts.load() and .check() both succeed for a family that was never declared, because the browser would just use a system font. So the gate looks for the family's own face in document.fonts with status loaded. If it isn't there, the preview shows a message instead of printing in a fallback.
Clubs are data, not code
Each club is a Shopify metaobject (fonts, crest-in-digit style, print layout). A product points to its club with one metafield. Adding a club means a new entry, not a theme change. There are over 160 club looks in the store, including the 2026 World Cup national teams.
If you've warped text onto fabric, or any curved surface, on canvas, I'd like to know what you used. A 48-column mesh worked for me, but I'm not sure it's the best answer.
I build custom Shopify product-page features like this. More at fahadazhar.site.


Top comments (0)