Skip to content

Commit a28ad4e

Browse files
committed
Add example for p5.Font
1 parent 872594f commit a28ad4e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/typography/p5.Font.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@ import * as constants from '../core/constants';
1515
* @class p5.Font
1616
* @constructor
1717
* @param {p5} [pInst] pointer to p5 instance.
18+
* @example
19+
* <div>
20+
* <code>
21+
* let font;
22+
*
23+
* function preload() {
24+
* // Creates a p5.Font object.
25+
* font = loadFont('assets/inconsolata.otf');
26+
* }
27+
*
28+
* function setup() {
29+
* fill('deeppink');
30+
* textFont(font);
31+
* textSize(36);
32+
* text('p5*js', 10, 50);
33+
*
34+
* describe('The text "p5*js" written in pink on a white background.');
35+
* }
36+
* </code>
37+
* </div>
1838
*/
1939
p5.Font = class {
2040
constructor(p){

0 commit comments

Comments
 (0)