Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In CSS the Bottom Part of my Custom Fonts are Getting Cut Off (the g's and y's)

Tags:

html

css

I can't figure out why letters that drop below the line (like g and y) in my paragraph are getting cut off. I tried setting the line height higher but it still cut them off. I played with font-size in px, pt, and em but still no luck. Now when I set the font-size much larger (like 3.0em) the problem disappears. But I need the font to be about this size.

Here is the link: http://sportegy.com/font-test/font-test.html

You'll need to use the link and see the .ttf font I have in order to really see the problem. However, I'll paste my HTML here too.

<html>
<head>
<style>
@font-face {
font-family: lib-font;
src: url('css/LiberationSansNarrow-Regular.ttf');
}
@font-face {
font-family: lib-bold;
src: url('css/LiberationSansNarrow-Bold.ttf');
}   
</style>
</head>
<body>

<span style='font-family: lib-font;color: #232322;font-size: 1.0em;'>   
The quick brown foxy was jumping over the green doggy.<br/>
The quick brown foxy was jumping over the green doggy.<br/>
The quick brown foxy was jumping over the green doggy.<br/>
The quick brown foxy was jumping over the green doggy.<br/>
The quick brown foxy was jumping over the green doggy. 
</span>

like image 573
Thread7 Avatar asked Feb 11 '13 01:02

Thread7


3 Answers

Try

line-height: normal;

Seemed to fix a few people's problems.

like image 84
Daniel Imms Avatar answered Nov 10 '22 17:11

Daniel Imms


Try increasing the line-height to something like line-height: 1.2;

If you bump the font size up to 1.1em, it doesn't get cut off.

I suggest using a CSS reset like Normalize.

like image 38
Jeff Miller Avatar answered Nov 10 '22 18:11

Jeff Miller


I can only reproduce it at exactly 16px (1em on my browser), so I suspect a font issue like the one described here and here.

You could use the font as-is and avoid 16px, fix the font metrics yourself (as described in the links), email the font creator, or choose a different font. Lots of good free fonts out there, all the best :)

like image 35
nzt Avatar answered Nov 10 '22 19:11

nzt