Closed MarcoTroost closed 4 months ago
Hello @MarcoTroost,
I'm here to help you with any issues you encounter. I'm a bot that can assist you with bug fixes, answer questions, and guide you on becoming a contributor. Let's work together to resolve the problem you're facing with Adobe fonts.
Adobe fonts may not load because the metadata for the fonts could not be downloaded. This issue is handled in the initialiseFontMeta
function, which logs an error if the metadata download fails. Without the metadata, the fonts cannot be injected, leading to them not loading [1].
To continue talking to Dosu, mention @dosu.
Would you provide a reproduction? Unfortunately Stackblitz does not always work due to CORS.
Would you be able to provide a reproduction? 🙏
Hi Daniel, thank you for the swift reply & you great work on Nuxt!
A reproduction (on stackblitz) would probably also cause CORS issues. I have used the fonts module on my testdomain though. You can find it @ www.trauminfo.de
This is my nuxt.config.ts:
export default defineNuxtConfig({
app: {
head: {
htmlAttrs: {
lang: 'nl'
}
}
},
site: {
url: 'https://www.trauminfo.de',
name: 'Droominfo.nl',
defaultLocale: 'nl'
},
nitro: {
moduleSideEffects: [
'@material/web/tabs/tabs.js',
'@material/web/tabs/primary-tab.js',
'@material/web/textfield/filled-text-field.js',
'@material/web/textfield/outlined-text-field.js',
'@material/web/button/filled-button.js',
'@material/web/button/outlined-button.js',
'@material/web/ripple/ripple.js',
'@material/web/icon/icon.js',
],
},
modules: [
["nuxt-ssr-lit", { litElementPrefix: ["md-"] }],
'@nuxtjs/tailwindcss',
'@vueuse/nuxt',
'nuxt-lodash',
"@nuxtjs/sitemap",
"@nuxtjs/google-adsense",
"@nuxt/fonts"
],
fonts: {
adobe: {
id: ['ddx0usu'],
},
experimental: {
processCSSVariables: true
}
},
googleAdsense: {
id: 'ca-pub-7034225815334900',
test: true
},
tailwindcss: {
cssPath: '~/assets/css/droominfo.css',
exposeConfig: false,
},
routeRules: {
'/': { prerender: true },
}
});
Snippet from my tailwind.config:
theme: {
extend: {
fontFamily: {
sans: ['ff-tisa-sans-web-pro', 'sans-serif'],
serif: ['ff-tisa-web-pro', 'serif'],
},
Example implementation:
<p class="font-sans mb-4 text-blue-600 ...">
N.B. This is the correct project id (ddx0usu), since this works on my main domain @ www.droominfo.nl
kind regards,
Marco Troost
Snippet from my tailwind.config:
theme: { extend: { fontFamily: { sans: ['ff-tisa-sans-web-pro', 'sans-serif'], serif: ['ff-tisa-web-pro', 'serif'], },
We only match the names of fonts. ff-tisa-sans-web-pro
is a slug, so it won't be matched. You could try using FF Tisa Sans Pro
and see how it goes.
Hi Qwerzl,
I've tried FF Tisa Sans Pro
, but this doesn't work either.
N.B. The slug is the documented implementation as given by Adobe:
When i look in the .nuxt folder, nuxt-fonts-global.css
is empty:
Hope these screenshots are of help.
kind regards, Marco
Ah, I understand where the problem is. Currently we match fonts with its name from the Typekit API to check if it exists, then we fetch the CSS and get the @font-face
definitions whose family-name
is the font's slug. But for this font, its slug (ff-tisa-web-pro
) and its font-family name defined in the CSS (ff-tisa-web-pro
) are not the same.
Hi guys,
This package seems just what my project needs!
Unfortunately, adobe fonts do no load. N.B> Adobe doesn't load in the playground either...
Hope it will be sorted,
kind regards,
Marco