I have the following structure for my CSS:
index.html
css
--fonts
----roboto
------roboto-italic-demo.html
------roboto-italic-webfont.woff
------roboto-italic-webfont.woff2
------stylesheet.css
--main.css
stylesheet.css
contains the following CSS
@font-face {
font-family: 'robotoitalic';
src: url('roboto-italic-webfont.woff2') format('woff2'),
url('roboto-italic-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
roboto-italic-demo.html
is a demo page with the entire alphabet characters displayed using font-family: 'robotoitalic';
. Here the g appears like it should.
main.css
contains the following css
@font-face {
font-family: 'roboto';
src: url('fonts/roboto/roboto-bolditalic-webfont.woff2') format('woff2'),
url('fonts/roboto/roboto-bolditalic-webfont.woff') format('woff');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: 'robototest2';
src: url('fonts/roboto/roboto-italic-webfont.woff2') format('woff2'),
url('fonts/roboto/roboto-italic-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
index.html
includes the main.css
stylesheet. Using font-family: 'roboto'; font-style: italic;
cuts off the right side of the g character. using font-family: 'robototest2';
cuts the right side of the g character as well.
Here's what I tried in order to fix the issue:
Redownload
roboto-italic-webfont.woff
&&roboto-italic-webfont.woff2
Put
"Comic Sans MS"
as a fall back to make sure I was actually usingroboto
orrobototest2
Added letter-spacing
Placed the g character within a span with padding
edit:
This question was marked as duplicate. The question linked referred to text protruding from its container, where as this one is about a character being cut-off no matter its position within any tag. For example, this html
<p><em>This g is being cut off on its right side</em></p>
results in