New Component: CufonLabel: custom fonts in Vaadin apps

Being a graphic oriented chap myself, I pretty often wish to use a typeface that is not necessarily widely available on all platforms. As mighty as Helvetica/Arial can be, it’s not always the best fit for all situations.

That’s why I decided to implement
Cufón font replacements
for Vaadin apps. We’re using the same Cufón replacements here on vaadin.com




Demo on AppEngine


Basically you’re free to use any font that allows @font-face embedding.


Necessary info


Project in Incubator


Vaadin 6.2 compliant JAR’s (use the latest)


Documentation

The component extends the basic Label component, so you get all that it has to offer. You have one additional constructor:

CufonLabel(String value, String fontFileName)

Place all your
Cufon generated
font files to VAADIN/themes/yourtheme/fonts

The filename of the font must match the provided fontFileName parameter in the constructor, excluding the .js file extension. So CufonLabel(“Foo”, “Bar”); would look for a file named Bar.js in the fonts folder.

And you’re set for beautiful type across platforms & browsers!

Have fun, but don’t overuse it! Most suited for short headers and such.