Dynamic Headline Images
JavaScript text replacement
Riot's txt2img feature allows you render your headlines in any typeface. It uses a combination of client-side JavaScript code and server-side image generation.
In your Spring configuration you define which elements should be rendered as image:
<txt2img:config>
<txt2img:rule selector="#topnav a" font="/WEB-INF/myfont.ttf" size="16" />
</txt2img:config>
<txt2img:rule selector="#topnav a" font="/WEB-INF/myfont.ttf" size="16" />
</txt2img:config>
This will cause all links within the “topnav” element to be rendered at 16 pixel size using the myfont.ttf True-Type font. The foreground color, maximum width and CSS text-transform style will be taken from the runtime style of the text which is to be replaced. The script also checks if a :hover style is defined in the CSS and register mouse-event handlers as needed.