Extending the Google Font Loader

In the recipe we just looked at, we extended the Options class, took an option in the form of a CSV of Google fonts, and styled text using CSS. Get ready to see how even the instantiation line can be generated based on a few clicks. That way, no typos or issues with unavailable fonts can creep in and catch us off guard.

Designers, especially, love this one-time-use class method.

How to do it...

Dabble in a bit of polymorphism. When no fonts are passed during instantiation, route the flow of action to a new method that generates an interface. That interface will have a multi-select input widget that onClick updates a TEXTAREA with an instantiation code that designers can use to embed their Google web fonts.

For brevity, ...

Get MooTools 1.3 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.