You are here

function social_font_fontfiles_render in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  2. 8 modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  3. 8.2 modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  4. 8.3 modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  5. 8.4 modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  6. 8.5 modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  7. 8.6 modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  8. 8.7 modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  9. 8.8 modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  10. 10.3.x modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  11. 10.0.x modules/custom/social_font/social_font.module \social_font_fontfiles_render()
  12. 10.1.x modules/custom/social_font/social_font.module \social_font_fontfiles_render()

The font file renderer.

Parameters

array $fonts: Array with fonts.

Return value

string Returns a string.

1 call to social_font_fontfiles_render()
social_font_render in modules/custom/social_font/social_font.module
The font renderer.

File

modules/custom/social_font/social_font.module, line 117
Contains social_font.module.

Code

function social_font_fontfiles_render(array $fonts) {
  $fontstring = '';
  foreach ($fonts as $key => $font) {
    if (pathinfo($font, PATHINFO_EXTENSION) == 'eot') {
      $fontstring .= "src: url('" . $font . "'), url('" . $font . "#iefix') format('embedded-opentype');";

      // Remove EOT.
      unset($fonts[$key]);
    }
  }

  // Loop 2.
  foreach ($fonts as $key => $font) {
    $format = pathinfo($font, PATHINFO_EXTENSION);
    if (pathinfo($font, PATHINFO_EXTENSION) == 'ttf') {
      $format = 'truetype';
    }
    $fontstring .= "src: url('" . $font . "') format('" . $format . "');";
  }
  return $fontstring;
}