diff app/helpers/application_helper.rb @ 503:5d608412b003 feature_212

Pull out font name specifications from stylesheets and serve differently to different platforms (falling back to our usual web fonts). Fixes #212
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 14 Jul 2011 10:14:03 +0100
parents 753f1380d6bc
children 5e80956cc792
line wrap: on
line diff
--- a/app/helpers/application_helper.rb	Wed Jul 13 14:37:14 2011 +0100
+++ b/app/helpers/application_helper.rb	Thu Jul 14 10:14:03 2011 +0100
@@ -913,6 +913,17 @@
     '<meta name="robots" content="noindex,follow,noarchive" />'
   end
 
+  def stylesheet_platform_font_tag
+    agent = request.env['HTTP_USER_AGENT']
+    name = 'fonts-generic'
+    if agent and agent =~ %r{Windows}
+      name = 'fonts-ms'
+    elsif agent and agent =~ %r{Macintosh}
+      name = 'fonts-mac'
+    end
+    stylesheet_link_tag name, :media => 'all'
+  end
+
   # Returns true if arg is expected in the API response
   def include_in_api_response?(arg)
     unless @included_in_api_response