Trying to render an array of items with the drupal_add_html_head function
if ($families) {
    $element = array(
        '#tag' =&gt; 'html',
    );
    foreach ($families as $fontString) {
        $fontclass = preg_replace('/[^\d\w]+/', '-', strtolower($fontString));
        $element['#attributes'][class'][] = $fontclass;
    }
    drupal_add_html_head($element, 'google_fonts');
}