Provo a caricare un carattere personalizzato in Pixi.js (framework WebGL 2D).Carattere personalizzato in Pixi.js
Hanno un esempio utilizzando .woff google font:
https://github.com/GoodBoyDigital/pixi.js/tree/master/examples/example%2010%20-%20Text
ho convertito la mia Ttf a .woff e ha aggiunto in css:
@font-face
{
font-family: "HU_Adrien";
src: local('HU_Adrien'), url('HU_A0046.woff') format('woff');;
}
div.font{
font-family: "HU_Adrien";
color: white;
}
si vede nel mio div ma non nel mio stadio di Pixi.
...
// create a text object with a nice stroke
var spinningText = new PIXI.Text("I'm fun!", {font: "160px HU_Adrien", fill: "#cc00ff", align: "center", stroke: "#FFFFFF", strokeThickness: 6});
// setting the anchor point to 0.5 will center align the text... great for spinning!
spinningText.anchor.x = spinningText.anchor.y = 0.5;
spinningText.position.x = 620/2;
spinningText.position.y = 400/2;
...
Potrebbe non avere la sorgente elencata nella riga? Come il '.woff'? – Brendan
Nell'esempio di GoodBoy stanno pre-caricando il font, non sono sicuro che tu abbia un problema di razza con css. prova a impostare '{font:" 160px HU_Adrien, arial "..." e vedi se hai almeno un testo. –