15 May 2021 @ 09:44 pm
Google Fonts in Dreamwidth Layout  

I've been meaning to explain how this is done for ages, but never did it.

Anyways, you can customize your css here.

Font the font you want to use at Google Fonts.

Once you open the file, choose "select this font". and the selected font will be shown on the sidebar. In the sidebar, pick @ link and not @import. @import does not work in dreamwidth.

To demonstrate, I will change my headline font to "DM Serif Display".

link rel="preconnect" href="https://fonts.gstatic.com" link href="https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&display=swap" rel="stylesheet"

From here, only copy the url: https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&display=swap and open it in a new browser window. This links contains the @fontfance links and those work in dreamwidth. Copy the complete code of the font and add it to your custom css. I'm using only latin-ext and latin, because I don't need other characters.

/* CSS Document */ /* latin-ext */ @font-face { font-family: 'Playfair Display'; font-style: italic; font-weight: 800; font-display: swap; src: url(https://fonts.gstatic.com/s/playfairdisplay/v22/nuFkD-vYSZviVYUb_rj3ij__anPXDTnojEk72xU.woff2) format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @font-face { font-family: 'Playfair Display'; font-style: italic; font-weight: 800; font-display: swap; src: url(https://fonts.gstatic.com/s/playfairdisplay/v22/nuFkD-vYSZviVYUb_rj3ij__anPXDTnogkk7.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* latin-ext */ @font-face { font-family: 'Playfair Display'; font-style: italic; font-weight: 900; font-display: swap; src: url(https://fonts.gstatic.com/s/playfairdisplay/v22/nuFkD-vYSZviVYUb_rj3ij__anPXDTnojEk72xU.woff2) format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @font-face { font-family: 'Playfair Display'; font-style: italic; font-weight: 900; font-display: swap; src: url(https://fonts.gstatic.com/s/playfairdisplay/v22/nuFkD-vYSZviVYUb_rj3ij__anPXDTnogkk7.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* latin-ext */ @font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 800; font-display: swap; src: url(https://fonts.gstatic.com/s/playfairdisplay/v22/nuFiD-vYSZviVYUb_rj3ij__anPXDTLYgFE_.woff2) format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 800; font-display: swap; src: url(https://fonts.gstatic.com/s/playfairdisplay/v22/nuFiD-vYSZviVYUb_rj3ij__anPXDTzYgA.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* latin-ext */ @font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 900; font-display: swap; src: url(https://fonts.gstatic.com/s/playfairdisplay/v22/nuFiD-vYSZviVYUb_rj3ij__anPXDTLYgFE_.woff2) format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 900; font-display: swap; src: url(https://fonts.gstatic.com/s/playfairdisplay/v22/nuFiD-vYSZviVYUb_rj3ij__anPXDTzYgA.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

CSS rules to specify families: font-family: 'DM Serif Display', serif;

My headline in my dearmwidth is noted as .subject, so I will add the following to my custom css.

.subject { font-family: 'Playfair Display', serif; }

PS: shocking, but I forgot how the cut tag worked.

PS2: laughing so hard, because I just noticed, that I offered to do this in 2017. At least it's not like the Star Trek Voyager vip I wrote ages and ages ago where I don't even remember what it's about. :D