[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Replacing a remotely-hosted font with a local font

Posted on 2014-03-07
10
Medium Priority
?
597 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
[X]
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
  • 5
  • 5
10 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

649 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