Solved

Replacing a remotely-hosted font with a local font

Posted on 2014-03-07
10
572 Views
Last Modified: 2014-03-07
A webmaster designed a dynamic template for me, which includes the following line of code:
<link href="http://fonts.googleapis.com/css?family=Federo" rel="stylesheet" type="text/css">

I prefer to host fonts and scripts locally, and not to rely on the continuation of those resources on someone else's server.  But I'm not clear how to accomplish this with the font in question.

If I download the style sheet, it contains the following code:
@font-face {
  font-family: 'Federo';
  font-style: normal;
  font-weight: 400;
  src: local('Federo'), local('Federo-Regular'), url(http://themes.googleusercontent.com/static/fonts/federo/v6/FnU7BHlDZgmlIL4FzGh7QA.woff) format('woff');
}

Does this still require content on a remote server?

I have installed the font ("Federo") in my Windows fonts folder.  Can I simplify this portion of code by making reference to the actual font?

Thanks!
0
Comment
Question by:ddantes
  • 5
  • 5
10 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39913790
Download the css and the font and change the source in the css to your local path to the font then add the css to your own css file and remove the css link to Google from your page.
0
 

Author Comment

by:ddantes
ID: 39913849
Thank you.  So, could I add Federco.ttf to my css folder, and change the css code to this?

@font-face {
  font-family: 'Federo';
  font-style: normal;
  font-weight: 400;
  src: "css/Federco.ttf", url(css/font.css);
}
0
 
LVL 58

Expert Comment

by:Gary
ID: 39913861
You just need this for the src (assuming you renamed the woff file to Federco)

src: url(/css/Federco.woff);
0
 

Author Comment

by:ddantes
ID: 39913894
Thank you.  I'm having some challenges implementing this.

In the <HEAD> section of a test page, I replaced the Googleapis code with:
<link href="css/font.css" rel="stylesheet" type="text/css">

In the CSS folder, I placed the downloaded Federco.woff, and now font.css reads like this:
@font-face {
  font-family: 'Federo';
  font-style: normal;
  font-weight: 400;
  color:aqua;
  src: local('Federo'), local('Federo-Regular'), url(Federco.woff);
}

I made the color aqua so I could see if there was any effect on the page, and there is no aqua text.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39913898
You're missing the path to thefont

src: url(/css/Federco.woff);
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:ddantes
ID: 39913949
font.css has this code:
 src: local('Federo'), local('Federo-Regular'), url(Federco.woff);

Since the font is in the same folder as font.css, I omitted "/css/"  in the path.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39913954
No, always use the full path - when you include a css file (or any file) then any paths in the included file are relative to the path of the file calling it, not relative to the path of the included file.
0
 

Author Comment

by:ddantes
ID: 39913986
Thank you.  I couldn't get the font to appear in aqua, but I believe this is due to conflicting styling code in other css files.  It appears that the reference to the Federo font from Googleapis is probably unnecessary, as "Federo" is specified elsewhere in other style sheets.  In any case, I've corrected the path to the font, and I appreciate your good service!
0
 
LVL 58

Expert Comment

by:Gary
ID: 39913995
aqua works fine for me so must be getting overridden somewhere else
0
 

Author Comment

by:ddantes
ID: 39914009
Agreed.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now