Hello, I try to use font loaded from TypeKit in a React / Gatsby Context, mut the font don’t load. I don’t find the way to do it.
I’m sure my font from Adobe is loaded because I it, by the classic way and the font is displaying perfectly.
I use gatsby-plugin-web-font-loader
to load my font, the .env
with the TYPEKIT_ID
is ok.
but when I pass my font in textFont()
that’s failed and another replacement font is displayed.
function show_label() {
p5.noStroke();
p5.fill(0);
p5.textAlign(p5.CENTER, p5.CENTER);
// p5.textFont('aglet-mono');
p5.textFont("Aglet Mono, mono");
p5.text(p5.data.label, p5.width / 2, p5.height / 2);
}
I try different writing case like “Aglet Mono” or “aglet-mono”, or “aglet mono” … but that’s change nothing.
My configuration is
"dependencies": {
"gatsby": "5.2",
"p5": "^1.5.0",
"react": "^18.0.0",
}
I try too set the font directly in the CSS component, but that's don't work too.
The only post I found about that it's :
https://www.geeksforgeeks.org/p5-js-textfont-function/
but it's not really appropriate, because is not on the React context.
So, if anybody have an idea, that's can be make my day !