Including Google Fonts link or import?

What is the preferred way of including Google Fonts on a page? Via the <link> tag <link rel=”preconnect” href=”https://fonts.googleapis.com”> <link rel=”preconnect” href=”https://fonts.gstatic.com” crossorigin> <link href=”https://fonts.googleapis.com/css2?family=Judson:ital,wght@0,400;0,700;1,400&display=swap” rel=”stylesheet”> Via import in a stylesheet @import url(‘https://fonts.googleapis.com/css2?family=Kameron:wght@400;700&display=swap’); Using the Web Font Loader 4 Answers 4

Proper MIME type for .woff2 fonts

Today I updated Font Awesome package to 4.3.0 and noticed that woff2 font was added. That file is linked in CSS so I need to configure nginx to serve woff2 files properly. Currently I have this block in nginx config for fonts: location ~* \.(otf|eot|woff|ttf)$ { types {font/opentype otf;} types {application/vnd.ms-fontobject eot;} types {font/truetype ttf;} … Read more

How to add multiple font files for the same font?

I’m looking at the MDC page for the @font-face CSS rule, but I don’t get one thing. I have separate files for bold, italic and bold + italic. How can I embed all three files in one @font-face rule? For example, if I have: @font-face { font-family: “DejaVu Sans”; src: url(“./fonts/DejaVuSans.ttf”) format(“ttf”); } strong { … Read more