Can you change font-size if a font is not available?
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Can you change font-size if a font is not available?
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???
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???
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Can you change font-size if a font is not available?
Search for "font stack" for more information.
Here is the first solution I found: http://stackoverflow.com/questions/8299 ... falls-back
Here is the first solution I found: http://stackoverflow.com/questions/8299 ... falls-back
(#10850)
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Can you change font-size if a font is not available?
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.
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.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Can you change font-size if a font is not available?
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.
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.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Can you change font-size if a font is not available?
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?
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.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Can you change font-size if a font is not available?
Is that done by pointing something to their server? Or something different?
Could I not just host the TTF file myself??
Could I not just host the TTF file myself??
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Can you change font-size if a font is not available?
You have to load some js code from their server. Self-hosted option is also available, but for a fee.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Can you change font-size if a font is not available?
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.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
annaharris
- Forum Commoner
- Posts: 30
- Joined: Mon Mar 25, 2013 6:52 am
Re: Can you change font-size if a font is not available?
No, As per my knowledge you can't change font-size if any particular font is not available.