function cufon_preprocess_page in Cufón 6
Implementation of hook_preprocess_page().
1 string reference to 'cufon_preprocess_page'
- cufon_theme_registry_alter in ./
cufon.module - Implementation of hook_theme_registry_alter().
File
- ./
cufon.module, line 154 - Adds simple Cufón support to Drupal.
Code
function cufon_preprocess_page(&$vars) {
$selectors = variable_get('cufon_selectors', array());
foreach ($selectors as $id => $selector) {
if (empty($selector['selector'])) {
unset($selectors[$id]);
}
}
// Include only used fonts.
foreach (_cufon_find_fonts() as $family => $font) {
foreach ($selectors as $selector) {
if ($family == $selector['options']['fontFamily']) {
drupal_add_js($font->filename, 'file', 'header');
break;
}
}
}
_cufon_parse_css_properties($selectors);
drupal_add_js(array(
'cufonSelectors' => $selectors,
), 'setting');
$path = drupal_get_path('module', 'cufon');
static $cufonLib;
// search in libraries folders for cufon-yui.js library.
$cufonLib = drupal_system_listing('cufon-yui.js', 'libraries');
if (!isset($cufonLib['cufon-yui'])) {
// try to load local cufon-yui - for backwards compatibility
if (file_exists($path . '/js/cufon-yui.js')) {
drupal_add_js($path . '/js/cufon-yui.js', 'module');
}
}
else {
// load from library
drupal_add_js($cufonLib['cufon-yui']->filename, 'module');
}
drupal_add_js($path . '/js/cufon-drupal.js', 'module', 'footer');
}