# HG changeset patch # User Chris Cannam # Date 1310634843 -3600 # Node ID 5d608412b003892130661b5b596a01b813da5512 # Parent b9f81065a8e10c24948cca84dee1554e3638165b Pull out font name specifications from stylesheets and serve differently to different platforms (falling back to our usual web fonts). Fixes #212 diff -r b9f81065a8e1 -r 5d608412b003 app/helpers/application_helper.rb --- 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 @@ '' 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 diff -r b9f81065a8e1 -r 5d608412b003 app/views/layouts/base.rhtml --- a/app/views/layouts/base.rhtml Wed Jul 13 14:37:14 2011 +0100 +++ b/app/views/layouts/base.rhtml Thu Jul 14 10:14:03 2011 +0100 @@ -8,6 +8,7 @@ <%= csrf_meta_tag %> <%= favicon %> <%= stylesheet_link_tag 'application', :media => 'all' %> +<%= stylesheet_platform_font_tag %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= heads_for_theme %> diff -r b9f81065a8e1 -r 5d608412b003 public/themes/soundsoftware/stylesheets/application.css --- a/public/themes/soundsoftware/stylesheets/application.css Wed Jul 13 14:37:14 2011 +0100 +++ b/public/themes/soundsoftware/stylesheets/application.css Thu Jul 14 10:14:03 2011 +0100 @@ -1,5 +1,4 @@ @import url(../../../stylesheets/application.css); -@import url(fonts.css); /* Colours: @@ -31,13 +30,6 @@ h1 { color: #3e442c; - font-family: GilliusADFNo2, 'Gill Sans', Tahoma, sans-serif; - font-weight: normal; -} - -body,p,h2,h3,h4,li,table,.wiki h1 { - font-family: DroidSans, 'Liberation Sans', tahoma, verdana, sans-serif; - line-height: 1.34; } h2,h3,h4,.wiki h1 { @@ -130,8 +122,6 @@ margin-bottom: 0px; margin-left: 12px; margin-top: 6px; - font-family: GilliusADFNo2, 'Gill Sans', Tahoma, sans-serif; - font-weight: normal; } #main-menu { position: absolute; top: 100px; /* background-color: #be5700; */ left: 0; border-top: 0; width: 100%;/* height: 1.82em; */ padding: 0; margin: 0; border: 0; } @@ -183,7 +173,6 @@ .NavBarCell1 { background-color: #ffe69b; color:#000000 } .embedded table { border: 0px solid #fff; } -.embedded h1 { font-family: DroidSans, 'Liberation Sans', tahoma, verdana, sans-serif; } .embedded h3 { margin-top: 0.5em; } .embedded hr { color: #a9b680; background-color: #a9b680 } .embedded center { text-align: left; } /* haha */ diff -r b9f81065a8e1 -r 5d608412b003 public/themes/soundsoftware/stylesheets/fonts-generic.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/public/themes/soundsoftware/stylesheets/fonts-generic.css Thu Jul 14 10:14:03 2011 +0100 @@ -0,0 +1,12 @@ +@import url(fonts.css); + +h1, #project-ancestors-title { + font-family: GilliusADFNo2, 'Gill Sans', Tahoma, sans-serif; + font-weight: normal; +} + +body,p,h2,h3,h4,li,table,.wiki h1,.embedded h1 { + font-family: DroidSans, 'Liberation Sans', tahoma, verdana, sans-serif; + line-height: 1.34; +} + diff -r b9f81065a8e1 -r 5d608412b003 public/themes/soundsoftware/stylesheets/fonts-mac.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/public/themes/soundsoftware/stylesheets/fonts-mac.css Thu Jul 14 10:14:03 2011 +0100 @@ -0,0 +1,11 @@ +@import url(fonts.css); + +h1, #project-ancestors-title { + font-family: GilliusADFNo2, 'Gill Sans', Tahoma, sans-serif; + font-weight: normal; +} + +body,p,h2,h3,h4,li,table,.wiki h1,.embedded h1 { + font-family: 'Lucida Grande', 'Lucida Sans Unicode', DroidSans, 'Liberation Sans', tahoma, verdana, sans-serif; + line-height: 1.34; +} diff -r b9f81065a8e1 -r 5d608412b003 public/themes/soundsoftware/stylesheets/fonts-ms.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/public/themes/soundsoftware/stylesheets/fonts-ms.css Thu Jul 14 10:14:03 2011 +0100 @@ -0,0 +1,11 @@ +@import url(fonts.css); + +h1, #project-ancestors-title { + font-family: GilliusADFNo2, 'Gill Sans', Tahoma, sans-serif; + font-weight: normal; +} + +body,p,h2,h3,h4,li,table,.wiki h1,.embedded h1 { + font-family: Calibri, DroidSans, 'Liberation Sans', tahoma, verdana, sans-serif; + line-height: 1.34; +}