how or if could I ship helvetica or similar fonts with my web-app? - html

I have a web-app (Java/HTML based) on cloud. Client will be accessing it in IE/Chrome or Mozilla.
I want to use Helvetica or any similar fonts but they are, by default, not available in systems (windows/IE/Chrome/Mozilla). Is there a way I can ship these fonts with my project?
Secondly are there any good free similar ones, which dont require licensing?
But most importantly, how is it possible technically? Do I put that as resource in my web-app? If yes, how? and would it then prompt users to download or install it - because thats a no (we cant ship installables with this product).
Thanks

Unless you have a license for the font, you can't include it with your project.
You can use something like
Google Fonts - free
Font Squirrel - free. Option to include fonts that you have licenses for.
Type Kit - different licensing options.
Font Squirrel is a good way to "package" it because it is just CSS + files for the fonts, as the others are cloud-based. You can filter by "web fonts" and then download the "Web Font Kit" which has everything you need. Easy!

To complement MikeSmithDev’s answer with a technical point: You can use the #font-face technique (described on many pages also frequently asked about at SO) just as you would on a web page, but you need not refer to font files in a server. You can simply include the .wof, .eot etc. files in the application package and refer to them with relative URLs, as in
#font-face {
font-family: 'Source Sans Pro';
src: url('sourcesanspro-regular-webfont.eot');
src: url('sourcesanspro-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('sourcesanspro-regular-webfont.woff') format('woff'),
url('sourcesanspro-regular-webfont.ttf') format('truetype');
}
body { font-family: Source Sans Pro }
Although expressions like “downloadable fonts” and “web fonts” are often used, the technique works fine this way, too, without needing any download (apart from getting the application of course) or Internet connection when using the application.
So the user will not be prompted for allowing download, and he does not need to install the fonts; they are directly used by the browser.

Related

Best method to load web fonts in case of caching and load time

There are several ways to embed a font on your web app.
Method A) Use google fonts CDN like this (in HTML):
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght#100&display=swap" rel="stylesheet">
Method B) Use your custom font like this (in CSS):
#font-face {
font-family: "Open Sans Regular";
src: url(../../fonts/OpenSans-Regular.ttf) format("truetype");
}
Method C) Convert your font to base64 string and use it like this:
#font-face {
font-family: 'Open Sans Regular';
src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAQeYABIAAAABv1gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAEHfAAAABwAAAAcaMGk4EdERUYAAOeAAAAAHQAAAB4AJgOxR1BPUwAA6XgAMk1MYsAAAAAyehMTA==) format('woff');
font-weight: normal;
font-style: normal;
}
Let's say I have 10 iFrames inside my web app and each one uses multiple fonts.
What are the pros and cons of each method for using inside the iframes?
If I want the best method for caching and load time which one do you recommend? I don't want that micro-moment that fonts are not loaded and the fallback fonts are used by the browser.
Note: Using Method C I can put all the fonts inside one CSS file and link it to each iframe.
Using a CDN for delivering your static files such as CSS, JS, images, and other files are commonly preferred. This is because once your files are cached on the CDN's edge servers, your site visitors will be delivered static content from the closest point of presence (PoP) instead of the origin server.
In the majority of cases, this shortens the distance between the client and the server and thus helps improve loading times without adding any additional HTTP requests. This also helps in other areas such as increasing redundancy, taking a load off the origin, etc.
Source
But it also depends on your site!
As Craig Buckler writes on sitepoint
CDNs are an incredibly useful resource but remember to consider the consequences. In practice, most sites will benefit if they load jQuery, the HTML5 shim, and font files from a public CDN. For busier sites, the speed improvements and cost savings of a private CDN are hard to ignore.

How to use a font installed in your computer, to a web site?

