Page 1 of 1
Can you change font-size if a font is not available?
Posted: Thu Feb 07, 2013 2:55 pm
by simonmlewis
I want to set a font to Gill Sans MT. Size 12.
But if the person does not have Gill Sans, then I set it to Arial or Verdana, but then the font is way bigger and doesn't look as good for this particular set of pages.
So, is there a way in CSS or PHP, where you can ask, if Gill Sans MT is NOT available, then use "font b", as size "11.2" for example???
Re: Can you change font-size if a font is not available?
Posted: Thu Feb 07, 2013 3:18 pm
by Christopher
Search for "font stack" for more information.
Here is the first solution I found:
http://stackoverflow.com/questions/8299 ... falls-back
Re: Can you change font-size if a font is not available?
Posted: Thu Feb 07, 2013 4:54 pm
by simonmlewis
That page says it is not possible to set the font size as part of the "stack".
Is there a means in PHP to check if Gill Sans is working/available. Because then if it is NOT, then you can assign the font size to a different one. Easy.
Re: Can you change font-size if a font is not available?
Posted: Thu Feb 07, 2013 5:22 pm
by simonmlewis
http://www.lalit.org/lab/fontdetect.php
I cannot see how this page can be run, and then used via PHP.
So if that font is "true", then I can override the stylesheet to a set font, and if "false", use a different size.
Surely there is a way, since Gill Sans is smaller than Arial.
Re: Can you change font-size if a font is not available?
Posted: Thu Feb 07, 2013 5:48 pm
by requinix
PHP runs on the server. The browser is on the client. You cannot use PHP to tell if the browser supports a font. Since there's no way with CSS you must use Javascript to do it.
Re: Can you change font-size if a font is not available?
Posted: Thu Feb 07, 2013 8:30 pm
by Weirdan
As another option Gill Sans is available as a web font from fonts.com for free (provided your traffic is less than 25k pageviews/month). They force you to display their banner though.
Re: Can you change font-size if a font is not available?
Posted: Fri Feb 08, 2013 2:21 am
by simonmlewis
Is that done by pointing something to their server? Or something different?
Could I not just host the TTF file myself??
Re: Can you change font-size if a font is not available?
Posted: Fri Feb 08, 2013 5:54 am
by Weirdan
You have to load some js code from their server. Self-hosted option is also available, but for a fee.
Re: Can you change font-size if a font is not available?
Posted: Fri Feb 08, 2013 5:57 am
by simonmlewis
I did manage to download a OET Gill Sans file, but no idea how to make it work - that way you host the Gill Sans font, and use it.
Re: Can you change font-size if a font is not available?
Posted: Tue Apr 23, 2013 7:38 am
by annaharris
No, As per my knowledge you can't change font-size if any particular font is not available.