In terms of performance, which is better?
Using fonts something like this:
<<link href='https://fonts.googleapis.com/css? family=Fira+Sans:300,400,500,700,300italic,400italic,500italic,700italic&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
Or, should I upload the fonts to my hosting and then download them from there?
There are pros and cons to each approach. Using Google Fonts has the advantage of being easy to implement and maintain. It allows you to benefit from Google's reliable hosting and delivery network, resulting in faster loading times for your website.
On the other hand, uploading fonts to your own hosting gives you more control over the fonts and eliminates any dependencies on third-party services. This can be beneficial if you have specific font requirements or if you want to ensure consistent font availability even if the Google Fonts service is temporarily unavailable.
Overall, using Google Fonts is generally recommended for most situations, especially if you prioritize ease of implementation and performance. However, if you have specific needs or concerns regarding control and availability, self-hosting the fonts may be a better option.
here are some additional factors to consider when deciding whether to use Google Fonts or self-host the fonts:
1. Customization: Using Google Fonts may limit your ability to customize the fonts extensively. If you require more control over font styling, self-hosting can provide greater flexibility.
2. Page speed: Google Fonts are typically served via a content delivery network (CDN), which can improve loading times. Self-hosted fonts may add an extra HTTP request, potentially slowing down your website. However, optimizing the font files and using caching techniques can mitigate this issue.
3. Bandwidth and storage: Self-hosting fonts might require additional server resources and bandwidth, especially if your website receives a high volume of traffic. Google Fonts' CDN handles font delivery, reducing the impact on your hosting resources.
4. Updates and maintenance: With Google Fonts, updates and maintenance are managed by Google, ensuring that new versions and bug fixes are automatically applied. When self-hosting, you'll be responsible for updating and maintaining the fonts yourself.
5. Licensing: Both Google Fonts and self-hosting options come with various licensing considerations. Ensure that you comply with the licensing terms for any fonts you use and understand the restrictions or permissions associated with each option.
It is difficult to say for sure, but there will be numerous opinions regarding what is truly correct.
For my own personal choice, I have decided to ship the fonts to myself, and this decision is based on two main reasons.
Firstly, I have found that optimizing the fonts in this manner generally requires fewer characters compared to using the CDN.
Secondly, by not relying on other sites, I eliminate the risk of potential complications if the Google font were to go down or if there were any connectivity issues with the CDN.
Although my approach may be more time-consuming, as it involves downloading, optimizing, and connecting, I believe that it is the right choice for me.
If we go back 3 years, my advice would have been to use Google as it can provide faster results for the user.
However, recent events like the massive DDoS attack on the DNS server Dyn, which occurred a few days ago, have changed the landscape.
Such incidents can disrupt access to essential files, such as those required for the proper display of a website.
Therefore, it's crucial to be aware of these potential issues and find alternative solutions to ensure uninterrupted user experience.