11
I would like to use a Google source without needing Connection (internet). I saw that the @font-face
has this power. Just download the source in one of the formats (I preferred the .EOT
also accepted by IE Browser) and declared as follows:
@font-face {
font-family: 'VT323';
font-style: normal;
font-weight: 400;
src: url('../fonts/VT323-Regular.eot');
src: url('../fonts/VT323-Regular.eot?#iefix') format('embedded-opentype'),
url(‘../fonts/VT323-Regular.ttf’) format(‘truetype’);
}
Where url
is where the source file is located.
And to make use of it one should only call the font-family
, obviously, with the name stated in @font-face
:
.home-text {
font-family: 'VT323', cursive;
text-align: center;
font-size: 1.4em;
}
However, I still can’t enjoy the VT323 source. The above codes are original from my project. Below is the file directory structure (additional information):
Try to use all formats, this helps even compatibility
– Erlon Charles
Tried to add the
font-weight: 400
also in the.home-text
?– bfavaretto
I tried it now and it didn’t change the scenery.
– Phellipe Lins
Try to convert font to web fonts format, use this site to convert http://www.fontsquirrel.com/tools/webfont-generator
– Leandro Costa
try using fonts/VT323-regula...' instead of'.. /fonts/VT323-regula...'
– George Moura
@Leandro, I’ve used this site to convert from.ttf to.eot, it doesn’t make sense to convert again. George, didn’t change the scenario. There is a class in this same '.css' file that uses an external file at the same level as this source. The source of it was the way I 'replicated' in the doubt code.
– Phellipe Lins
It works if you put the font in the same directory as the CSS file (and change the declaration
font-face
to reflect this)? What would be the situation where you would use this? Would it be possible to install the source on the system? If so, is it no longer practical that way? Which browser are you using?– Alessandro Delgado
Have you tried changing font names to small font and obviously updating the url? According to W3schools, capitalized fonts can have strange behaviors, especially in IE. I noticed that in the last declaration of the property src has ‘ instead of '. It may be nothing, but it maintains consistency. EDIT I just noticed that the source code has the name VT323-Regular.eot but the image with the directories has the name VT323-regular.eot. Change to reflect reality if it is not a misspelling when creating the image.
– josepostiga
@josepostiga to w3schools is not a good reference
– Felipe Avelar
I put the files in the CSS folder and made the appropriate changes including renaming them to lower case. No change in scenario. *** I think this is one of those obvious mistakes that is not easy to see... rsr
– Phellipe Lins
Google Fonts detects the user agent when loading the fonts: Have you downloaded the code using more than one browser? Still, if the code is really the original, why does it have 'curved quotes' in it?
– Gustavo Rodrigues
@Phellipelins recently solved a similar problem. The solution is in the Answers below. Anyway I copied and pasted your CSS into a file and made a hexdump -x and the character ' (plic) used in your solution in the section
@font-face
seems to be wrong.– João Paraná