I have a website for internal use that uses the Roboto google font. Here is the code that includes it.
<link href="//fonts.googleapis.com/css?family=Roboto:500" rel="stylesheet" type="text/css">.
&
body {
font-family: "Roboto";
}
b, strong {
font-weight: 700;
}
I've found someone at my company who's Chrome can't render this font when it is bold. I could replicate it by going to Youtube and making Roboto text bold with the inspect element. This problem does not occur on any other computers. The Chrome is up to date and has no extensions installed. I've tried closing and reopening Chrome as well as several hard refreshes. Forcing the browser to repaint with resize, CSS, or JS does not fix the issue either.
This does not dupe question Font Weight with Google Fonts Roboto, normal (400) and bold (700) work, light (300) does not. The problem occurs on both http and https versions of the site, the font is loaded with //, and I get no insecure content warnings from Chrome.
What is causing this, and is there anything I can do on the website or on the persons computer to further troubleshoot or fix this?
If you use Google Fonts
<link href="//fonts.googleapis.com/css?family=Roboto:500" rel="stylesheet" type="text/css">
without a fallback font like;
body {
font-family: "Roboto";
}
b, strong {
font-weight: 700;
}
You should provide that font-weight in your Google Fonts link like;
<link href="//fonts.googleapis.com/css?family=Roboto:500,700" rel="stylesheet" type="text/css">
Or, you should provide a fallback font;
body {
font-family: "Roboto", sans-serif;
}
By doing so, if your browser can't find the font-weight: 700; Roboto font, it can use a suitable sans-serif font from your system.
In ideal situations, using a font-family to support all possible computer systems like;
body {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
will solve all of these problems.
Related
I've added a custom font to my project using font-face along with font-family in this way:
#font-face {
font-family: "Caprice";
src: url("../fonts/Caprice.ttf") format("truetype");
}
html,
body {
margin: 0;
padding: 0;
font-family: "Caprice", Arial, Helvetica, sans-serif;
}
But the result is that the font, instead of being rendered as it should, it's being rendered in a very very "creepy way". Here's an image to let you better understand:
I've tried changing font but the result is neatly the same. I've also tried the page in different browsers without any success.
What am I doing wrong?
All the fonts I've tried are totally different from what I'm seeing displayed.
DUPLICATE CLARIFICATION - This question relates to cross browser differences in font weights, the question highlighted as possible duplicate relates to uploading font files correctly.
I'm uploading a site onto Wordpress using a child theme of html5blank and am getting variations of font-weights across different browsers which I'm not getting with just the stand alone front-end text files.
This is what I mean on text for a hover effect -
Chrome/Safari
Firefox (this is what I want)
I've tried to use the code from the answer of this stack question
body {
-webkit-font-smoothing: subpixel-antialiased;
}
But that hasn't worked. If I use font-weight: bold; then it works for Chrome but throws out Firefox and Safari. This is the font I'm using -
#font-face {
font-family: 'Gotham-Light';
src: url('fonts/Gotham-Light.otf') format('opentype');
font-weight: normal;
font-style: normal;
}
body {
font-family: 'Gotham-Light', sans-serif;
font-size: 16px;
-webkit-font-smoothing: subpixel-antialiased;
}
Is there any way I can fix this? The client is a design professional and was quite specific on stuff like this. Any help appreciated.
First, you should have all of the font types associated with that typeface for cross-browser compatibility:
CSS3 Web Fonts
You can actually make them here:
Font Squirrel Webfont Generator
And sometimes you cannot control how browsers will handle different fonts. Safari will act totally different than Firefox, etc.
Lastly: It does help to use actual font WEIGHTS instead of the default "bold" and "light".
Example:
body {
font-family: 'Gotham-Light', sans-serif;
font-weight: 300;
font-size: 16px;
-webkit-font-smoothing: subpixel-antialiased;
}
I hope this helps.
I'm currently working on a store on Tictail (it's not uploaded yet, so I don't have a link). I want to use the font PT Sans Narrow for the store, but there is a problem:
The font displays correctly in Safari and Firefox on my iMac, but when my friend tries it in Firefox and Internet Explorer on his PC, the font doesn't display correctly.
This is what I'm working with:
<link href="{{assets_url}}/shared/css/base.css" rel="stylesheet" type="text/css">
body {
background-color: #fff;
font-family: 'PT Sans Narrow', sans-serif;
letter-spacing: -0.02em;
font-size: 14px;
line-height: 1.5em;
color: #222;
-webkit-font-smoothing:antialiased;
height: 100%;
}
What is the problem and how can it be solved?
It's because Windows don't have 'PT Sans Narrow' as default font. You need to add this font like a web-font. For instance from Google Fonts.
Simplest way:
<link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow' rel='stylesheet' type='text/css'>
Put this at the top of your base.css. It will import PT Sans Narrow from Google Fonts.
#import url(http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700);
A webpage will always check to see if the user has the font installed on their computer. If they don't it will import it from Google Fonts.
I am using Google's Open Sans Font in my application.
I have defined the stylesheet as instructed:
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,700'
rel='stylesheet' type='text/css'>
I then used it on the body selector as:
body {
font-family: 'Open Sans', sans-serif;
}
I have not defined font family anywhere else. I assume that since I have defined it at the parent, the child elements will automatically inherit it.
However, if I open up the inspector for say an anchor tag in my application and see the computed styles for that tag, I find that (Chrome Latest) the "Rendered Font" says "Times New Roman 18 glyphs" - Is this correct? I was expecting it to say "Open Sans" - Is the Open Sans font not being applied?
Check out the codepen link. Its working fine for me !
.open-sans-font{
font-family: 'Open Sans', sans-serif;
}
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<div class="open-sans-font">
Stackoverflow rocks !!!
</div>
I have designed a template in wordpress and now I'm writing it in css/html but it seems the browser isn't using my font.
Photoshop:
Browser:
This is my css
h1 { font-size: 34px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; font-weight: 100; }
The font in photoshop is Lucida Grande regular.
Never use platform-specific fonts ( Mac-only / Windows-only fonts ) in website; it's quite different in representation between browser & the operating system itself. If a visitor of your website does not have the font, it will fallback to next font specified in your font-family font stack.
It's suggested to use web fonts in website. You can find similar font in Google Fonts as alternative.
Yet, the above does not apply to most of the non-Unicode languages, especially CJK (Chinese, Japanese and Korean. Take Chinese as example, since Chinese has a wide range of characters, it is not feasible to make a web font for Chinese, as the file size of the font will be very large. (there are some Chinese web fonts, but most of them are >10MB; no visitors have patience to wait a font to load for a minute before they can read a pretty font)
Thanks to all answers.
I fixed it using the "Lucida Sans Unicode" font and the "letter-spacing" css property.
For everyone that have my same problem, here's my solution.
h1 { font-family: 'Lucida Sans Unicode', sans-serif; font-size: 34.14px; text-align: center; font-weight: 100; letter-spacing: 0.6px; }