UPDATE: I used @brclz suggestion, solving my problem like this:
- Copied the GitHub address of each font file of the family,
Example:
https://github.com/h-ibaldo/Raleway_Fixed_Numerals/blob/master/font/rawline-100.woff
- Changed
github.com
in the URL toraw.githubusercontent.com
,
Example:
https://raw.githubusercontent.com/h-ibaldo/Raleway_Fixed_Numerals/blob/master/font/rawline-100.woff
- Created a CSS Stylesheet declaring all font weights and styles of the family, using the URLs as mentioned above,
Example:
@font-face {
font-family: 'rawline';
src: url('https://cdn.rawgit.com/h-ibaldo/Raleway_Fixed_Numerals/master/font/rawline-100.eot');
src: url('https://cdn.rawgit.com/h-ibaldo/Raleway_Fixed_Numerals/master/font/rawline-100.eot?#iefix') format('embedded-opentype'),
url('https://cdn.rawgit.com/h-ibaldo/Raleway_Fixed_Numerals/master/font/rawline-100.woff2') format('woff2'),
url('https://cdn.rawgit.com/h-ibaldo/Raleway_Fixed_Numerals/master/font/rawline-100.woff') format('woff'),
url('https://cdn.rawgit.com/h-ibaldo/Raleway_Fixed_Numerals/master/font/rawline-100.ttf') format('truetype'),
url('https://cdn.rawgit.com/h-ibaldo/Raleway_Fixed_Numerals/master/font/rawline-100.svg') format('svg');
font-weight: 100;
font-style: normal;
}
Pulled the stylesheet to the font's GitHub repo,
Embedded the font into the
<head>
of my HTML document, linking the stylesheet, also changing "github.com" to "raw.githubusercontent.com" in the URL, like this:
<link href="https://raw.githubusercontent.com/h-ibaldo/Raleway_Fixed_Numerals/master/css/rawline.css" rel="stylesheet">
- Then I used CSS rules to specify the font's family, weight and style,
Example:
font-family: 'rawline', sans-serif;
font-weight: 100;
font-style: italic;
It worked perfectly.
I also tried to import it into another stylesheet using
@import
like this:@import 'https://raw.githubusercontent.com/h-ibaldo/Raleway_Fixed_Numerals/master/css/rawline.css';
It also worked.
And here's the final GitHub project, in case you want to check it out:
https://github.com/h-ibaldo/Raleway_Fixed_Numerals
I just made a webfont version of Raleway family in which all text figures were replaced by the font's lining numerals, in order to solve once and for all the problem of using Raleway's lining numerals.
I also prepared the CSS stylesheet for it, and it solved my problem beautifully. Knowing that this is a problem other people have, I'll make the font files and CSS available via GitHub.
My question is: how can I use GitHub to also host the webfont in such a way that people intended to use don't need to host the font files, but import it, like Google Fonts @import option, for example:
@import 'https://fonts.googleapis.com/css?family=Raleway:400,700,900';
Or like Fontawesome does with a script:
<script src="https://use.fontawesome.com/28e4d6013b.js"></script>
Any thoughts?