Skip to content

Draw a caption's shadows behind its outline - #15

Merged
rponeawa merged 1 commit into
mainfrom
caption-soft-effects-under-outline
Aug 20, 2026
Merged

rponeawa merged 1 commit into
mainfrom
caption-soft-effects-under-outline

Conversation

@rponeawa

Copy link
Copy Markdown
Member

The outline moved to Paint in #14; shadow, glow and long shadow stayed as CSS text-shadow on the word element. A shadow is cast by whatever carries it, and what carried it was the glyph body — so the shadow landed on top of the ring instead of underneath it. Every recipe in the repository pairs a dark outline with a dark shadow, which is the only reason it did not show.

They are Paint now as well, declared before the stroke, since layers draw in the order they are named.

Two things that needed care

Order reverses on the way across. text-shadow paints its list front to back — the first shadow named is the one on top — while Paint layers draw back to front. So the far end of the long shadow is declared first, then the glow, then the drop shadow nearest the letter. The long shadow was already computed as discrete steps and each step becomes one shadow layer, which is what a long shadow is.

Blur is converted, not copied. CSS blur is a radius and covers roughly two standard deviations; feGaussianBlur takes the deviation. Passing the authored number straight through would have doubled every shadow and glow in the repository.

Measured

Rendered through the real pipeline with an unblurred blue shadow offset ten pixels beneath a red outline:

  • visible shadow pixels: 1184 — only the crescent the ring does not cover
  • of the 351 columns carrying ink, the number whose topmost pixel is shadow: 0

In front of the ring the shadow would have shown its whole silhouette, on the order of nine thousand pixels, and would have capped columns.

Filter definitions were being repeated

Naming a filter after the Track and Present as well as the Paint meant every word carried its own copy of byte-identical definitions. A five-word caption with an outline, a glow and a long shadow emitted 80 definitions of 16 distinct filters — 36 KiB, of which 7 were not repetition. A filter's content depends on its Paint alone, so its name now does too, and the document writes each one once.

definitions distinct bytes
before 80 16 36 KiB
after 16 16 7 KiB
ordinary caption (outline + shadow) 2 2 907 B

Verification

pnpm check, pnpm test (544, 0 failures), pnpm test:release (8) and pnpm test:browser-visual (12 against a real browser) all pass.

🤖 Generated with Claude Code

The outline moved to Paint; the shadow, glow and long shadow stayed as CSS
`text-shadow` on the word. A shadow is cast by the thing that carries it, and
what carried it was the body — so the shadow landed on the ring instead of
under it. Every recipe here pairs a dark outline with a dark shadow, which is
the only reason it was not obvious.

They are Paint now too, declared before the stroke, because layers draw in the
order they are named. `text-shadow` paints its list the other way round — the
first named is on top — so the order reverses on the way across: the far end of
the long shadow first, then the glow, then the drop shadow nearest the letter.
The long shadow is already computed as discrete steps, and each step is one
shadow layer, which is what a long shadow is.

Blur had to be converted, not copied. CSS blur is a radius and covers about two
deviations; the filter takes a deviation. Passing the authored number straight
through would have doubled every shadow and glow in the repository.

Measured through the real pipeline with a blue unblurred shadow offset ten
pixels under a red outline: 1184 shadow pixels survive, and of the 351 columns
carrying ink, zero are capped by the shadow. In front of the ring it would have
shown its whole silhouette, around nine thousand.

Naming filters after the Track and Present as well as the Paint meant every word
carried its own copy of definitions that were byte-identical. A five-word
caption with an outline, a glow and a long shadow emitted eighty definitions of
sixteen distinct filters — thirty-six kilobytes, seven of them not repeated.
A filter's content depends on its Paint alone, so its name does too, and the
document writes each one once: eighty definitions became sixteen, and the
ordinary case is two.

Co-Authored-By: Claude <[email protected]>
@rponeawa
rponeawa merged commit 356de96 into main Aug 20, 2026
2 checks passed
overlordkim pushed a commit that referenced this pull request Sep 9, 2026
Draw a caption's shadows behind its outline
overlordkim pushed a commit that referenced this pull request Sep 9, 2026
Draw a caption's shadows behind its outline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant