How to install fonts (.ttf) on CentOS 6 web server?

General support questions

How to install fonts (.ttf) on CentOS 6 web server?

Postby suaswe » 2012/10/07 18:45:09

Hi all,

I'm not sure if I'm gonna come across like a complete pleb here, but I've server on which I run a couple of websites, and I have been unable to figure out how to install/add a font (specifically GreatVibes) without installing the complete X server. Is this possible? All I want is to have this font available to use and display on my website. Various websites advise to mkdir /usr/share/fonts/TTF and add the font in there, then do a 'service xfs reload', but XFS seems to be tied to the X server package which I haven't got.

Cheers!

SuaSwe
suaswe
 
Posts: 6
Joined: 2012/02/21 17:19:32

How to install fonts (.ttf) on CentOS 6 web server?

Postby CrayXMP » 2012/10/07 19:19:14

Some may have a better way to do it, but this is the only one I know ...

Install the fontconfig package (no X deps).
According to man fc-cache :
"fc-cache scans the font directories on the system and builds font information cache files for applications using fontconfig for their font handling."

Create any subdir for your fonts in /usr/share/fonts (not mandatory but useful)
System-wide : # mkdir -p /usr/share/fonts/greatvibes
User only : mkdir ~/.fonts

Copy your font files in the appropriate folder and "register" them in the system with :
# fc-cache -f -v

Hope it helped. :-D
CrayXMP
 
Posts: 15
Joined: 2009/04/02 16:51:28
Location: France

Re: How to install fonts (.ttf) on CentOS 6 web server?

Postby suaswe » 2012/10/07 19:48:42

That is exactly what I need, thanks! :D

I'm still not able to get it to work after running the fc-cache command as suggested though, maybe you can advise further? This is what I've got in my stylesheet:

Code: Select all
@font-face {
        font-family: 'GreatVibes-Regular';
        src: url('/usr/share/fonts/TTF/GreatVibes-Regular.ttf');
}

h1, h2, h3, h4, h5, h6 {
        color: #fff;
        font-family: 'GreatVibes-Regular';
}


This just displays the default font. Any ideas/suggestions would be most appreciated!
suaswe
 
Posts: 6
Joined: 2012/02/21 17:19:32

Re: How to install fonts (.ttf) on CentOS 6 web server?

Postby TrevorH » 2012/10/07 20:06:05

I many be completely wrong here but surely the presence or absence of the font on the web server has nothing to do with whether the web browser can display it or not. That's down to whether or not the client computer has the font installed - all the web server does is send it the css file that tells the browser to display the output in the font you choose.
User avatar
TrevorH
Forum Moderator
 
Posts: 9158
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to install fonts (.ttf) on CentOS 6 web server?

Postby CrayXMP » 2012/10/07 20:48:56

This may be font embedding !
Get your "@font-face" CSS script to embed your font in at Create Your Own @font-face Kits | Font Squirrel
Upload your font and download the webfontkit to use on your webserver.
Your TTF will be "translated" into various file formats for several browsers.
CrayXMP
 
Posts: 15
Joined: 2009/04/02 16:51:28
Location: France


Return to CentOS 6 - General Support

Who is online

Users browsing this forum: No registered users and 13 guests