HTML CSS - custom fonts - html

I found a service that allow me to download web fonts:
https://www.fontsquirrel.com/fonts/daniel
I am not a web developer but I am helping to someone to figure out what went wrong.
Here is a web site that uses custom fonts: http://senschild.com
I've implemented:
#font-face{
font-family: 'Daniel-Regular';
src: url('../fonts/daniel_regular_macroman/Daniel-Regular-webfont.eot');
src: url('../fonts/daniel_regular_macroman/Daniel-Regular-webfont.eot?iefix') format('eot'),
url('../fonts/daniel_regular_macroman/Daniel-Regular-webfont.woff') format('woff'),
url('../fonts/daniel_regular_macroman/Daniel-Regular-webfont.ttf') format('truetype'),
url('../fonts/daniel_regular_macroman/Daniel-Regular-webfont.svg#webfont') format('svg');
}
but it does not work for me. The font is still system on the page.
What I did as well:
I also fixed this one as you said and fixed this part '../ as we don't need to move up as Maneesh said. Also I've edited css by removing font-family:JakobCTT; from body, but still does not work. I even added english words assuming that the font only for english characters.

The font files you are using appear to be corrupt, as Failed to decode downloaded font indicates. I've had this problem many times before when using the webfont generator on https://www.fontsquirrel.com.
Edit:
If you download the .OTF file and generate the webfont with https://www.web-font-generator.com/ it appears to work just fine.

Here is your fix:
Add style to the html elements you want to apply the font for. If you want the font to be applied for the whole webpage, then add the following style for body tag either in html or css.
font-family: 'Daniel-Regular';
Try this:
url('../fonts/daniel_regular_macroman/Daniel-Regular-webfont.eot?#iefix')
instead of
url('../fonts/daniel_regular_macroman/Daniel-Regular-webfont.eot?iefix')
There should be a ?#iefix not just a ?iefix

Related

Including Font in HTML with <span style>

I'm trying to include a font in my HTML code, but I'm not able to do it. The font is this one:
It has several "sub-fonts", and I want to choose between them, but I'm not able idk why. Other fonts that also has "sub-fonts" work as expected, eventhough I cannot choose between "sub-fonts"
I wrote the following code to test:
lang=html"<span style="font-family:Formula1 Display-Regular; font-size:2em">Safety Car</span>
First of all I wanna know if it is possible to put the font without using CSS. The second is, how am I supposed to do it (using HTML if possible, and also CSS?
Use #font-face and it will work as you expected. Check for typo in font-name make sure to use correct punctuations.
#font-face{
font-family:"formula1-display-regular";
src:url("https://candyfonts.com/wp-data/2018/10/26/11543/Formula1-Regular_web_0.ttf") format("woff"),
url("https://candyfonts.com/wp-data/2018/10/26/11543/Formula1-Regular_web_0.ttf") format("opentype"),
url("https://candyfonts.com/wp-data/2018/10/26/11543/Formula1-Regular_web_0.ttf") format("truetype");
}
<span style="font-family:formula1-display-regular;font-size:2em">Safety Car</span>
Codepen link
PS: This snippet might not work here, but will work on the above codepen link.
When you use external fonts in your web development you have to Import that font in your CSS file. But sometimes CDN links are not available for some fonts. So in that case you have to use the #font-face property to use that font and import that font from local files.
I have provided #font-face CSS for formula1 font. So you have followed some steps.
Copy this #font-face CSS code which I provided below and paste it into your CSS file.
After that visit this Website and download .ttf file, add this file to your project folder.
Now you can use the external font.
A. For more details about #font-face property Click here Now
B. And for Video tutorial Click here Now
Note: Please make sure that your file path is correct
#font-face{
font-family:"formula1-display-regular";
src:url("https://candyfonts.com/wp-data/2018/10/26/11543/Formula1-Regular_web_0.ttf") format("woff"),
url("https://candyfonts.com/wp-data/2018/10/26/11543/Formula1-Regular_web_0.ttf") format("opentype"),
url("https://candyfonts.com/wp-data/2018/10/26/11543/Formula1-Regular_web_0.ttf") format("truetype");
}

How to upload your own font on html?

