google-font-api

How to keep CSS from render-blocking my website?

梦想与她 提交于 2019-12-04 02:53:45
I am trying to optimize the loading speed of my mobile webpage, and for that effect I am using the website: https://developers.google.com/speed/pagespeed/insights This website evaluates my source and tells me what I can improve. In my website I download a font: <link href="//fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet"> and aparently this is blocking the rendering of my page. Now, if this was JavaScript I could use the async word in the tag and it would fix the problem, but this is not a javascript file I am loading! Is there anyway to keep this resource from blocking my

Use a google font and include only [A-Z] and '&'

Deadly 提交于 2019-12-03 23:17:23
Is there a way to use a google font and have it load only [A-Z] and the & ampersand character? I would like to do this to reduce size and improve load time, since I will only use basic latin numbers and letters. I can host the font myself if I must and it is legal to manipulate the font package, but am not sure if self-hosting is necessary and how to manipulate google's font package. I have specified A-Z like this: http://fonts.googleapis.com/css?family=Inconsolata&text=ABCDEFGHIJKLMNOPQRSTUVWXYZ but specifying & is troublesome. Both of these don't work: <link href='http://fonts.googleapis.com

Dynamically load google fonts after page has loaded

岁酱吖の 提交于 2019-12-03 15:02:00
问题 I would like to be able to have the user select which font they would like the page to be displayed in. Here is the way that Google recommends you do it using JavaScript. WebFontConfig = { google: { families: ['Tangerine', 'Cantarell'] } }; (function() { var wf = document.createElement('script'); wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'; wf.type = 'text/javascript'; wf.async = 'true'; var s = document

Google Font API uses browser detection. How to get all font variations for font-face

允我心安 提交于 2019-12-03 12:55:30
问题 I just discovered that Google Font API uses browser detection This means that when you open http://fonts.googleapis.com/css?family=Racing+Sans+One it will show the content needed only for your current browser So I can't just grab that and use in my own font-face, if I want it to work in all browsers. Many people do this, not knowing it then won't work everywhere What would be the method to get all variations of the font? woff2/woff/ttf/etc.? (to use as fallbacks in font-face) I just tried

Import and use google webfont

大兔子大兔子 提交于 2019-12-03 12:51:24
For a project, I have to use many style off a font. Here is the link of the google font Here is my css import @import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,300,400,700); What I would like to know is how can I define the font-family to display for example the "Open Sans Light 300 Italic" Thanks CSS @import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,300,400,700); body { font-family: 'Open Sans', sans-serif; } body p { font-style: italic; font-weight: 300; /* You specify the number you see next to the fonts to

How to use font-family lato? [closed]

眉间皱痕 提交于 2019-12-03 05:23:57
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . How to use font-family lato ? I have used style like this but not working . How can I do ? Thank you. font-family: Lato, Helvetica, sans-serif; link: http://www.google.com/fonts/specimen/Lato 回答1: Please put this code in head section <link href='http://fonts.googleapis.com/css?family=Lato:400,700'

Google Fonts violates Content Security Policy

核能气质少年 提交于 2019-12-03 04:14:09
问题 I'm trying to use Google Fonts and I've never had any problems, but now when I try to add the CSS file on my header I get this error on the console: Refused to load the stylesheet 'http://fonts.googleapis.com/css?family=Whatever' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline'" . 回答1: There are two things to fix here: Use https for the Google fonts link ( https://fonts.googleapis.com/css?family=Whatever ) Authorize https://fonts

Google Font API uses browser detection. How to get all font variations for font-face

故事扮演 提交于 2019-12-03 03:58:05
I just discovered that Google Font API uses browser detection This means that when you open http://fonts.googleapis.com/css?family=Racing+Sans+One it will show the content needed only for your current browser So I can't just grab that and use in my own font-face, if I want it to work in all browsers. Many people do this, not knowing it then won't work everywhere What would be the method to get all variations of the font? woff2/woff/ttf/etc.? (to use as fallbacks in font-face) I just tried opening that api page in Chrome, changing browser useragent spoofing in Developer, and go through the

How to use font-family lato? [closed]

余生颓废 提交于 2019-12-02 18:43:18
How to use font-family lato ? I have used style like this but not working . How can I do ? Thank you. font-family: Lato, Helvetica, sans-serif; link: http://www.google.com/fonts/specimen/Lato Please put this code in head section <link href='http://fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'> and use font-family: 'Lato', sans-serif; in your css. For example: h1 { font-family: 'Lato', sans-serif; font-weight: 400; } Or you can use manually also Generate .ttf font from fontSquiral and can try this option @font-face { font-family: "Lato"; src: url('698242188-Lato

$.getJSON and google fonts API stops working in internet explorer with jQuery versions greater than 1.4.4

时间秒杀一切 提交于 2019-12-02 06:35:13
I have spent almost the whole day trying to find a solution to this problem. I have successfully written code to dynamically retrieve and display the whole lot of fonts using the Google fonts API and jQuery 1.4.4. (works in all browsers) I have had to change jQuery to version 1.7.2 and unfortunately noticed that the code I wrote works well in all browsers except for Internet Explorer. I did some testing and found that in Internet Explorer $.getJSON or $.ajax fail to load the JSON font data from Google when using jQuery versions higher than 1.4.4. This is the code I am using: $(function(){ $