Indra_Optus
13 years agoGuide
Custom Font ?
Is it possible to have custom font in Lithium (either buy adding it to Lithium or sourcing it using external URL)? Our company use custom font and would like to use it in Lithium page. We have S...
Lithium has helped several customers with the past integrate custom fonts into their community. Typically they have either used typekit or cufon.
If your company was using and hosting a .EOT file and applying it with css on their .com, lithium could accommodate this so you could apply the custom font via css for the community, but lithium would still need to edit the apache config to allow the file type for .com domains (your community).
Also, doing a quick search lead me to this chart. It looks like SVG is not supported by IE 9 and older or Firefox.
I've tried using a Google font but it doesn't seem to work -- have I simply done something wrong or does Lithium block external file calls?
Hi Inactive User
are the fonts uploaded as assets in Studio and referenced using ${asset.get("...")} , or linked externally? Some browsers can prevent loading external fonts as a security risk (also depending on the settings) , thus preventing them from being viewed? Also, by any chance are you sourcing fonts over HTTP on a SSL page?
Lithium does not block external calls normally.
Hope it helps,
Hi Inactive User ,
To use google fonts, you shouldn't have to download and add the font file to your community's assets folder. Just make sure you've added the external link correctly to your header's head content, like so; for the font family Source Sans Pro;
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
When I'm specfing the font in my css, its written like so;
.blah { font-family: 'Source Sans Pro', sans-serif;}
When adding the font to your custom skin's skin property page font values, it should be entered like so;
font-family:Source Sans Pro, sans-serif; font-weight:normal;
Hope this helps
Thanks for the replies. I understand that one doesn't have to upload google fonts -- I've linked it exactly as you have described above :)
Upon inspection of the stage source html the correct css is there, the google font is linked and and right class is being applied in the markup. I wondered if the font didn't work because it couldn't import external files -- now I'm thinking it might be because the css is loaded before the font is.
Is there any way to change the order in which the head wrapper and the custom css is applied?
Hmm no. The load order for css files is the core Base Skin > Your Custom Skin > any css files added in the assets folder, then any css files linked in the head content.
Silly question, but is the custom skin where the font link/css live being applied to the community? Be sure to check via the admin > display > skins and see if the right skin has been set.
I see Paolo asked eariler if you were sourcing fonts over HTTP on a SSL page? Is this the case? Otherwise if what your syntax everywhere else is correct, the fonts should load.