【Processing】文字の入った画像を作成する

フォントの名前とサイズを設定して、createFont関数でフォントを動的に作成する。

size(1280,720);
background(255,255,255);
PFont font = createFont("Meiryo", 100);
textFont(font);
fill(0);
textAlign(CENTER, CENTER);
text("文字", width/2, height/2);
save("moji.jpg");

今回は、以下のような画像が作成される。

参考

createFont() / Reference
Dynamically converts a font to the format used by Processing from a .ttf or .otf file inside the sketch's "data" folder ...
タイトルとURLをコピーしました