+ 2
Need help! How to use font?
Actually I'm working in p5.js program. And in this library, a function "loadFont" loads font saved or installed in system. So my questions are "is it possible to use font without installing or downloading (using url) ?" "is it possible to use font downloaded or installed in system on Sololearn? " " and how can I use that font which is installed in my system on SOLOLEARN? "
5 Respostas
+ 9
@DINESH You can just use the font name in CSS like "Times New Roman" if it's installed in the client's device.
However not all OS share the same font like Comis Sans in Windows and Roboto in Android as HTML is client-side. Therefore, it's better to have a fallback font in case you want to use custom font. 😉
+ 5
Yes you can use url if you can find .otf or ttf files in the internet. Most shared fonts are for css.
+ 5
But it in your web root.
var font;
function preload() {
font = loadFont('font.otf');
}
function setup() {
textFont(myFont) //Activate your font
}
You can also use css fonts.
element.style("font-family": "font name");
https://www.w3schools.com/cssref/css_websafe_fonts.asp
+ 1
Thanks but what about a font installed in computer? How to load it?
+ 1
Yes, it's possible
function textFont('Font url/name') 😉