I am trying to use Helvetica Neue 55 Light, I have it installed on my computer.
However, it is not showing up on other people's PC's.
So I tried font-facing it from my computer, but I was told there was an issue with the url, that I was using a relative url (to the folder in which the site is contained, I am using Neocities so that folder is not* in my computer, and I don't know how to add the font to such online folder if there are any?) and that I must use an absolute url.
Help? :s
You need to create a font kit.
This site will do it for you: http://www.fontsquirrel.com/tools/webfont-generator
However, it will not let you use a copyrighted font. Not all the font files on your computer are authorized for web use, but you can buy the license from the creater (these typically have a high price tag).
If your font is installed locally, specifying where it is on your computer will not allow people to access it from your website. You're going to need to either upload the font files to your hosting server (in this case, Neocities); or, failing that, upload it to another static hosting service, such as dropbox, and specifying the URL of where the file is stored then.
EDIT: You're probably better off not using Helvetica Neue or any Adobe font, unless you're willing to fork out hundreds of pounds for it.
Fonts are licensed differently for desktop use and for web use. If you have it installed on your computer you probably have a desktop license, but likely not a web license. The formats are also different in many cases, so if you have the desktop font it won't work to just put it on your server, and like others have said, you also can't just convert it in some cases without violating the copyright.
MyFonts is one vendor that sells Helvetica Neue Light. If you go to the buying choices page, you'll see that there are lots of licensing options. Make sure you buy the Webfont option if you want to deliver it online. After you purchase, there should be some instructions on how to use it.
There's actually a really good discussion going on right now about some of the different methods of delivering web fonts. That might be worth checking out too.

Include Local Files in Browser Extension?

I'm currently developing a browser extension for Chrome and Safari. To be more specific, a tooltip appears when the user hovers over certain keywords. Currently, i'm using #font-face with a link to certain fonts hosted on my website. The problem is - they take a long time to load. Is it possible to include fonts locally in the browser extensions instead of linking to them externally? Can you just package the fonts (or even images?) with the other extension files?
Yes you can, it is quite common. Just make sure you have permissions to distribute all fonts/images that you did not author. Owning a personal license doesn't count.
Every extension is saved locally, whether the code that makes it function requires internet access and server-side scripting or not. A Chrome extension is just a directory saved as a crx archive, which is literally a renamed zip file. The directory, along with the necessary Developer info and metadata, is just like that of any other site, with html, and css, javascript, fonts, images, etc. Obviously if your extension does use server-side scripts, those need to be hosted. I'm sure you know most of this if you are building extensions, but I am elaborating so beginners can follow along.
Generally speaking, fonts are tiny files (rarely over 200k unless they are grunge type, or you are embedding way more characters than necessary) and so if they are self-hosted and taking too long to load, the problem is likely with your host. If I were you, I would use Google Fonts which don't need to be self-hosted and are free.
There are several ways
to embed them, no matter which you option you choose. But here is an example of how to link to fonts stored locally within the .crx file, <style> tags go between the <head> tags:
<style>
#font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url("fonts/OpenSans-Regular-webfont.woff") format("woff");
}
#font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 400;
src: local('Open Sans Italic'), local('OpenSans-Italic'), url("fonts/OpenSans-Italic-webfont.woff") format("woff");
}
</style>
Obviously, all paths are relative to the html file in your crx directory.

Can a purchased open type font be used as a web font?

I'm hoping to confirm that if I purchase an open type font from a foundry that I can then use it on the web by using the #font-face command.
Is this true?
That is correct, for more read this. But the client browsers need to support #font-face.

How to load self hosted font files if the GoogleFont service is unavailable?

I want to use a font collection from Google Fonts directory. I selected the styles and include the CSS link tag in my project's template.
Alternatively, with Google Fonts you can also download the collection, and what you get is a zip file with all the font's styles.
I can create a CSS equivalent of the one Google gives me to include in the HTML, so I want to provide the self hosted font files as fallback, if the visitor can't access the Google Font API.
How do I setup this, and preventing both the Google font file and the self hosted font file from being downloaded? If the user does has access to Google Fonts, it's browser shouldn't download the self hosted version of the font.
I would recommend just self hosting them. This is fontsprings' "bullet-proof" font-face syntax.
#font-face {
font-family: 'MyFontFamily';
src: url('myfont-webfont.eot?#iefix') format('embedded-opentype'),
url('myfont-webfont.woff') format('woff'),
url('myfont-webfont.ttf') format('truetype'),
url('myfont-webfont.svg#svgFontName') format('svg');
}
Having all four of these set will ensure that it works across browsers. Just make sure to have your font in all four types. Font Squirrel has great kits for fontface as well.
You have 3 options:
Use 2 sets of #font-face at-rules, using different font-family names (e.g. "Droid Sans" and "Droid Sans Local"), and then using a font stack like "Droid Sans", "Droid Sans Local", Helvetica, Arial, sans-serif. However, this will cause both fonts to be downloaded, increasing load time.
Use a single set of #font-face at-rules, but use 2 sets of src attributes. This too may increase loading time if the browser decides to download all the font files specified.
Do mirroring at the network layer via DNS, like most CDNs do. This requires network setup, but your CSS would be unchanged, and it's most transparent to the browser, requiring no extra downloads.
Google Web Fonts is already employing the 3rd option, so I personally wouldn't bother if you're already using a CDN-hosted source. But it may be worthwhile if you're using fonts from a less reliable source. But if you're going to go through the effort to set this up for your fonts, why not set it up for all of your static resources (images, stylesheets, JS, etc.)? The most logical course of action is to just get a free or paid CDN to host all of your static assets on.