I've looked at some other threads and none of those solutions worked for me so I decided to start a new thread.
I'm trying to use a custom downloaded font on my project, locally work fine, but on the Github page, the font doesn't show up.
Here's the code I added to the CSS file and works on the local project.
#font-face {
font-family: 'BadDogSCapsSSKBold';
src: url('/font/BadDogSCapsSSKBold.svg#BadDogSCapsSSKBold') format('svg'),
url('/font/BadDogSCapsSSKBold.ttf') format('truetype'),
url('/font/BadDogSCapsSSKBold.woff') format('woff');
font-weight: normal;
font-style: normal;
}
As mentioned above, I tried some options that other people said was working, but with no luck, I've tried these three methods:
./font
../font
../../font
Here is the local project structure from my IDE
And here is the folder structure on Github, although I've pushed the project straight from Pycharm, so I wouldn't expect an error there, and yes, the style.css file is there in the css folder.
Now it works, the problem was in part the path used initially, but mostly caused by the extra time that the Github page was needing to get updated.
All the pages I've created in the past were fully working as soon as they were showing a green check next to the link and marked as active, like below, and this for me has never been more than 5 minutes as they are small projects, but this time took more than 3 hours.
In the end, the option that worked for me both locally and remotely was by adding ../ in front of the path, like this.
#font-face {
font-family: 'BadDogSCapsSSKBold';
src: url('../font/BadDogSCapsSSKBold.svg#BadDogSCapsSSKBold') format('svg'),
url('../font/BadDogSCapsSSKBold.ttf') format('truetype'),
url('../font/BadDogSCapsSSKBold.woff') format('woff');
font-weight: normal;
font-style: normal;
}
The reason I couldn't figure it out quickly was that when I saw the ../ method not working after one hour, and the other thread saying that in 2022 you should use the ../../ method, I didn't give it enough time, in the other end, the ../../ method, for me doesn't work at all, either locally or remotely, and I let it all night just to be sure.
Related
Using canvas to generate text for some Trading Cards (Its a community project)
And I needed the Andy Font. However there are no stable web serving locations.
So I went with github. I placed all my font formats inside this repository folder:
https://github.com/FunctFlow/TerrariaTradingCards/tree/master/andy%20font%20family
Then I used this font-font inside of my project:
#font-face {
font-family: "Andy";
src: url("https://github.com/FunctFlow/TerrariaTradingCards/raw/master/andy%20font%20family/Andy-Bold.eot");
src: url("https://github.com/FunctFlow/TerrariaTradingCards/raw/master/andy%20font%20family/Andy-Bold.eot?#iefix")
format("embedded-opentype"),
url("https://github.com/FunctFlow/TerrariaTradingCards/raw/master/andy%20font%20family/Andy-Bold.woff2")
format("woff2"),
url("https://github.com/FunctFlow/TerrariaTradingCards/raw/master/andy%20font%20family/Andy-Bold.woff")
format("woff"),
url("https://github.com/FunctFlow/TerrariaTradingCards/raw/master/andy%20font%20family/Andy-Bold.ttf")
format("truetype");
font-weight: bold;
font-style: normal;
}
However, my project does NOT render the andy font, as you can see in this codepen: https://codepen.io/SkylerSpark/pen/bGVBpmj
I love how solutions always appear minutes after Ive given up and come here.
Basically, Github serves the wrong filetype headers, and the website cant recognize the font-formats.
So you cannot use Github for font formats, similarly to how you cant use it to host Javascript or CSS or whatever else you need to reference through http.
The best solution I can think of is to use a tool like jsDelivr to reference the fonts. As seen here: JsDelivr Github
And using a link like this:
https://cdn.jsdelivr.net/gh/FunctFlow/TerrariaTradingCards#master/andy%20font%20family/Andy-Bold.ttf
My fonts now render successfully
I'm currently trying to fix an issue with my portfolio website. I use a custom font to keep the page looking good, but for some reason #font-face refuses to work.
Here's my CSS:
#font-face{
font-family: 'Quicktype';
src: url('Fonts/quicktype_condensed-webfont.woff2') format('woff2'),
url('Fonts/quicktype_condensed-webfont.woff') format('woff'),
url('Fonts/QuickType Condensed.ttf') format('truetype'),
url('Fonts/QuickType Condensed.eot'),
url('Fonts/QuickType Condensed.eot?#iefix') format('embedded-opentype'),
url('Fonts/QuickTypeCondensed.svg#QuickTypeCondensed') format('svg');
font-weight: normal;
font-style: normal;
}
Here's a link to my website:
http://alfabitsgamedev.com/
And here's a link to my github file hierarchy.
https://github.com/Alfabits/alfabits-game-dev-3
I've tried using as many font file types as I can, but it's not working on any of the browsers I use. I've tried different font directory paths, but that doesn't seem to work either. I've also looked around and none of the solutions I've found have solved my problem.
The website always returns with either a 404 Error for the .ttf, .woff, and .woff2 fonts (never the other fonts, for some reason), or a weird GET error.
I know I can't use .htaccess files, since github pages hosts only static stuff and can't do server side logic. So I'm kind of lost as to why this is happening and how I can fix it. Thanks in advance, if you can manage to help.
I found the solution! I was using Absolute Links instead of Relative Links. Relative Links make the intended path start from where the currently-used file is located, and needs to start with a '/'. Absolute Links will start the intended path starting from the system's root folder, not the file's.
Find more here: coffeecup.com/help/articles/absolute-vs-relative-pathslinks
Also, credit to Frits for the solution!
Unrelated answer, in case anyone comes across this issue. Make sure that you have a .nojekyll file in the root directory of your github-pages branch/dir if you have any directories that start with _, such as the ones that webpack creates: ./_/node_modules/#fortawesome/....
https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/
I'm using the Meteor framework, and have the following in my main.scss file:
#font-face {
font-family: 'GrandHotel-Regular';
src: url('GrandHotel-Regular.eot');
src: url('GrandHotel-Regular.woff2') format('woff2'),
url('GrandHotel-Regular.woff') format('woff'),
url('GrandHotel-Regular.ttf') format('truetype'),
url('GrandHotel-Regular.svg#GrandHotel-Regular') format('svg'),
url('GrandHotel-Regular.eot?#iefix') format('embedded-opentype');
font-weight: normal;
font-style: normal;
}
h1 {
font-family: 'GrandHotel-Regular';
}
This isn't working and when I inspect the selected font, the family is GrandHotel-Regular just as it should be, but the console says it's rendering as Times New Roman.
I'm using Chrome on Ubuntu, and it's an older version that can no longer be updated because my laptop is so old, however I don't think this is causing the problem, since things like this have worked for me in the past.
What could be going wrong?
Other questions, like this one:
Font coming out as Times New Roman in Older Browsers
or this one:
Font proxima_novalight is rendered as Times New Roman
aren't addressing the same problem.
The urls for your fonts don't have any folder as part of the filepath, which means they have to be in the same folder as your CSS file. Are they really? (If not, add the folder/filepath)
How is your project set up? Check the network tab in the developer tools to make sure the fonts are actually being loaded. If not, recheck your URLs to make sure they are pointing to the right files.
Your code looks completely fine so if your project setup is not the problem, try using a different browser and see if you can reproduce the issue.
Good morning!
My Team and I spent most of yesterday trying to figure out why that when I started the server yesterday morning, the website I was working on came up with every font on it displaying Times New Roman. The site is written in JSF utilizing an Eclipse Workspace, so we at first thought it was an issue with the Workspace, since the site was showing up correctly for one of my coworkers.
After hours spent rebuilding and debugging the Workspace, we came to the conclusion that it was either the code or the browser. I spent about an hour looking through the code, but could not find any issue that would cause our problem, so we concluded it was the browser. That was when one of my coworkers suggested that the person for whom the site was displaying fine on, update to the latest version of Chrome - which caused the fonts to break.
That latest version is: 38.0.2125.104 .
The code that is embedding the fonts looks like the below (the JSF resource tag just renders an HREF from the library):
#font-face {
font-family: 'aleoregular';
src: url(#{resource['lib:library/ui/fonts/aleo/aleo_regular_macroman/Aleo-Regular-webfont.eot']});
src: url(#{resource['lib:library/ui/fonts/aleo/aleo_regular_macroman/Aleo-Regular-webfont.woff']}) format('woff'),
url(#{resource['lib:library/ui/fonts/aleo/aleo_regular_macroman/Aleo-Regular-webfont.ttf']}) format('truetype'),
url(#{resource['lib:library/ui/fonts/aleo/aleo_regular_macroman/Aleo-Regular-webfont.svg']}) format('svg');
font-weight: normal;
font-style: normal;
}
Or, it would look like this in CSS without the JSF:
#font-face {
font-family: 'sinkin_sans600_semibold';
src: url('../fonts/sinkin-sans/sinkinsans_600semibold_macroman/SinkinSans-600SemiBold-webfont.eot');
src: url('../fonts/sinkin-sans/sinkinsans_600semibold_macroman/SinkinSans-600SemiBold-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/sinkin-sans/sinkinsans_600semibold_macroman/SinkinSans-600SemiBold-webfont.woff') format('woff'),
url('../fonts/sinkin-sans/sinkinsans_600semibold_macroman/SinkinSans-600SemiBold-webfont.ttf') format('truetype'),
url('../fonts/sinkin-sans/sinkinsans_600semibold_macroman/SinkinSans-600SemiBold-webfont.svg#sinkin_sans600_semibold') format('svg');
font-weight: normal;
font-style: normal;
}
On Firefox's console, I am getting this error:
"downloadable font: FTTM: misaligned table (font-family:....)"
Any advice would be much appreciated.
No definitive answer, but some things to try/check...
There is no problem that I have found with the new Chrome version and fonts.
You will be getting times fonts (actually 'serif') because that is the browser default if no font is set.
I take it your web fonts are being loaded from a local server and not the internet, and that therefore you can check that those font files exist and haven't become corrupted. Even if they are coming from the web somewhere, the next step is the same...
In Chrome, open the dev tools, and you should be able to see in the Network panel if the font file(s) are being requested and served up.
For a good call, Chrome will show the served font in the Preview tab when you click on the network call. If you see nothing there, check the response headers. You will need a Content-Type of something like font/woff2 or application/x-font-woff or similar.
You can also see from the network panel whether the files are being served from cache or not. It could be that the problem is not a Chrome version change as such, but that upgrading cleared the cache or the assets just naturally became cache expired and now are trying to fetch the problematic versions.
Could you be gzipping the font files, for example now, where you were not before (or vice versa)?
One of our guys figured it out! There was a server configuration filter that was corrupting the font files, they were able to modify the pom.xml file to get it all working again.
I hope I'm asking this question in the right place,
I'm working on a website for a friend, here's the site hosted on my goDaddy acc:
http://www.andkensol.com/rowanWeb/
And here it is on my friends:
http://www.rowanmoore.org/
You can see the clear difference in the title font. If you inspect them you'll see they are both using CODE. I personally uploaded all the files myself and the file structure, layout, file paths are all identical yet the font won't render on my friends site.
I downloaded the font from font squirrel and I'm using #font face to implement it in both sites.
CSS
#font-face {
font-family: CODE;
src: url('font/CODE Light.otf');
}
#nameTitle{
font-size:60px;
font-family:CODE;
color:white;
font-weight:400;
margin-bottom:-3%;
}
The 'font folder' is in the same folder as the stylesheet and CODE Light.otf is in the font folder.
Ive deleted the site from my friends server, downloaded it from mine and then uploaded it to my friends and still no luck.
Could this be a problem on goDaddy's end perhaps?
I recommend you to use some webgenerator to generate css file with different formats of font.
I think your problem is wrong #font-face.
#font-face {
font-family: 'nfs';
src: url('yourFont.eot');
src: url('yourFont.eot?#iefix') format('embedded-opentype'),
url('yourFont.woff') format('woff'),
url('yourFont.ttf') format('truetype'),
url('yourFont.svg#yourFontName') format('svg');
font-weight: normal;
font-style: normal;
}
Diffrenet browser need other format to render and open font.
I'm using mostly those three webfont generators
http://onlinefontconverter.com/
http://www.fontsquirrel.com/tools/webfont-generator
http://convertfonts.com/
But there is more, type to uncle google "font generator"
EDIT: i think blank space in your font/CODE Light.otf is the problem try to use for example something like this font/CODE_Light.otf
I guess it's a matter of access rights of your folders/files.
Something like 644 would be necessary for a file to be able to access the font from the outside web (the last 4 => read access for public). You can either use chmod on the console or change the rights in your ftp-client.
Also, you should support more than otf, or you will most likely lock out a significant amount of Internet Explorer Users.