Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Replacing a remotely-hosted font with a local font

Posted on 2014-03-07
10
579 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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
 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
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…

840 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