webfonts / Web-Fonts

A Joomla! series of packages that connect to various web services to provide dynamic CSS font-face fonts.
10 stars 7 forks source link

** Description

The Web Fonts component and plugin are Joomla! extensions that connect to web services to allow Joomla! site owners to integrate non-web safe fonts into their websites via a simple interface.

** License

The Web Fonts component and plugin are licensed to the GPL 3.0 or later.

** Sponsor

Fonts.com has sponsored development for their API and for Google Web Fonts. However, per their request, the extension is open to the implementation of other font services.

** Author

Blue Bridge Development authored the first iteration of the extension and this document.

** Compatibility

The extensions are compatible with versions 1.6, 1.7, and 2.5 of Joomla!

The extensions are tested for Opera, Chrome, Safari, Firefox, and IE 8 and IE 9.

** Integrations

Currently, only the Fonts.com service is integrated. However, the extension is open to integration with other services.

*** General Component Integration

Generally, the extension can be extended by building according to Joomla's MVC architecture. Accordingly, each new service will need a model, view, and sub-controller. This will manage the font vendor's area within the component.

*** Key Component Classes

**** models/stylesheet.php

Vendor models needed to be added to the list of vendors in the model. Additionally, there is an implied interface which can be viewed in this class. Future improvements will explicitly define this.

**** views/vendors/view.html.php

This view needs to have the primary key of the new service mapped to a value that represents the view to use for that service. This is done by adding the key => value to the protected property $_views.

**** helpers/fonts.php

When the stylesheet model requests a list of fonts from a vendor, it needs to be returned in an array of objects according to the inteface "StylesheetFontWrapper", defined in this file. This allows the stylesheet view to properly display the font and its properties if they exist.

*** Key Component Schema Information

Each vendor has an id, name, and properties field in the

__webfonts_vendors table. Additional vendors need to be updated in

the install.sql file to insert this data.

The properties field is intended to hold json encoded metadata about the vendor (e.g. username information, keys, etc).

The #__webfonts table holds information about fonts selected for the project and maps it to vendors individual tables.

*** Key Plugin Information

The Web Fonts plugin is a container for other Web Fonts plugins. It currently only triggers the onBeforeCompileHead event, however it is generic enough to support any other system events.

Individual actions for those events need to be inserted in the "handlers" directory and will be triggered by the main plugin via the "execute" method.