i remember my IT teacher saying something about if i wanted to download my own font and put it on my website i will need to upload the font file as well. Thats straightforward but if i wanted to host my website how would i go about this?
Thanks
The way you control the fonts used in you HTML is through CSS. To use a custom font, you must first define it in the CSS like so:
#font-face {
font-family: myFirstFont;
src: url(somefont.otf);
}
After defining it, you can use it by applying it in other CSS like so:
div {
font-family: myFirstFont;
}
The font files that are generally used are TrueType (.ttf) or OpenType (.otf). There are other types that a proprietary, such as *.eot (Internet Explorer).
You will need to upload these font files along with the other files such as .html, .css, .js etc.
There are few ways to implement font on a website, but first I would strongly recommend reading few articles as using font-face, base64 embedding fonts in css and Getting started with Google fonts. I am sure everything will be clear than.
In order to make add costum font support for all type of browser then you should firstly convert the costum font to other font formats like eot, woff, etc. There are a couple of online converters that do that (they will autogenerate actualy the css rules to add to your site.
#font-face {
font-family: 'icomoon';
src:url('fonts/icomoon.eot?-jvpy8e');
src:url('fonts/icomoon.eot?#iefix-jvpy8e') format('embedded-opentype'),
url('fonts/icomoon.woff?-jvpy8e') format('woff'),
url('fonts/icomoon.ttf?-jvpy8e') format('truetype'),
url('fonts/icomoon.svg?-jvpy8e#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}

Issue using #font-face css referencing the downloaded font to display on html page

This is work in progress, but I've uploaded the code here
http://crea8tion.com/ChristmasMessage/index.html
I've downloaded and placed the font MerryXmas.ttf into the root directory where my index html document is held.
In css I've added
#font-face{
font-family: "MerryXmas";
src: url('MerryXmas.ttf');
}
h4 {
font-family: MerryXmas;
}
But the font should look like this http://www.dafont.com/merry-xmas.font but you will see it doesn't. The site is built using a foundation 5 framework, but I've removed the style link at the moment to make sure that wasn't impacting the font.
From using Google console as far as I can see the font is being referenced correctly, just not sure what I'm over looking?
Change src: url('MerryXmas.ttf'); to src: url('../MerryXmas.ttf'); and try again
the font path must be relative to the CSS file

Font-face in IE

I know that these questions are very often asked, but I wanna know what is wrong with my code.
When I try to load the font, IE wont display the font.
Here is my code:
#font-face {
font-family: CalistoMTItalic;
src: url('../fonts/CALISTI.oet');
src: url('../fonts/CALISTI.oet?#iefix') format('embedded-opentype'),
url('../fonts/CALISTI.TTF') format('truetype');
}
Does anybody know the mistake?
The mistakes include:
mistyping file name extension .eot as .oet
using just EOT and TTF formats
not contacting Microsoft regarding legal use of their font
The correct extension is eot, not oet.
Also, make sure the path to the font files is relative to the url of the css file.
If that doesn't fix your issue then please see related topics on StackOverflow - I see at least 4 with an almost identical title in the "Related" column on the right-hand side of this question.

How can I make my users automatically download the font I use for my website if they don't have it?

My website uses the font ff-clifford-eighteen-web-pro-1. I want all my text to be displayed using that font even for the users that don't have it installed on their machine.
Is it possible?
You can use the #font-face generator. It allows you to upload your fonts and it will create a nifty .zip download with CSS and all the related files you need to get your custom font working for your site.
http://www.fontsquirrel.com/fontface/generator
They also have a whole lot of licensed font-kits ready for use on your site too:
http://www.fontsquirrel.com/fontface
Another great site that allows you to "lease" licensed fonts is TypeKit.
http://typekit.com/
You can't. If the font is not on the system where the browser is, the font will not be found and cannot be loaded.
You will need to distribute the font to the client systems (if you have the licensing to do that).
Short answer: you can't
Long answer: you could, but it's not easy and not widely supported. Read this article for more information.
I use Cufon. Works great, but you also have to verify licensing.
Here is a link to A million ways to embed custom fonts (and keep typography nerds off your back)
He recommends sIFR3
With the font stored in a font folder (ex: fontFolder), you would use the #font-face generator to automatically make the user download the font so it would appear wherever on the site you specify. Below, fontFolder represents the directory (folder) where the font files live, and fontName represents the font name (sitting inside the fontFolder). If you currently have the .eot .tff .woff, and .svg variations of the font stored in the fontFolder, you can copy the below code into the top of your style sheet and replace fontFolder with your own directory's name, and replace fontName with the name of your font:
#font-face {
font-family: "fontName";
src: url('fontFolder/fontName.eot');
src: url('fontFolder/fontName.eot?#iefix') format('embedded-opentype'),
url('fontFolder/fontName.woff') format('woff'),
url('fontFolder/fontName.ttf') format('truetype'),
url('fontFolder/fontName.svg')format('svg');
}
When you're ready to use your font, just use its name:
h1 {
font-family: yourFont;
}