PLAYGROUND (experimental)

font_fill

Set the global fill color for font
font_fill(
    color
) -> NULL

Set the global fill color for font

Arguments

NameTypeRequiredDefaultDescription
coloryes-Font Fill color (hex string)

Full example


var bg = "#004D40";

canvas(width=1200, height=900, background=bg);
console(settings()); 

grid(xmin=0, xmax=width(), ymin=0, ymax=height(), stepMinor=10, colorMinor="#FFE0B266", weightMinor=0.5, stepMajor=100, colorMajor="#FFB74D66", weightMajor=1.5);

var x = 100;
var y = 50;

var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz";
var beta = "ÀÂÄÇÉÈÊËÎÏÔÙÛÜŸÑÆŒ àâäçéèêëîïôùûüÿñæœ";
var gamma = "0123456789 . , ; : ! ? \" ' () [] {} - – — … / @ # $ % & * + = < > | ` ~";


text("No file upload/reading required; we use the embedded font... 'Cabin-Regular'", x=x, y=y);
y+= 50;

text("Hello World", x=750, y=0, size=80, fill="#FFF", stroke="#F00", border=3);

font_size(35);

text(alpha, x=x, y=y, fill="#FFF");
y+= 50;
text(beta, x=x, y=y, fill="#FFF");
y+= 50;
text(gamma, x=x, y=y, fill="#FFF");
y+= 50;
y+= 30;


font_size(42);

text_wrap(randlorem(45, true), x=100,y=500, width=1000, ax=START, ay=START, linespacing=0.65, alignment=START, fill="#FFF", size=37);

var set = settings(); 
console(set); 
console(set.fontsize); 
console("fontsize: ", settings("fontsize")); 
settings("fontsize", 40);
console(settings()); 

console(font_size()); 
font_size(17);
console(font_size(75)); 
console(settings()); 


load_font(filename="RobotoMono-Regular.ttf", size=36);
text("Font automatically loaded into the file system", x=x, y=y, fill="#FFF");
y+= 100;

font_default(30);

text("Back to 'Cabin' (embeded default font)", x=x, y=y, fill="#FFF");
y+= 50;


load_font(filename="http://localhost/data/fonts/ILoveYOUForever.ttf", size=50);
text("Load from an URI", x=x, y=y, fill="#FFF");

font_fill("#F0F");
font_stroke("#0FF");
font_border(2);
font_size(110);
text("Hello World", x=650, y=350);

circle(50,50,40);


save(whoami(png=true));


console(settings()); 

font_default();

console(settings());