how to use font face attribute to html without using html? - html

I am in a condition where I cannot use spreadsheet like CSS , but I want to use font face in HTML but how can I add external fonts here only using HTML.
#font-face{
font-family: diploma;
src: url('../fonts/diploma.ttf');
}
here i can use src but how can i use src and Font face in HTML

The obsolete <font> element allowed you to specify the name of a font which a browser will try to load from the user's system.
Support for external font files was first implemented using CSS and has never been available without CSS.
In short: You can't.

Related

Prevent Google Chrome from using local fonts

I am using the Raleway font on my website but unless I have the font installed on my local desktop, it does not display properly. Specifically, the weight is always bold. I've had others report this as well. From what I can tell it's because Google is trying to use my desktop fonts for performance but is there any way to prevent this on my site with either CSS or JS? A solution that wouldn't involve changing browser settings. What's strange is that the fonts are displaying properly on Googles Font library. and yes, I see this issue on other websites that us the Raleway font.
The default Google Font APIs include src: local(<font>), which causes the browser to look for the local files before downloading the web font. If you really want to prevent this, you can create your own #font-face declarations and omit the local directives. Use something like the Google Web Font Loader to get the appropriate #font-face declaration, as the Google Font APIs only return the font files for your specific browser and I assume you want to be compatible with all browsers.
Are you importing just the bold style for Raleway? Check that you have 400 (normal) on the import URL for the font. Should look something like this:
https://fonts.googleapis.com/css?family=Raleway:400,700
(that gives you normal and bold)
It is because you do not select desired font-weight. If you inspect that google css file fonts.googleapis.com/css?family=Raleway:300,400,700 you see that last #font-face have font-weight: 700;. In css last #font-face takes precedence over prior definitions. If you do not specify exact font-weight, browser will choose its default - in your example it is bold (700) because it is defined last.

HTML using unknown font

I downloaded a font which I would like to use on a webpage. Of course this font isn't installed on the user's computer. How can I let a user's computer display that font? (I thought is was called: embedding a font but I could be wrong)
Thx for any help
VVW
You need to use #font-face.
A very easy way to generate the required cross-browser CSS and different formats of font file is to use:
http://www.fontsquirrel.com/fontface/generator
You simply upload your font and the generator does all the hard work.
If the users have a relatively new/up-to-date browser:
#font-face {
font-family: font-name
src: url(path/to/font.ttf);
}
element {
font-family: font-name;
}
First, we add the #font-face declaration wherein we specify the path, filename, and font-family name for our custom font. Then we add the font choice in a CSS rule to our...element.1
Citation:
A List Apart: Taking Advantage of HTML5 and CSS3 with Modernizr.
References:
#font-face, Mozilla Developer Center
CSS #ten, by HÃ¥kon Wium Lie
You are right that is called font-embedding. Here is what you need:
Embedding fonts in CSS

HTML how to use different fonts

if i place my ttf font file in my websites root folder lets say named AMC.tff and in my website use <font face="AMC"> is it going to work... if not than what is the method to use unusual fonts in your website
You can include True Type Fonts with the help of the CSS 3 property #font-face. The following CSS would apply your AMC font to all <h1/> tags:
#font-face {
font-family: "AMC";
src: url("./AMC.ttf") format("truetype");
}
h1 {
font-family: "AMC", sans-serif;
}
For browsers that have no support for webfonts you should specify a similar alternative to your font. In the above example sans-serif would be used if AMC cannot be found because the #font-face tag was not recognized by the browser.
No, the fonts in a browser is based on fonts installed on the visitor's machine.
I don't know much about this area, so I can't tell you which one of these works or is considered best practices, but check out:
SiFr
typeface.js
Cufon
No. Apart from the fact that <font>is deprecated, you have to use the CSS3 #font-face directive, or older more compatible methods such as Cufon and Sifr.
If you need to use Custom Font for your site, you can give a go for Cufon
http://cufon.shoqolate.com/generate/
Detailed Tutorial for using CUfon on your site
http://net.tutsplus.com/articles/news/the-easiest-way-to-use-any-font-you-wish/
Forgot to add, You can also use CSS3 property
#font-face
Supported by FF3.5 and above, Opera 10 and above, IE 7,8(not sure about 6)
Check this link out:
How to get non-standard font with effect in use of web site?
I have explained in detail how to embed fonts in a webpage and make it browser compatible.
Font embedding is also a risky affair, as the font license sometimes doesn't allow.
PS - And please make sure that you don't repeat questions in stackoverflow as this question has been answered many times.

font face properties of font selector is not working in my website

I m getting a problem while embedding a font in my web site i m using a css3 rule of font selector code is
#font-face {
font-family:'VoltaEFTU-Regular';
src: url(/fonts/VoltaEFTU-Regular.ttf) format("truetype");
}
.sample { font-family: 'VoltaEFTU-Regular'; font-size: 10em; }
I put my volta font in truetype format in fonts folder of my website folder but its not working
my html code is :
<div class="sample">
typetrigger
</div>
Check if the ttf file is at the location you point to.
You should use firebug to check if your font gets applied in the css.
If yes, your font is not loaded.
If no, then the css class is not applied or overwritten by something else.
Firstly, you need to add comas to the src. It should be:
src: url('fonts/VoltaEFTU-Regular.ttf') format('truetype');
I also would recommend heading over to font squirrel though, and creating a woff and eot files to use along side the ttf.
You can read up on all the different formats here:
http://www.fontsquirrel.com/fontface/generator
Code looks good. I agree with Thariama. Try specifying the path relatively to your CSS instead of absolute (../fonts/VoltaEFTU-Regular.ttf) if your css file is in a subdir of your web root. Also, make sure the browser you are testing in supports #font-face and truetype fonts

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;
}